|
1 | 1 | // ==UserScript== |
2 | 2 | // @name YouTube™ Classic 📺 — (Remove rounded design + Return YouTube dislikes) |
3 | | -// @version 2026.1.17.19 |
| 3 | +// @version 2026.1.17.20 |
4 | 4 | // @author Adam Lui, Magma_Craft, Anarios, JRWR, Fuim & hoothin |
5 | 5 | // @namespace https://github.com/adamlui |
6 | 6 | // @description Reverts YouTube to its classic design (before all the rounded corners & hidden dislikes) + redirects YouTube Shorts |
|
1831 | 1831 |
|
1832 | 1832 | let mutationObserver = new Object() |
1833 | 1833 |
|
1834 | | - if (isShorts() && mutationObserver.exists != true) { |
| 1834 | + if (isShorts() && !mutationObserver.exists) { |
1835 | 1835 | cLog('initializing mutation observer') |
1836 | | - mutationObserver.options = { |
1837 | | - childList: false, |
1838 | | - attributes: true, |
1839 | | - subtree: false |
1840 | | - } |
| 1836 | + mutationObserver.options = { childList: false, attributes: true, subtree: false } |
1841 | 1837 | mutationObserver.exists = true |
1842 | 1838 | mutationObserver.observer = new MutationObserver(function(mutationList) { |
1843 | | - mutationList.forEach((mutation) => { |
| 1839 | + mutationList.forEach(mutation => { |
1844 | 1840 | if ( |
1845 | 1841 | mutation.type == 'attributes' && |
1846 | 1842 | mutation.target.nodeName == 'TP-YT-PAPER-BUTTON' && |
|
1983 | 1979 | likesvalue = likes |
1984 | 1980 | dislikesvalue = dislikes |
1985 | 1981 | setDislikes(numberFormat(dislikes)) |
1986 | | - if (extConfig.numberDisplayReformatLikes == true) { |
| 1982 | + if (extConfig.numberDisplayReformatLikes) { |
1987 | 1983 | const nativeLikes = getLikeCountFromButton() |
1988 | 1984 | if (nativeLikes != null) setLikes(numberFormat(nativeLikes)) |
1989 | 1985 | } |
1990 | 1986 | createRateBar(likes, dislikes) |
1991 | | - if (extConfig.coloredThumbs == true) { |
| 1987 | + if (extConfig.coloredThumbs) { |
1992 | 1988 | if (isShorts()) { |
1993 | 1989 | // for shorts, leave deactived buttons in default color |
1994 | 1990 | let shortLikeButton = getLikeButton().querySelector( |
|
2039 | 2035 | createRateBar(likesvalue, dislikesvalue) |
2040 | 2036 | previousState = 1 |
2041 | 2037 | } |
2042 | | - if (extConfig.numberDisplayReformatLikes == true) { |
| 2038 | + if (extConfig.numberDisplayReformatLikes) { |
2043 | 2039 | const nativeLikes = getLikeCountFromButton() |
2044 | 2040 | if (nativeLikes != null) setLikes(numberFormat(nativeLikes)) |
2045 | 2041 | } |
|
2064 | 2060 | setDislikes(numberFormat(dislikesvalue)) |
2065 | 2061 | createRateBar(likesvalue, dislikesvalue) |
2066 | 2062 | previousState = 2 |
2067 | | - if (extConfig.numberDisplayReformatLikes == true) { |
| 2063 | + if (extConfig.numberDisplayReformatLikes) { |
2068 | 2064 | const nativeLikes = getLikeCountFromButton() |
2069 | 2065 | if (nativeLikes != null) setLikes(numberFormat(nativeLikes)) |
2070 | 2066 | } |
|
2098 | 2094 | return value * 10 ** decimal |
2099 | 2095 | } |
2100 | 2096 |
|
2101 | | - function numberFormat(numberState) { |
2102 | | - let numberDisplay |
2103 | | - if (extConfig.numberDisplayRoundDown == false) { numberDisplay = numberState |
2104 | | - } else { numberDisplay = roundDown(numberState) } |
2105 | | - return getNumberFormatter(extConfig.numberDisplayFormat).format(numberDisplay) |
| 2097 | + function numberFormat(numState) { |
| 2098 | + const numDisplay = !extConfig.numberDisplayRoundDown ? numState : roundDown(numState) |
| 2099 | + return getNumberFormatter(extConfig.numberDisplayFormat).format(numDisplay) |
2106 | 2100 | } |
2107 | 2101 |
|
2108 | 2102 | function getNumberFormatter(optionSelect) { |
2109 | 2103 | let userLocales |
2110 | | - if (document.documentElement.lang) { userLocales = document.documentElement.lang |
2111 | | - } else if (navigator.language) { userLocales = navigator.language |
2112 | | - } else { |
| 2104 | + if (document.documentElement.lang) userLocales = document.documentElement.lang |
| 2105 | + else if (navigator.language) userLocales = navigator.language |
| 2106 | + else { |
2113 | 2107 | try { |
2114 | 2108 | userLocales = new URL( |
2115 | 2109 | Array.from(document.querySelectorAll('head > link[rel="search"]')) |
|
0 commit comments