From d3e1602c29150ba79f2475d53fe619ce5a6725c6 Mon Sep 17 00:00:00 2001 From: Imamuzzaki Abu Salam Date: Mon, 30 Dec 2024 21:59:45 +0700 Subject: [PATCH] feat: add specific playback speed option and update localization strings --- _locales/en/messages.json | 15 +++++++++------ js&css/web-accessible/core.js | 1 + menu/skeleton-parts/player.js | 9 +++++++++ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 5ff508832..36951cf15 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1,22 +1,22 @@ -{ +{ "qualityWhenRunningOnBattery":{ "message": "Quality, when running on battery" }, "pauseWhileIUnplugTheCharger":{ - "message": "Pause when I unplug the charger" + "message": "Pause when I unplug the charger" }, "whenBatteryIslowDecreaseQuality":{ "message": "Low battery: Decrease the quality" }, "analytics": { "message": "Analytics" - }, + }, "purchase": { "message": "Purchase" - }, + }, "join": { "message": "Join" - }, + }, "improvedTubeSidePanel": { "message": "ImprovedTube: Browser Sidepanel" }, @@ -28,7 +28,7 @@ }, "popupAd": { "message": "Pop-up ad: Hide" - }, + }, "hideWatchedVideos": { "message": "Hide watched videos" }, @@ -962,6 +962,9 @@ "playbackSpeed": { "message": "Playback speed" }, + "specificPlaybackSpeed": { + "message": "Enable specific playback speed for playlists" + }, "player": { "message": "Player" }, diff --git a/js&css/web-accessible/core.js b/js&css/web-accessible/core.js index 36eb49f8a..b5ed2374a 100644 --- a/js&css/web-accessible/core.js +++ b/js&css/web-accessible/core.js @@ -233,6 +233,7 @@ document.addEventListener('it-message-from-extension', function () { case 'playerPlaybackSpeed': case 'playerForcedPlaybackSpeed': + case '': if (ImprovedTube.storage.player_forced_playback_speed === true && isFinite(Number(ImprovedTube.storage.player_playback_speed))) { ImprovedTube.playbackSpeed (Number(ImprovedTube.storage.player_playback_speed)); //new ImprovedTube.elements.player.setPlaybackRate(Number(ImprovedTube.storage.player_playback_speed)); diff --git a/menu/skeleton-parts/player.js b/menu/skeleton-parts/player.js index 5eac79849..e01660ef0 100644 --- a/menu/skeleton-parts/player.js +++ b/menu/skeleton-parts/player.js @@ -180,6 +180,15 @@ extension.skeleton.main.layers.section.player.on.click = { max: 3.17, step: .01 }, + player_specific_playback_speed: { + component: 'slider', + text: 'specificPlaybackSpeed', + textarea: true, + value: 1, + min: .01, + max: 3.17, + step: .01 + }, autofullscreen: { component: 'switch', text: 'autoFullscreen',