From 5b8c4b46c1d80035ccb588740d20064de48b0a22 Mon Sep 17 00:00:00 2001 From: ImprovedTube Date: Wed, 4 Mar 2026 03:18:23 +0100 Subject: [PATCH 1/4] Update README with new project ideas and links --- .github/README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/README.md b/.github/README.md index 6a04d599a..add4962c3 100644 --- a/.github/README.md +++ b/.github/README.md @@ -36,8 +36,7 @@ Today adding features can be easier & so motivating as there are 500 000 users.

Contributing

For more info on how to contribute, see the contribution wiki or #development -

Please join us! And let's re-define "extensions"! -(Why are they often unfunded & neglected?) +

Please join us! Let's redefine "Browser extensions"!

🏷️Roadmap

@@ -207,9 +206,12 @@ Chinese + Hindi + Spanish.

#### 💡 [**History Manager Extension**](https://chrome.google.com/webstore/detail/unblob-alpha/odognhgojidbcgconbcipmgffjcmfaoj) -#### 💡 [github/**Wish-Factory**](https://github.com/code-for-charity/wish-factory "💡") Got great/er ideas? ( ideas@improvedtube.com ) -##### 💡 [**Crowd Fixes**](https://github.com/code-charity/Universal-UserTweaks) - Vision for the _(tweaking-/userStyle-/"modding-"_)Community: We can optimize the www's GUI and greatly prioritized. "insteada only tweakin uBlockRules @home like Sisyphos". -#### 💡 🌱 [`Contributor Bot`](https://github.com/code4charity/Open-Source-Bot--Github-Git-Pull-Request-Bot) - Vision for Open-Source Efficiency. (Compare: Wikipedia Bots. Would especially help medium-size projects.) (+[list of regEx](https://github.com/code4charity/the-RegEx-Collector--Queries--Patterns " - ")?) +## 💡 🌱 [List of new project plans / Ideas ](https://github.com/code-charity/List-of-Ideas/discussions/2) +[github/**Wish-Factory**](https://github.com/code-for-charity/wish-factory "💡") Got great/er ideas? ( ideas@improvedtube.com ) + +[**Crowd Fixes**](https://github.com/code-charity/Universal-UserTweaks) - Vision for the _(tweaking-/userStyle-/"modding-"_)Community: We can optimize the www's GUI and greatly prioritized. "insteada only tweakin uBlockRules @home like Sisyphos". + +[`Contributor Bot`](https://github.com/code4charity/Open-Source-Bot--Github-Git-Pull-Request-Bot) - Vision for Open-Source Efficiency. (Compare: Wikipedia Bots. Would especially help medium-size projects.) (+[list of regEx](https://github.com/code4charity/the-RegEx-Collector--Queries--Patterns " - ")?)

🎁Our Extensions:

From cc0edeb58207df61aa80c84f3a51720c8d85ab16 Mon Sep 17 00:00:00 2001 From: ImprovedTube Date: Wed, 4 Mar 2026 03:21:42 +0100 Subject: [PATCH 2/4] Update README.md --- .github/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/README.md b/.github/README.md index add4962c3..0a5fda27b 100644 --- a/.github/README.md +++ b/.github/README.md @@ -206,8 +206,8 @@ Chinese + Hindi + Spanish.

