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
if (sponsorTimes != undefined && sponsorTimes.length > 0) {
sponsorTimesSubmitting = sponsorTimes;
updatePreviewBar();
}
}
});
@@ -377,7 +379,18 @@ function sponsorsLookup(id) {
}
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
lastPreviewBarUpdate = getYouTubeVideoID(document.URL);
@@ -609,6 +622,8 @@ function updateSponsorTimesSubmitting() {
//see if this data should be saved in the sponsorTimesSubmitting variable
if (sponsorTimes != undefined) {
sponsorTimesSubmitting = sponsorTimes;
updatePreviewBar();
}
}
});
@@ -835,6 +850,8 @@ function clearSponsorTimes() {
//clear sponsor times submitting
sponsorTimesSubmitting = [];
updatePreviewBar();
//set buttons to be correct
changeStartSponsorButton(true, false);
}