mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-07 12:07:11 +03:00
Added a button to disable skipping. Also changed up popup look.
Resolves https://github.com/ajayyy/SponsorBlock/issues/167
This commit is contained in:
37
popup.js
37
popup.js
@@ -26,8 +26,12 @@ function runThePopup() {
|
||||
var SB = {};
|
||||
|
||||
["sponsorStart",
|
||||
// Top toggles
|
||||
"whitelistChannel",
|
||||
"unwhitelistChannel",
|
||||
"disableSkipping",
|
||||
"enableSkipping",
|
||||
// More controls
|
||||
"clearTimes",
|
||||
"submitTimes",
|
||||
"showNoticeAgain",
|
||||
@@ -80,6 +84,8 @@ function runThePopup() {
|
||||
SB.sponsorStart.addEventListener("click", sendSponsorStartMessage);
|
||||
SB.whitelistChannel.addEventListener("click", whitelistChannel);
|
||||
SB.unwhitelistChannel.addEventListener("click", unwhitelistChannel);
|
||||
SB.disableSkipping.addEventListener("click", () => toggleSkipping(true));
|
||||
SB.enableSkipping.addEventListener("click", () => toggleSkipping(false));
|
||||
SB.clearTimes.addEventListener("click", clearTimes);
|
||||
SB.submitTimes.addEventListener("click", submitTimes);
|
||||
SB.showNoticeAgain.addEventListener("click", showNoticeAgain);
|
||||
@@ -134,7 +140,16 @@ function runThePopup() {
|
||||
}
|
||||
});
|
||||
|
||||
//if the don't show notice again letiable is true, an option to
|
||||
//show proper disable skipping button
|
||||
chrome.storage.sync.get(["disableSkipping"], function(result) {
|
||||
let disableSkipping = result.disableSkipping;
|
||||
if (disableSkipping != undefined && disableSkipping) {
|
||||
SB.disableSkipping.style.display = "none";
|
||||
SB.enableSkipping.style.display = "unset";
|
||||
}
|
||||
});
|
||||
|
||||
//if the don't show notice again variable is true, an option to
|
||||
// disable should be available
|
||||
chrome.storage.sync.get(["dontShowNotice"], function(result) {
|
||||
let dontShowNotice = result.dontShowNotice;
|
||||
@@ -280,7 +295,7 @@ function runThePopup() {
|
||||
|
||||
//remove loading text
|
||||
SB.mainControls.style.display = "unset"
|
||||
SB.loadingIndicator.innerHTML = "";
|
||||
SB.loadingIndicator.style.display = "none";
|
||||
|
||||
if (request.found) {
|
||||
SB.videoFound.innerHTML = chrome.i18n.getMessage("sponsorFound");
|
||||
@@ -1251,6 +1266,24 @@ function runThePopup() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Should skipping be disabled (visuals stay)
|
||||
*/
|
||||
function toggleSkipping(disabled) {
|
||||
chrome.storage.sync.set({"disableSkipping": disabled});
|
||||
|
||||
let hiddenButton = SB.disableSkipping;
|
||||
let shownButton = SB.enableSkipping;
|
||||
|
||||
if (!disabled) {
|
||||
hiddenButton = SB.enableSkipping;
|
||||
shownButton = SB.disableSkipping;
|
||||
}
|
||||
|
||||
shownButton.style.display = "unset";
|
||||
hiddenButton.style.display = "none";
|
||||
}
|
||||
|
||||
function setKeybind(startSponsorKeybind) {
|
||||
document.getElementById("keybindButtons").style.display = "none";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user