From d147ce0e7009f3282433f0e7caa22fafd3b74b31 Mon Sep 17 00:00:00 2001 From: Ali Yousuf Date: Wed, 25 Oct 2023 02:04:27 -0400 Subject: [PATCH] update sponsorblock skip config while player is opened --- src/config.js | 3 +++ src/sponsorblock.js | 8 ++++++++ src/ui.js | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/config.js b/src/config.js index a93ffe28..51cc9d39 100644 --- a/src/config.js +++ b/src/config.js @@ -37,4 +37,7 @@ export function configWrite(key, value) { console.info('Setting key', key, 'to', value); localConfig[key] = value; window.localStorage[CONFIG_KEY] = JSON.stringify(localConfig); + if (window.sponsorblock) { + window.sponsorblock.updateSkippableCategories(); + } } diff --git a/src/sponsorblock.js b/src/sponsorblock.js index 0b8500d2..a83303a6 100644 --- a/src/sponsorblock.js +++ b/src/sponsorblock.js @@ -91,8 +91,16 @@ class SponsorBlockHandler { this.buildOverlay(); } + updateSkippableCategories() { + this.skippableCategories = this.getSkippableCategories(); + } + getSkippableCategories() { const skippableCategories = []; + if (!configRead('enableSponsorBlock')) { + return skippableCategories; + } + if (configRead('enableSponsorBlockSponsor')) { skippableCategories.push('sponsor'); } diff --git a/src/ui.js b/src/ui.js index 4bce127e..754a2696 100644 --- a/src/ui.js +++ b/src/ui.js @@ -191,5 +191,5 @@ export function showNotification(text, time = 3000) { } setTimeout(() => { - showNotification('Press [GREEN] to open YTAF configuration screen'); + showNotification('Press 🟩 to open YTAF configuration screen'); }, 2000);