diff --git a/src/assets/javascripts/helpers/youtube/options.js b/src/assets/javascripts/helpers/youtube/options.js index 27bed3f8..d73f95f0 100644 --- a/src/assets/javascripts/helpers/youtube/options.js +++ b/src/assets/javascripts/helpers/youtube/options.js @@ -314,7 +314,7 @@ export async function initOptions() { invidiousVrMode = r.invidiousVrMode ?? true; invidiousSavePlayerPos = r.invidiousSavePlayerPos ?? false; - pipedBufferGoal = r.pipedBufferGoal ?? 10; + pipedBufferGoal = r.pipedBufferGoal ?? 300; pipedComments = r.pipedComments ?? true; pipedDisableLBRY = r.pipedDisableLBRY ?? false; pipedEnabledCodecs = r.pipedEnabledCodecs ?? ["av1", "vp9", "avc"]; diff --git a/src/assets/javascripts/helpers/youtube/piped-preferences.js b/src/assets/javascripts/helpers/youtube/piped-preferences.js index 77f47338..6548a2bb 100644 --- a/src/assets/javascripts/helpers/youtube/piped-preferences.js +++ b/src/assets/javascripts/helpers/youtube/piped-preferences.js @@ -26,7 +26,7 @@ browser.storage.local.get( let youtubeVolume = r.youtubeVolume ?? 100; let youtubeListen = r.youtubeListen ?? false; - let pipedBufferGoal = r.pipedBufferGoal ?? 10; + let pipedBufferGoal = r.pipedBufferGoal ?? 300; let pipedComments = r.pipedComments ?? true; let pipedDisableLBRY = r.pipedDisableLBRY ?? false; let pipedEnabledCodecs = r.pipedEnabledCodecs ?? ["av1", "vp9", "avc"]; @@ -39,7 +39,7 @@ browser.storage.local.get( let pipedSponsorblock = r.pipedSponsorblock ?? true; let pipedWatchHistory = r.pipedWatchHistory ?? false; - localStorage.setItem("bufferGoal", pipedBufferGoal); + localStorage.setItem("bufferGoal", pipedBufferGoal.toString()); localStorage.setItem("comments", pipedComments); localStorage.setItem("disableLBRY", pipedDisableLBRY); localStorage.setItem("enabledCodecs", pipedEnabledCodecs); diff --git a/src/assets/javascripts/helpers/youtube/youtube.js b/src/assets/javascripts/helpers/youtube/youtube.js index 8f1ff3f5..10e8cba5 100644 --- a/src/assets/javascripts/helpers/youtube/youtube.js +++ b/src/assets/javascripts/helpers/youtube/youtube.js @@ -541,7 +541,7 @@ function isPipedorInvidious(url, type, frontend) { } function initPipedLocalStorage(tabId) { - if (enableCustomSettings) + if (!disable && frontend == 'piped' && enableCustomSettings) browser.tabs.executeScript( tabId, { @@ -552,7 +552,7 @@ function initPipedLocalStorage(tabId) { } function initPipedMaterialLocalStorage(tabId) { - if (enableCustomSettings) + if (!disable && frontend == 'pipedMaterial' && enableCustomSettings) browser.tabs.executeScript( tabId, { @@ -563,15 +563,13 @@ function initPipedMaterialLocalStorage(tabId) { } function initInvidiousCookies() { - - let checkedInstances = [ - ...invidiousNormalRedirectsChecks, - ...invidiousNormalCustomRedirects, - ...invidiousTorRedirectsChecks, - ...invidiousTorCustomRedirects, - ]; - - if (enableCustomSettings) + if (!disable && frontend == 'invidious' && enableCustomSettings) { + let checkedInstances = [ + ...invidiousNormalRedirectsChecks, + ...invidiousNormalCustomRedirects, + ...invidiousTorRedirectsChecks, + ...invidiousTorCustomRedirects, + ]; for (const instanceUrl of checkedInstances) browser.cookies.get( { @@ -580,17 +578,17 @@ function initInvidiousCookies() { }, cookie => { let prefs = {}; - if (cookie) { - prefs = JSON.parse(decodeURIComponent(cookie.value)); - browser.cookies.remove({ url: instanceUrl, name: "PREFS" }); - } + // if (cookie) { + // prefs = JSON.parse(decodeURIComponent(cookie.value)); + // browser.cookies.remove({ url: instanceUrl, name: "PREFS" }); + // } - prefs.local = invidiousAlwaysProxy == 'true'; + prefs.local = invidiousAlwaysProxy; prefs.dark_mode = theme; - prefs.video_loop = invidiousVideoLoop == 'true'; - prefs.continue_autoplay = invidiousContinueAutoplay == 'true'; - prefs.continue = invidiousContinue == 'true'; - prefs.listen = youtubeListen == 'true'; + prefs.video_loop = invidiousVideoLoop; + prefs.continue_autoplay = invidiousContinueAutoplay; + prefs.continue = invidiousContinue; + prefs.listen = youtubeListen; prefs.speed = parseFloat(invidiousSpeed); prefs.quality = invidiousQuality; prefs.quality_dash = invidiousQualityDash; @@ -605,15 +603,15 @@ function initInvidiousCookies() { prefs.captions[1] = invidiousCaptions[1]; prefs.captions[2] = invidiousCaptions[2]; - prefs.related_videos = invidiousRelatedVideos == 'true'; - prefs.annotations = invidiousAnnotations == 'true' - prefs.extend_desc = invidiousExtendDesc == 'true'; - prefs.vr_mode = invidiousVrMode == 'true'; - prefs.save_player_pos = invidiousSavePlayerPos == 'true'; + prefs.related_videos = invidiousRelatedVideos; + prefs.annotations = invidiousAnnotations + prefs.extend_desc = invidiousExtendDesc; + prefs.vr_mode = invidiousVrMode; + prefs.save_player_pos = invidiousSavePlayerPos; prefs.volume = parseInt(volume); prefs.player_style = invidiousPlayerStyle; - prefs.youtubeAutoplay = youtubeAutoplay == 'true'; + prefs.autoplay = youtubeAutoplay; browser.cookies.set({ url: instanceUrl, @@ -622,6 +620,7 @@ function initInvidiousCookies() { }) } ) + } } let theme; diff --git a/src/pages/options/youtube/invidious.js b/src/pages/options/youtube/invidious.js index b99a3ab3..9df34067 100644 --- a/src/pages/options/youtube/invidious.js +++ b/src/pages/options/youtube/invidious.js @@ -115,25 +115,31 @@ invidiousSavePlayerPosElement.addEventListener("change", ); youtubeHelper.init().then(() => { + invidiousVideoLoopElement.checked = youtubeHelper.getInvidiousVideoLoop(); + invidiousPlayerStyleElement.value = youtubeHelper.getInvidiousPlayerStyle(); - invidiousAlwaysProxyElement.value = youtubeHelper.getInvidiousAlwaysProxy(); - invidiousVideoLoopElement.value = youtubeHelper.getInvidiousVideoLoop(); - invidiousContinueAutoplayElement.value = youtubeHelper.getInvidiousContinueAutoplay(); - invidiousContinueElement.value = youtubeHelper.getInvidiousContinue(); - youtubeListenElement.value = youtubeHelper.getYoutubeListen(); + + invidiousContinueAutoplayElement.checked = youtubeHelper.getInvidiousContinueAutoplay(); + invidiousContinueElement.checked = youtubeHelper.getInvidiousContinue(); + invidiousAlwaysProxyElement.checked = youtubeHelper.getInvidiousAlwaysProxy(); + youtubeListenElement.checked = youtubeHelper.getYoutubeListen(); + invidiousSpeedElement.value = youtubeHelper.getInvidiousSpeed(); invidiousQualityElement.value = youtubeHelper.getInvidiousQuality(); invidiousQualityDashElement.value = youtubeHelper.getInvidiousQualityDash(); + invidiousComments0Element.value = youtubeHelper.getInvidiousComments()[0]; invidiousComments1Element.value = youtubeHelper.getInvidiousComments()[1]; + invidiousCaptions0Element.value = youtubeHelper.getInvidiousCaptions()[0]; invidiousCaptions1Element.value = youtubeHelper.getInvidiousCaptions()[1]; invidiousCaptions2Element.value = youtubeHelper.getInvidiousCaptions()[2]; - invidiousRelatedVideoElement.value = youtubeHelper.getInvidiousRelatedVideos(); - invidiousAnnotationsElement.value = youtubeHelper.getInvidiousAnnotations(); - invidiousExtendDescElement.value = youtubeHelper.getInvidiousExtendDesc(); - invidiousVrModeElement.value = youtubeHelper.getInvidiousVrMode(); - invidiousSavePlayerPosElement.value = youtubeHelper.getInvidiousSavePlayerPos(); + + invidiousRelatedVideoElement.checked = youtubeHelper.getInvidiousRelatedVideos(); + invidiousAnnotationsElement.checked = youtubeHelper.getInvidiousAnnotations(); + invidiousExtendDescElement.checked = youtubeHelper.getInvidiousExtendDesc(); + invidiousVrModeElement.checked = youtubeHelper.getInvidiousVrMode(); + invidiousSavePlayerPosElement.checked = youtubeHelper.getInvidiousSavePlayerPos(); commonHelper.processDefaultCustomInstances( 'invidious', diff --git a/src/pages/options/youtube/piped.js b/src/pages/options/youtube/piped.js index 015c97d8..876106e2 100644 --- a/src/pages/options/youtube/piped.js +++ b/src/pages/options/youtube/piped.js @@ -17,9 +17,9 @@ function selectSkipModify(value, boolean) { youtubeHelper.setPipedSelectedSkip(selectSkip) } -let pipedSelectedSkipSponsorElement = document.getElementById("piped-selectedSkip-sponsors"); +let pipedSelectedSkipSponsorElement = document.getElementById("piped-selectedSkip-sponsor"); pipedSelectedSkipSponsorElement.addEventListener("change", - event => selectSkipModify('sponsors', event.target.checked) + event => selectSkipModify('sponsor', event.target.checked) ); let pipedSelectedSkipIntroElement = document.getElementById("piped-selectedSkip-intro"); @@ -148,9 +148,9 @@ pipedMaterialSkipToLastPointElement.addEventListener("change", ); -let pipedMaterialSelectedSkipSponsorElement = document.getElementById("pipedMaterial-selectedSkip-sponsors"); +let pipedMaterialSelectedSkipSponsorElement = document.getElementById("pipedMaterial-selectedSkip-sponsor"); pipedMaterialSelectedSkipSponsorElement.addEventListener("change", - event => selectSkipModify('sponsors', event.target.checked) + event => selectSkipModify('sponsor', event.target.checked) ); let pipedMaterialSelectedSkipIntroElement = document.getElementById("pipedMaterial-selectedSkip-intro"); @@ -198,7 +198,9 @@ youtubeHelper.init().then(() => { pipedSponsorblockElement.checked = youtubeHelper.getPipedSponsorblock(); selectSkip = youtubeHelper.getPipedSelectedSkip(); - pipedSelectedSkipSponsorElement.checked = selectSkip.includes('sponsors'); + console.log("selectSkip", selectSkip) + pipedSelectedSkipSponsorElement.checked = selectSkip.includes('sponsor'); + console.log("selectSkip.includes('sponsor')", selectSkip.includes('sponsor')) pipedSelectedSkipIntroElement.checked = selectSkip.includes('intro'); pipedSelectedSkipOutroElement.checked = selectSkip.includes('outro'); pipedSelectedSkipPreviewElement.checked = selectSkip.includes('preview'); @@ -224,7 +226,7 @@ youtubeHelper.init().then(() => { pipedMaterialProxyLBRYElement.checked = youtubeHelper.getPipedProxyLBRY(); pipedMaterialSponsorblockElement.checked = youtubeHelper.getPipedSponsorblock() pipedMaterialSkipToLastPointElement.checked = youtubeHelper.getPipedMaterialSkipToLastPoint(); - pipedMaterialSelectedSkipSponsorElement.checked = selectSkip.includes('sponsors'); + pipedMaterialSelectedSkipSponsorElement.checked = selectSkip.includes('sponsor'); pipedMaterialSelectedSkipIntroElement.checked = selectSkip.includes('intro'); pipedMaterialSelectedSkipOutroElement.checked = selectSkip.includes('outro'); pipedMaterialSelectedSkipPreviewElement.checked = selectSkip.includes('preview'); diff --git a/src/pages/options/youtube/youtube.html b/src/pages/options/youtube/youtube.html index af7e8d3d..d36e8ba1 100644 --- a/src/pages/options/youtube/youtube.html +++ b/src/pages/options/youtube/youtube.html @@ -207,13 +207,13 @@