This commit is contained in:
Official Noob
2020-01-01 19:10:34 +00:00
committed by GitHub
parent 1005783034
commit a3f5200c9a

View File

@@ -238,8 +238,7 @@ function videoIDChange(id) {
//warn them if they had unsubmitted times //warn them if they had unsubmitted times
if (previousVideoID != null) { if (previousVideoID != null) {
//get the sponsor times from storage //get the sponsor times from storage
let sponsorTimeKey = 'sponsorTimes' + previousVideoID; let sponsorTimes = SB.config.sponsorTimes.get(previousVideoID);
let sponsorTimes = SB.config.sponsorTimeKey[sponsorTimeKey];
if (sponsorTimes != undefined && sponsorTimes.length > 0) { if (sponsorTimes != undefined && sponsorTimes.length > 0) {
//warn them that they have unsubmitted sponsor times //warn them that they have unsubmitted sponsor times
chrome.runtime.sendMessage({ chrome.runtime.sendMessage({
@@ -803,8 +802,7 @@ function clearSponsorTimes() {
let currentVideoID = sponsorVideoID; let currentVideoID = sponsorVideoID;
let sponsorTimeKey = 'sponsorTimes' + currentVideoID; let sponsorTimes = SB.config.sponsorTimes.get(currentVideoID);
let sponsorTimes = SB.config.sponsorTimeKey[sponsorTimeKey];
if (sponsorTimes != undefined && sponsorTimes.length > 0) { if (sponsorTimes != undefined && sponsorTimes.length > 0) {
let confirmMessage = chrome.i18n.getMessage("clearThis") + getSponsorTimesMessage(sponsorTimes); let confirmMessage = chrome.i18n.getMessage("clearThis") + getSponsorTimesMessage(sponsorTimes);
@@ -812,8 +810,7 @@ function clearSponsorTimes() {
if(!confirm(confirmMessage)) return; if(!confirm(confirmMessage)) return;
//clear the sponsor times //clear the sponsor times
let sponsorTimeKey = "sponsorTimes" + currentVideoID; SB.config.sponsorTimes.delete(currentVideoID);
delete SB.config.sponsorTimeKey[sponsorTimeKey]
//clear sponsor times submitting //clear sponsor times submitting
sponsorTimesSubmitting = []; sponsorTimesSubmitting = [];
@@ -914,8 +911,7 @@ function submitSponsorTimes() {
let currentVideoID = sponsorVideoID; let currentVideoID = sponsorVideoID;
let sponsorTimeKey = 'sponsorTimes' + currentVideoID; let sponsorTimes = SB.config.sponsorTimes.get(currentVideoID);
let sponsorTimes = SB.config.sponsorTimeKey[sponsorTimeKey];
if (sponsorTimes != undefined && sponsorTimes.length > 0) { if (sponsorTimes != undefined && sponsorTimes.length > 0) {
//check if a sponsor exceeds the duration of the video //check if a sponsor exceeds the duration of the video
@@ -925,7 +921,7 @@ function submitSponsorTimes() {
} }
} }
//update sponsorTimes //update sponsorTimes
SB.config.sponsorTimeKey[sponsorTimeKey] = sponsorTimes; SB.config.sponsorTimes.set(currentVideoID, sponsorTimes);
//update sponsorTimesSubmitting //update sponsorTimesSubmitting
sponsorTimesSubmitting = sponsorTimes; sponsorTimesSubmitting = sponsorTimes;
@@ -970,8 +966,7 @@ function sendSubmitMessage(){
submitButton.addEventListener("animationend", animationEndListener); submitButton.addEventListener("animationend", animationEndListener);
//clear the sponsor times //clear the sponsor times
let sponsorTimeKey = "sponsorTimes" + currentVideoID; SB.config.sponsorTimes.delete(currentVideoID);
delete SB.config.sponsorTimeKey[sponsorTimeKey];
//add submissions to current sponsors list //add submissions to current sponsors list
sponsorTimes = sponsorTimes.concat(sponsorTimesSubmitting); sponsorTimes = sponsorTimes.concat(sponsorTimesSubmitting);