Skip to content

Commit

Permalink
update sponsorblock skip config while player is opened
Browse files Browse the repository at this point in the history
  • Loading branch information
alyyousuf7 committed Dec 31, 2023
1 parent bf9b012 commit d147ce0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
8 changes: 8 additions & 0 deletions src/sponsorblock.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

0 comments on commit d147ce0

Please sign in to comment.