Added a button to disable skipping. Also changed up popup look.

Resolves https://github.com/ajayyy/SponsorBlock/issues/167
This commit is contained in:
Ajay Ramachandran
2019-11-24 00:05:35 -05:00
parent a66c7c8063
commit 9cb3da4a7f
5 changed files with 77 additions and 15 deletions

View File

@@ -67,6 +67,15 @@ var sponsorTimesSubmitting = [];
//this is used to close the popup on YouTube when the other popup opens
var popupInitialised = false;
//should skips happen at all
var disableSkipping = false;
chrome.storage.sync.get(["disableSkipping"], function(result) {
let disableSkippingStorage = result.disableSkipping;
if (disableSkippingStorage != undefined) {
disableSkipping = disableSkippingStorage;
}
});
//should view counts be tracked
var trackViewCount = false;
chrome.storage.sync.get(["trackViewCount"], function(result) {
@@ -439,9 +448,11 @@ function sponsorsLookup(id, channelIDPromise) {
});
//add the event to run on the videos "ontimeupdate"
v.ontimeupdate = function () {
sponsorCheck();
};
if (!disableSkipping) {
v.ontimeupdate = function () {
sponsorCheck();
};
}
}
function updatePreviewBar() {
@@ -531,6 +542,12 @@ function whitelistCheck() {
//video skipping
function sponsorCheck() {
if (disableSkipping) {
// Make sure this isn't called again
v.ontimeupdate = null;
return;
}
let skipHappened = false;
if (sponsorTimes != null) {