|
1 | 1 | // ==UserScript== |
2 | 2 | // @name YouTube™ Classic 📺 — (Remove rounded design + Return YouTube dislikes) |
3 | | -// @version 2026.1.27.4 |
| 3 | +// @version 2026.1.27.5 |
4 | 4 | // @author Adam Lui, Magma_Craft, 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 |
|
1029 | 1029 |
|
1030 | 1030 | /* Hide Edit your custom feed chip */ |
1031 | 1031 | yt-chip-cloud-chip-renderer:has(path[d^="M5 0a5 5"]) { display: none } |
1032 | | -
|
1033 | | - @media only screen and (min-width: 768px) { /* align sub btn right */ |
1034 | | - div#subscribe-button { position: absolute ; right: 0 }} |
1035 | 1032 | `)} |
1036 | 1033 | dom.get.loadedElem('head').then(() => document.head.append(app.styles.fixes)) |
1037 | 1034 |
|
|
1073 | 1070 | }) |
1074 | 1071 | dom.get.loadedElem('html').then(() => homeObserver.observe(document.documentElement, obsConfig)) |
1075 | 1072 |
|
1076 | | - // Set actions div padding + update when needed |
| 1073 | + // Set/update subscribe button pos |
1077 | 1074 | dom.get.loadedElem('ytd-subscribe-button-renderer button').then(subBtn => { |
1078 | | - setTimeout(updateActionsDivPadding, 5000) |
1079 | | - new MutationObserver(updateActionsDivPadding).observe(subBtn, { childList: true, subtree: true }) |
1080 | | - window.addEventListener('resize', updateActionsDivPadding) |
| 1075 | + requestAnimationFrame(updateSubBtnPos) |
| 1076 | + new MutationObserver(updateSubBtnPos).observe(subBtn, { childList: true, subtree: true }) |
| 1077 | + window.addEventListener('resize', updateSubBtnPos) |
1081 | 1078 | }) |
1082 | | - function updateActionsDivPadding() { |
1083 | | - if (updateActionsDivPadding.timeout) clearTimeout(updateActionsDivPadding.timeout) |
1084 | | - updateActionsDivPadding.timeout = setTimeout(async () => { |
1085 | | - const actionsDiv = await dom.get.loadedElem('div#actions'), |
| 1079 | + function updateSubBtnPos() { |
| 1080 | + if (updateSubBtnPos.timeout) clearTimeout(updateSubBtnPos.timeout) |
| 1081 | + updateSubBtnPos.timeout = setTimeout(async () => { |
| 1082 | + const primaryDiv = await dom.get.loadedElem('div#primary'), |
| 1083 | + actionsDiv = await dom.get.loadedElem('div#actions'), |
| 1084 | + subBtn = await dom.get.loadedElem('div#subscribe-button'), |
1086 | 1085 | bellIcon = await dom.get.loadedElem('[animated-icon-type=NOTIFICATION_BELL] svg'), |
1087 | | - bellWidth = getComputedStyle(bellIcon).width, |
1088 | | - idealActionsRpadding = !window.matchMedia('(min-width: 768px)').matches ? '' |
1089 | | - : `${125 + (bellWidth.endsWith('px') ? parseInt(bellWidth.slice(0, -2)) : 0)}px` |
| 1086 | + bellWidth = parseInt(getComputedStyle(bellIcon).width), |
| 1087 | + primaryWidth = parseInt(getComputedStyle(primaryDiv).width), |
| 1088 | + idealActionsRpadding = primaryWidth < 768 ? '' : `${ 125 +( bellWidth == 100 ? 0 : bellWidth )}px` |
| 1089 | + Object.assign(subBtn.style, |
| 1090 | + primaryWidth > 768 ? { position: 'absolute', right: 0 } : { position: '', right: '' }) |
1090 | 1091 | if (getComputedStyle(actionsDiv).paddingRight != idealActionsRpadding) |
1091 | 1092 | actionsDiv.style.paddingRight = idealActionsRpadding |
1092 | 1093 | }, 50) |
|
0 commit comments