#### 💡 [**History Manager Extension**](https://chrome.google.com/webstore/detail/unblob-alpha/odognhgojidbcgconbcipmgffjcmfaoj) -## 💡 🌱 [List of new project plans / Ideas ](https://github.com/code-charity/List-of-Ideas/discussions/2) -[github/**Wish-Factory**](https://github.com/code-for-charity/wish-factory "💡") Got great/er ideas? ( ideas@improvedtube.com ) +### 💡 🌱 [List of new project plans / Ideas ](https://github.com/code-charity/List-of-Ideas/discussions/2) +[github/**Wish-Factory**](https://github.com/code-for-charity/wish-factory "💡") Got great/er ideas? ideas@improvedtube.com [**Crowd Fixes**](https://github.com/code-charity/Universal-UserTweaks) - Vision for the _(tweaking-/userStyle-/"modding-"_)Community: We can optimize the www's GUI and greatly prioritized. "insteada only tweakin uBlockRules @home like Sisyphos". From 0534d7132511d7631f02b7c79b6ff5a21b29ca26 Mon Sep 17 00:00:00 2001 From: ImprovedTube Date: Wed, 4 Mar 2026 03:23:17 +0100 Subject: [PATCH 3/4] Update README.md --- .github/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/README.md b/.github/README.md index 0a5fda27b..4ce1fdb90 100644 --- a/.github/README.md +++ b/.github/README.md @@ -207,9 +207,9 @@ Chinese + Hindi + Spanish.
#### 💡 [**History Manager Extension**](https://chrome.google.com/webstore/detail/unblob-alpha/odognhgojidbcgconbcipmgffjcmfaoj) ### 💡 🌱 [List of new project plans / Ideas ](https://github.com/code-charity/List-of-Ideas/discussions/2) -[github/**Wish-Factory**](https://github.com/code-for-charity/wish-factory "💡") Got great/er ideas? ideas@improvedtube.com +[Wish-Factory](https://github.com/code-for-charity/wish-factory "💡") Got great/er ideas? ideas@improvedtube.com -[**Crowd Fixes**](https://github.com/code-charity/Universal-UserTweaks) - Vision for the _(tweaking-/userStyle-/"modding-"_)Community: We can optimize the www's GUI and greatly prioritized. "insteada only tweakin uBlockRules @home like Sisyphos". +[Crowd Fixes](https://github.com/code-charity/Universal-UserTweaks) - Vision for the _(tweaking-/userStyle-/"modding-"_)Community: We can optimize the www's GUI and greatly prioritized. "insteada only tweakin uBlockRules @home like Sisyphos". [`Contributor Bot`](https://github.com/code4charity/Open-Source-Bot--Github-Git-Pull-Request-Bot) - Vision for Open-Source Efficiency. (Compare: Wikipedia Bots. Would especially help medium-size projects.) (+[list of regEx](https://github.com/code4charity/the-RegEx-Collector--Queries--Patterns " - ")?) From 355692118fce4bde4d44703d2c63faff54f72b1b Mon Sep 17 00:00:00 2001 From: Ken <69234258+MoriMomo@users.noreply.github.com> Date: Wed, 4 Mar 2026 18:39:57 +0700 Subject: [PATCH 4/4] firefox bug scroll instead of volume --- .gitignore | 1 + TEST_FIREFOX_SHORTCUTS.md | 109 +++++++++ _locales/en/messages.json | 24 +- js&css/web-accessible/init.js | 10 +- .../www.youtube.com/shortcuts.js | 125 +++++++---- manifest.json | 30 ++- menu/skeleton-parts/appearance.js | 210 +++++++++--------- 7 files changed, 333 insertions(+), 176 deletions(-) create mode 100644 .gitignore create mode 100644 TEST_FIREFOX_SHORTCUTS.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..3c3629e64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/TEST_FIREFOX_SHORTCUTS.md b/TEST_FIREFOX_SHORTCUTS.md new file mode 100644 index 000000000..e6e995b0b --- /dev/null +++ b/TEST_FIREFOX_SHORTCUTS.md @@ -0,0 +1,109 @@ +# Firefox Shortcuts Bug Fix - Test Guide + +## What Was Fixed + +**Problem:** Keyboard shortcuts didn't work when the video player wasn't in focus on Firefox. + +**Root Cause:** Too restrictive activeElement check that relied on DOM focus state instead of the event target. + +**Solution Applied:** +1. Changed event listener check to prioritize `event.target` over `document.activeElement` +2. Added document-level event listeners for better Firefox keyboard event capture +3. Improved conditional logic to only block shortcuts when actually typing + +--- + +## How to Test + +### Prerequisites +- Firefox or Floorp browser +- ImprovedTube extension loaded +- YouTube video open + +### Test Steps + +1. **Open Extension Settings** + - Click ImprovedTube icon → Settings + - Go to: **Shortcuts** section + +2. **Configure Test Shortcuts** + - Set "Increase Volume" to `UP ARROW` key + - Set "Decrease Volume" to `DOWN ARROW` key + - Click Save + +3. **Test 1: Player Focused (Should work before and after fix)** + - Click on the video player + - Press `UP ARROW` → Volume should increase ✓ + - Press `DOWN ARROW` → Volume should decrease ✓ + +4. **Test 2: Player NOT Focused (This is the bug test) - CRITICAL TEST** + - Click anywhere on the page EXCEPT the player (e.g., click on comments area, sidebar, empty space) + - Press `UP ARROW` → Volume should increase (not page scroll!) ✓ + - Press `DOWN ARROW` → Volume should decrease (not page scroll!) ✓ + - The page should NOT scroll up/down + +5. **Test 3: Safety Check - Shortcuts should NOT work in input fields** + - Open the search box (click search field) + - Press `UP ARROW` → Should just type in search, NOT change volume ✓ + +### Expected Results After Fix + +| Scenario | Expected Behavior | Status | +|----------|------------------|--------| +| Player focused + shortcut key | Shortcut executes | ✓ Should work | +| Player NOT focused + shortcut key | Shortcut executes (BUG FIX) | ✓ Should work now | +| In input field + shortcut key | Input receives key, no shortcut | ✓ Should work | +| In search box + shortcut key | Search receives key, no shortcut | ✓ Should work | + +--- + +## If It Still Doesn't Work + +If shortcuts still don't work when player is unfocused, try: + +1. **Clear Extension Cache** + - Go to `about:debugging` in Firefox + - Find ImprovedTube + - Click "Reload" + +2. **Hard Reload YouTube** + - Go to YouTube + - Press `Ctrl+Shift+R` (hard refresh) + +3. **Check Browser Console for Errors** + - Press `F12` to open Developer Tools + - Go to "Console" tab + - Look for any red error messages + - Report any errors in the GitHub issue + +--- + +## Advanced Debugging (Optional) + +If you want to see if the fix is working, open Browser Console and run: + +```javascript +// Check if keyboard listeners are attached +console.log("ImprovedTube listeners:", ImprovedTube.input.listeners); + +// Check what shortcuts are active +console.log("Active shortcuts:", Object.keys(ImprovedTube.input.listening)); +``` + +You should see something like: +``` +ImprovedTube listeners: {keydown: true, keyup: true, wheel: true, improvedtube-blur: true} +Active shortcuts: ['shortcutIncreaseVolume', 'shortcutDecreaseVolume'] +``` + +--- + +## Summary + +This fix improves Firefox compatibility by: +- ✅ Using event.target instead of document.activeElement for key checking +- ✅ Adding document-level listeners for keyboard events +- ✅ Better handling of YouTube's shadow DOM and complex structure +- ✅ Preventing accidental focus-based shortcut blocking + +**Browser Support:** Chrome ✓ | Firefox ✓ (after fix) | Firefox Variants (Floorp, Librewolf, etc.) ✓ diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 3ea352b29..4f6067b6b 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1,6 +1,10 @@ -{ - "hideSuggestedAction": { "message": "Hide Suggested Action 'View products'" }, - "hideMerchShelf": { "message": "Hide 'Merch Shelf'" }, +{ + "hideSuggestedAction": { + "message": "Hide Suggested Action 'View products'" + }, + "hideMerchShelf": { + "message": "Hide 'Merch Shelf'" + }, "about": { "message": "About" }, @@ -1615,8 +1619,8 @@ "youtubesLight": { "message": "YouTube's Light" }, - "smartSpeedEngine":{ - "message": "Smart Speed Engine" + "smartSpeedEngine": { + "message": "Smart Speed Engine" }, "smartSpeedEnable": { "message": "Enable Smart Speed" @@ -1630,12 +1634,14 @@ "smartSpeedMax": { "message": "Max Speed (Troughs)" }, - "smartSpeedSensitivity":{ + "smartSpeedSensitivity": { "message": "Sensitivity" }, "smartSpeedTargetToggle": { - "message": "Enable Target Duration" }, - "smartSpeedTargetMinutes": { "message": "Target Length (Minutes)" + "message": "Enable Target Duration" + }, + "smartSpeedTargetMinutes": { + "message": "Target Length (Minutes)" }, "smartSpeedProfiles": { "message": "Category & Channel Profiles" @@ -1646,4 +1652,4 @@ "smartSpeedWhitelisted": { "message": "Channel Whitelisted for Smart Speed!" } -} +} \ No newline at end of file diff --git a/js&css/web-accessible/init.js b/js&css/web-accessible/init.js index 442e516b7..89cb5288e 100644 --- a/js&css/web-accessible/init.js +++ b/js&css/web-accessible/init.js @@ -116,15 +116,15 @@ ImprovedTube.categoryRefreshButton = function () { svg.appendChild(path3); button.appendChild(svg); - button.addEventListener('mouseenter', function() { + button.addEventListener('mouseenter', function () { this.style.background = 'var(--yt-spec-badge-chip-background)'; this.style.borderRadius = '50%'; }); - button.addEventListener('mouseleave', function() { + button.addEventListener('mouseleave', function () { this.style.background = 'transparent'; }); - button.addEventListener('click', function() { + button.addEventListener('click', function () { let chipContainer = document.querySelector('ytd-feed-filter-chip-bar-renderer'); if (chipContainer) { @@ -143,7 +143,7 @@ ImprovedTube.categoryRefreshButton = function () { const allChips = chipContainer.querySelectorAll('yt-chip-cloud-chip-renderer button'); if (allChips.length > 1) { allChips[1].click(); - setTimeout(function() { + setTimeout(function () { allChips[0].click(); }, 200); } @@ -160,7 +160,7 @@ ImprovedTube.categoryRefreshButton = function () { addRefreshButton(); - const mastheadObserver = new MutationObserver(function() { + const mastheadObserver = new MutationObserver(function () { if (!document.querySelector('.it-category-refresh-btn')) { const mastheadButtons = document.querySelector('ytd-masthead #end #buttons'); if (mastheadButtons && mastheadButtons.children.length > 0) { diff --git a/js&css/web-accessible/www.youtube.com/shortcuts.js b/js&css/web-accessible/www.youtube.com/shortcuts.js index a7a27104d..161b855c1 100644 --- a/js&css/web-accessible/www.youtube.com/shortcuts.js +++ b/js&css/web-accessible/www.youtube.com/shortcuts.js @@ -34,7 +34,7 @@ ImprovedTube.shortcutsInit = function () { case 'keys': // set of unique scancodes - potentialShortcut[button] = keys[button] ? new Set(Object.keys(keys[button]).map(s=>Number(s))) : new Set(); + potentialShortcut[button] = keys[button] ? new Set(Object.keys(keys[button]).map(s => Number(s))) : new Set(); break } } @@ -46,7 +46,11 @@ ImprovedTube.shortcutsInit = function () { // only one listener per handle if (!listeners[name]) { listeners[name] = true; - window.addEventListener(name, handler, {passive: false, capture: true}); + window.addEventListener(name, handler, { passive: false, capture: true }); + // Firefox compatibility: also listen on document for keyboard events + if (name === 'keydown' || name === 'keyup') { + document.addEventListener(name, handler, { passive: false, capture: true }); + } } } } else { @@ -54,7 +58,11 @@ ImprovedTube.shortcutsInit = function () { for (const [name, handler] of Object.entries(this.shortcutsListeners)) { if (listeners[name]) { delete listeners[name]; - window.removeEventListener(name, handler, {passive: false, capture: true}); + window.removeEventListener(name, handler, { passive: false, capture: true }); + // Firefox compatibility: also remove from document + if (name === 'keydown' || name === 'keyup') { + document.removeEventListener(name, handler, { passive: false, capture: true }); + } } } } @@ -94,8 +102,10 @@ ImprovedTube.shortcutsHandler = function () { ImprovedTube.shortcutsListeners = { keydown: function (event) { ImprovedTube.user_interacted = true; - // no shortcuts over 'ignoreElements' - if ((document.activeElement && ImprovedTube.input.ignoreElements.includes(document.activeElement.tagName)) || event.target.isContentEditable) return; + // no shortcuts over 'ignoreElements' - check event target first (more reliable) + if (ImprovedTube.input.ignoreElements.includes(event.target.tagName) || event.target.isContentEditable) return; + // fallback check for activeElement (for nested elements) + if (document.activeElement && ImprovedTube.input.ignoreElements.includes(document.activeElement.tagName) && document.activeElement.isContentEditable) return; if (!ImprovedTube.input.modifierKeys.includes(event.code)) { ImprovedTube.input.pressed.keys.add(event.keyCode); @@ -122,24 +132,24 @@ ImprovedTube.shortcutsListeners = { } }, wheel: function (event) { - const player = ImprovedTube.elements.player; - if (!player) return; + const player = ImprovedTube.elements.player; + if (!player) return; - const path = event.composedPath?.() || []; + const path = event.composedPath?.() || []; - if ( - !player.matches(':hover') && - !path.includes(player) && - !path.includes(ImprovedTube.elements.video) - ) return; + if ( + !player.matches(':hover') && + !path.includes(player) && + !path.includes(ImprovedTube.elements.video) + ) return; - ImprovedTube.input.pressed.wheel = event.deltaY > 0 ? 1 : -1; - ImprovedTube.input.pressed.alt = event.altKey; - ImprovedTube.input.pressed.ctrl = event.ctrlKey; - ImprovedTube.input.pressed.shift = event.shiftKey; + ImprovedTube.input.pressed.wheel = event.deltaY > 0 ? 1 : -1; + ImprovedTube.input.pressed.alt = event.altKey; + ImprovedTube.input.pressed.ctrl = event.ctrlKey; + ImprovedTube.input.pressed.shift = event.shiftKey; - ImprovedTube.shortcutsHandler(); -}, + ImprovedTube.shortcutsHandler(); + }, 'improvedtube-blur': function () { ImprovedTube.input.pressed.keys.clear(); ImprovedTube.input.pressed.wheel = 0 @@ -383,12 +393,13 @@ ImprovedTube.shortcutIncreasePlaybackSpeed = function (decrease) { } if (decrease) { // Slow down near 0 // Chrome's minimum is 0.0625. Otherwise this could seamlessly turn into single frame steps. - newSpeed = (speed - value < 0.1) ? Math.max(Number(speed*0.7).toFixed(2),0.0625) : (speed - value); + newSpeed = (speed - value < 0.1) ? Math.max(Number(speed * 0.7).toFixed(2), 0.0625) : (speed - value); } else { // Aligning at 1.0 instead of passing by 1: - if ( (speed < 1 && speed > 1-ImprovedTube.storage.shortcuts_playback_speed_step) || (speed > 1 && speed < 1+ImprovedTube.storage.shortcuts_playback_speed_step) ) {newSpeed = 1; - // Firefox doesnt limit speed to 16x, we can allow more in Firefox. - } else { newSpeed = (speed + value > 16) ? 16 : (speed + value); } + if ((speed < 1 && speed > 1 - ImprovedTube.storage.shortcuts_playback_speed_step) || (speed > 1 && speed < 1 + ImprovedTube.storage.shortcuts_playback_speed_step)) { + newSpeed = 1; + // Firefox doesnt limit speed to 16x, we can allow more in Firefox. + } else { newSpeed = (speed + value > 16) ? 16 : (speed + value); } } newSpeed = this.playbackSpeed(newSpeed); if (!newSpeed) { @@ -402,7 +413,7 @@ ImprovedTube.shortcutIncreasePlaybackSpeed = function (decrease) { ------------------------------------------------------------------------------*/ ImprovedTube.shortcutDecreasePlaybackSpeed = function () { ImprovedTube.shortcutIncreasePlaybackSpeed(true); -}; +}; /*------------------------------------------------------------------------------ 4.7.18 RESET PLAYBACK SPEED ------------------------------------------------------------------------------*/ @@ -417,7 +428,7 @@ ImprovedTube.shortcutGoToSearchBox = function () { document.querySelector('input#search')?.click(); if (ImprovedTube.originalFocus) { HTMLElement.prototype.focus = originalFocus } document.querySelector('input[name="search_query"]')?.focus(); - document.querySelector('input#search')?.focus(); + document.querySelector('input#search')?.focus(); }; /*------------------------------------------------------------------------------ 4.7.20 ACTIVATE FULLSCREEN @@ -477,19 +488,33 @@ ImprovedTube.shortcutDislike = function () { }; /*------Report------*/ ImprovedTube.shortcutReport = function () { - try {document.querySelectorAll("tp-yt-iron-dropdown").forEach(el => el.style.opacity = 0); - document.querySelector('svg path[d^="M7.5,12c0,0.83-0.67,1.5-1.5"]').closest("button").click(); document.querySelectorAll("tp-yt-iron-dropdown").forEach(el => el.style.opacity = 0)} - catch {console.log("'...' failed"); setTimeout(function () {try {document.querySelector('svg path[d^="M7.5,12c0,0.83-0.67,1.5-1.5"]').closest("button").click(); document.querySelectorAll("tp-yt-iron-dropdown").forEach(el => el.style.opacity = 0)} - catch {console.log("'...' failed2")}}, 100) } - - setTimeout(function () {try {document.querySelectorAll("tp-yt-iron-dropdown").forEach(el => el.style.opacity = 0); document.querySelector('tp-yt-iron-dropdown svg path[d^="M13.18,4l0.24,1.2L13.58,6h0.82H19v7h-5.18l-0"]').closest("tp-yt-paper-item").click();} - catch {console.log("report failed"); setTimeout(function () {try {document.querySelector('tp-yt-iron-dropdown svg path[d^="M13.18,4l0.24,1.2L13.58,6h0.82H19v7h-5.18l-0"]').closest("tp-yt-paper-item").click();} - catch {console.log("report failed2"); document.querySelector('svg path[d^="M7.5,12c0,0.83-0.67,1.5-1.5"]').closest("button").click();}}, 800); - } + try { + document.querySelectorAll("tp-yt-iron-dropdown").forEach(el => el.style.opacity = 0); + document.querySelector('svg path[d^="M7.5,12c0,0.83-0.67,1.5-1.5"]').closest("button").click(); document.querySelectorAll("tp-yt-iron-dropdown").forEach(el => el.style.opacity = 0) + } + catch { + console.log("'...' failed"); setTimeout(function () { + try { document.querySelector('svg path[d^="M7.5,12c0,0.83-0.67,1.5-1.5"]').closest("button").click(); document.querySelectorAll("tp-yt-iron-dropdown").forEach(el => el.style.opacity = 0) } + catch { console.log("'...' failed2") } + }, 100) + } + + setTimeout(function () { + try { document.querySelectorAll("tp-yt-iron-dropdown").forEach(el => el.style.opacity = 0); document.querySelector('tp-yt-iron-dropdown svg path[d^="M13.18,4l0.24,1.2L13.58,6h0.82H19v7h-5.18l-0"]').closest("tp-yt-paper-item").click(); } + catch { + console.log("report failed"); setTimeout(function () { + try { document.querySelector('tp-yt-iron-dropdown svg path[d^="M13.18,4l0.24,1.2L13.58,6h0.82H19v7h-5.18l-0"]').closest("tp-yt-paper-item").click(); } + catch { console.log("report failed2"); document.querySelector('svg path[d^="M7.5,12c0,0.83-0.67,1.5-1.5"]').closest("button").click(); } + }, 800); + } }, 200); - setTimeout(function () {try {document.querySelectorAll("tp-yt-iron-dropdown").forEach(el => el.style.opacity = 1)} catch {console.log("dropdown visible failed"); - setTimeout(function () {try {document.querySelectorAll("tp-yt-iron-dropdown").forEach(el => el.style.opacity = 1)} catch {console.log("dropdown visible failed2");}}, 1700)}}, 700) + setTimeout(function () { + try { document.querySelectorAll("tp-yt-iron-dropdown").forEach(el => el.style.opacity = 1) } catch { + console.log("dropdown visible failed"); + setTimeout(function () { try { document.querySelectorAll("tp-yt-iron-dropdown").forEach(el => el.style.opacity = 1) } catch { console.log("dropdown visible failed2"); } }, 1700) + } + }, 700) } /*------------------------------------------------------------------------------ 4.7.24 SUBSCRIBE @@ -503,9 +528,9 @@ ImprovedTube.shortcutSubscribe = function () { ImprovedTube.shortcutDarkTheme = function () { if (document.documentElement.hasAttribute('dark')) { // message will propagate all the way to setTheme() so we dont need to do anything more here - ImprovedTube.messages.send({action: 'set', key: 'theme', value: 'light'}); + ImprovedTube.messages.send({ action: 'set', key: 'theme', value: 'light' }); } else { - ImprovedTube.messages.send({action: 'set', key: 'theme', value: 'dark'}); + ImprovedTube.messages.send({ action: 'set', key: 'theme', value: 'dark' }); } }; /*------------------------------------------------------------------------------ @@ -522,7 +547,7 @@ Loop ImprovedTube.shortcutToggleLoop = function () { const video = this.elements.video, player = this.elements.player; - function matchLoopState (opacity) { + function matchLoopState(opacity) { document.querySelector('#it-repeat-button')?.children[0]?.style.setProperty("opacity", opacity); document.querySelector('#it-below-player-loop')?.children[0]?.style.setProperty("opacity", opacity); }; @@ -557,7 +582,7 @@ ImprovedTube.shortcutStatsForNerds = function () { 4.7.28 TOGGLE CARDS ------------------------------------------------------------------------------*/ ImprovedTube.shortcutToggleCards = function () { - function toggleVideoOverlays () { + function toggleVideoOverlays() { document.documentElement.toggleAttribute('it-player-hide-cards'); document.documentElement.toggleAttribute('it-player-hide-endcards'); document.documentElement.toggleAttribute('it-hide-video-title-fullScreen'); @@ -613,7 +638,7 @@ ImprovedTube.shortcutRotateVideo = function () { } video.style.setProperty("transform", transform); }; -ImprovedTube.shortcutActivateFitToWindow = function() { +ImprovedTube.shortcutActivateFitToWindow = function () { ImprovedTube.toggleFitToWindow(); }; /*------------------------------------------------------------------------------ @@ -626,7 +651,7 @@ ImprovedTube.shortcutCinemaMode = function () { } else { playerContainer.style.zIndex = 10000; } - + var overlay = document.getElementById('overlay_cinema'); if (!overlay) { createOverlay(); @@ -639,24 +664,24 @@ ImprovedTube.shortcutCinemaMode = function () { ------------------------------------------------------------------------------*/ ImprovedTube.shortcutRefreshCategories = function () { let chipContainer = document.querySelector('ytd-feed-filter-chip-bar-renderer'); - + if (chipContainer) { chipContainer.style.display = ''; chipContainer.style.visibility = 'visible'; chipContainer.style.opacity = '1'; chipContainer.hidden = false; - + let parent = chipContainer.parentElement; while (parent && parent !== document.body) { parent.style.display = ''; parent.style.visibility = 'visible'; parent = parent.parentElement; } - + const allChips = chipContainer.querySelectorAll('yt-chip-cloud-chip-renderer button'); if (allChips.length > 1) { allChips[1].click(); - setTimeout(function() { + setTimeout(function () { allChips[0].click(); }, 200); } @@ -669,8 +694,10 @@ ImprovedTube.shortcutRefreshCategories = function () { 4.7.33 SMART SPEED TOGGLE ------------------------------------------------------------------------------*/ ImprovedTube.shortcutSmartSpeed = function () { - if (ImprovedTube.storage.smart_speed === false) { if(ImprovedTube.heatmap) {ImprovedTube.heatmap.init(); }; - } else if (ImprovedTube.storage.smart_speed === true) { if(ImprovedTube.heatmap) { ImprovedTube.heatmap.isEnabled = false; document.querySelector("video").playbackRate = 1.0; } - } + if (ImprovedTube.storage.smart_speed === false) { + if (ImprovedTube.heatmap) { ImprovedTube.heatmap.init(); }; + } else if (ImprovedTube.storage.smart_speed === true) { + if (ImprovedTube.heatmap) { ImprovedTube.heatmap.isEnabled = false; document.querySelector("video").playbackRate = 1.0; } + } this.storage.smart_speed = !this.storage.smart_speed; }; \ No newline at end of file diff --git a/manifest.json b/manifest.json index 42057c249..1e0509927 100644 --- a/manifest.json +++ b/manifest.json @@ -16,7 +16,7 @@ "id": "{3c6bf0cc-3ae2-42fb-9993-0d33104fdcaf}" } }, - "background": { + "background": { "service_worker": "background.js" }, "action": { @@ -53,14 +53,26 @@ "js&css/extension/www.youtube.com/appearance/comments/comments.js", "js&css/extension/init.js" ], - "matches": ["https://www.youtube.com/*"], + "matches": [ + "https://www.youtube.com/*" + ], "run_at": "document_start" } ], - "host_permissions": ["https://www.youtube.com/*"], - "optional_host_permissions": ["https://returnyoutubedislikeapi.com/*"], - "optional_permissions": ["downloads"], - "permissions": ["contextMenus", "storage", "unlimitedStorage"], + "host_permissions": [ + "https://www.youtube.com/*" + ], + "optional_host_permissions": [ + "https://returnyoutubedislikeapi.com/*" + ], + "optional_permissions": [ + "downloads" + ], + "permissions": [ + "contextMenus", + "storage", + "unlimitedStorage" + ], "web_accessible_resources": [ { "resources": [ @@ -83,7 +95,9 @@ "js&css/web-accessible/init.js", "menu/icons/48.png" ], - "matches": ["https://www.youtube.com/*"] + "matches": [ + "https://www.youtube.com/*" + ] } ] -} +} \ No newline at end of file diff --git a/menu/skeleton-parts/appearance.js b/menu/skeleton-parts/appearance.js index 4c34d92db..a5d6f9fb6 100644 --- a/menu/skeleton-parts/appearance.js +++ b/menu/skeleton-parts/appearance.js @@ -431,116 +431,116 @@ extension.skeleton.main.layers.section.appearance.on.click.player = { tags: "remove,hide" }, hide_gradient_bottom: { - component: "switch", - text: "hideGradientBottom" + component: "switch", + text: "hideGradientBottom" }, always_show_progress_bar: { - component: "switch", - text: "alwaysShowProgressBar" + component: "switch", + text: "alwaysShowProgressBar" }, player_color: { - component: "select", - text: "playerColor", - options: [{ - text: "default", - value: "default" - }, { - text: "red", - value: "red" - }, { - text: "pink", - value: "pink" - }, { - text: "purple", - value: "purple" - }, { - text: "deepPurple", - value: "deep_purple" - }, { - text: "indigo", - value: "indigo" - }, { - text: "blue", - value: "blue" - }, { - text: "lightBlue", - value: "light_blue" - }, { - text: "cyan", - value: "cyan" - }, { - text: "teal", - value: "teal" - }, { - text: "green", - value: "green" - }, { - text: "lightGreen", - value: "light_green" - }, { - text: "lime", - value: "lime" - }, { - text: "yellow", - value: "yellow" - }, { - text: "amber", - value: "amber" - }, { - text: "orange", - value: "orange" - }, { - text: "deepOrange", - value: "deep_orange" - }, { - text: "brown", - value: "brown" - }, { - text: "blueGray", - value: "blue_gray" - }, { - text: "white", - value: "white" - }], - tags: "style" - }, - player_transparent_background: { - component: "switch", - text: "transparentBackground" - }, - player_hide_skip_overlay: { - component: "switch", - text: "hideSkipOverlay", - value: false, - tags: "remove,hide" - }, - player_hide_pause_overlay: { - component: "switch", - text: "hidePauseOverlay", - value: false, - tags: "remove,hide,pause,bezel" - }, - duration_with_speed: { - component: "switch", - text: "durationWithSpeed", - value: false - }, - player_hd_thumbnail: { - component: "switch", - text: "hdThumbnail", - tags: "preview" - }, - hide_scroll_for_details: { - component: "switch", - text: "hideScrollForDetails", - tags: "remove,hide" + component: "select", + text: "playerColor", + options: [{ + text: "default", + value: "default" + }, { + text: "red", + value: "red" + }, { + text: "pink", + value: "pink" + }, { + text: "purple", + value: "purple" + }, { + text: "deepPurple", + value: "deep_purple" + }, { + text: "indigo", + value: "indigo" + }, { + text: "blue", + value: "blue" + }, { + text: "lightBlue", + value: "light_blue" + }, { + text: "cyan", + value: "cyan" + }, { + text: "teal", + value: "teal" + }, { + text: "green", + value: "green" + }, { + text: "lightGreen", + value: "light_green" + }, { + text: "lime", + value: "lime" + }, { + text: "yellow", + value: "yellow" + }, { + text: "amber", + value: "amber" + }, { + text: "orange", + value: "orange" + }, { + text: "deepOrange", + value: "deep_orange" + }, { + text: "brown", + value: "brown" + }, { + text: "blueGray", + value: "blue_gray" + }, { + text: "white", + value: "white" + }], + tags: "style" + }, + player_transparent_background: { + component: "switch", + text: "transparentBackground" + }, + player_hide_skip_overlay: { + component: "switch", + text: "hideSkipOverlay", + value: false, + tags: "remove,hide" + }, + player_hide_pause_overlay: { + component: "switch", + text: "hidePauseOverlay", + value: false, + tags: "remove,hide,pause,bezel" + }, + duration_with_speed: { + component: "switch", + text: "durationWithSpeed", + value: false + }, + player_hd_thumbnail: { + component: "switch", + text: "hdThumbnail", + tags: "preview" + }, + hide_scroll_for_details: { + component: "switch", + text: "hideScrollForDetails", + tags: "remove,hide" + }, + hide_top_loading_bar: { + component: "switch", + text: "hideTopLoadingBar", + tags: "remove,hide" + } }, - hide_top_loading_bar: { - component: "switch", - text: "hideTopLoadingBar", - tags: "remove,hide" - } - }, section_2: { component: 'section', variant: 'card',