mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-10 21:47:06 +03:00
Unsubmitted sponsors are now in the preview.
This commit is contained in:
19
content.js
19
content.js
@@ -282,6 +282,8 @@ function videoIDChange(id) {
|
|||||||
//see if this data should be saved in the sponsorTimesSubmitting variable
|
//see if this data should be saved in the sponsorTimesSubmitting variable
|
||||||
if (sponsorTimes != undefined && sponsorTimes.length > 0) {
|
if (sponsorTimes != undefined && sponsorTimes.length > 0) {
|
||||||
sponsorTimesSubmitting = sponsorTimes;
|
sponsorTimesSubmitting = sponsorTimes;
|
||||||
|
|
||||||
|
updatePreviewBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -377,7 +379,18 @@ function sponsorsLookup(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updatePreviewBar() {
|
function updatePreviewBar() {
|
||||||
previewBar.set(sponsorTimes, [], v.duration);
|
let allSponsorTimes = sponsorTimes.concat(sponsorTimesSubmitting);
|
||||||
|
|
||||||
|
//create an array of the sponsor types
|
||||||
|
let types = [];
|
||||||
|
for (let i = 0; i < sponsorTimes.length; i++) {
|
||||||
|
types.push("sponsor");
|
||||||
|
}
|
||||||
|
for (let i = 0; i < sponsorTimesSubmitting.length; i++) {
|
||||||
|
types.push("previewSponsor");
|
||||||
|
}
|
||||||
|
|
||||||
|
previewBar.set(allSponsorTimes, types, v.duration);
|
||||||
|
|
||||||
//update last video id
|
//update last video id
|
||||||
lastPreviewBarUpdate = getYouTubeVideoID(document.URL);
|
lastPreviewBarUpdate = getYouTubeVideoID(document.URL);
|
||||||
@@ -609,6 +622,8 @@ function updateSponsorTimesSubmitting() {
|
|||||||
//see if this data should be saved in the sponsorTimesSubmitting variable
|
//see if this data should be saved in the sponsorTimesSubmitting variable
|
||||||
if (sponsorTimes != undefined) {
|
if (sponsorTimes != undefined) {
|
||||||
sponsorTimesSubmitting = sponsorTimes;
|
sponsorTimesSubmitting = sponsorTimes;
|
||||||
|
|
||||||
|
updatePreviewBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -835,6 +850,8 @@ function clearSponsorTimes() {
|
|||||||
//clear sponsor times submitting
|
//clear sponsor times submitting
|
||||||
sponsorTimesSubmitting = [];
|
sponsorTimesSubmitting = [];
|
||||||
|
|
||||||
|
updatePreviewBar();
|
||||||
|
|
||||||
//set buttons to be correct
|
//set buttons to be correct
|
||||||
changeStartSponsorButton(true, false);
|
changeStartSponsorButton(true, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ let barTypes = {
|
|||||||
"sponsor": {
|
"sponsor": {
|
||||||
color: "#00d400",
|
color: "#00d400",
|
||||||
opacity: "0.5"
|
opacity: "0.5"
|
||||||
|
},
|
||||||
|
"previewSponsor": {
|
||||||
|
color: "#0000d4",
|
||||||
|
opacity: "0.5"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user