Unsubmitted sponsors are now in the preview.

This commit is contained in:
Ajay Ramachandran
2019-08-21 14:27:25 -04:00
parent c1aebf45c8
commit 32884372fa
2 changed files with 22 additions and 1 deletions

View File

@@ -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);
} }

View File

@@ -13,6 +13,10 @@ let barTypes = {
"sponsor": { "sponsor": {
color: "#00d400", color: "#00d400",
opacity: "0.5" opacity: "0.5"
},
"previewSponsor": {
color: "#0000d4",
opacity: "0.5"
} }
}; };