Made the sponsorships starts button update with the clear times button.

This commit is contained in:
Ajay Ramachandran
2019-07-10 12:23:49 -04:00
parent 2e6a616806
commit 9b13336037

View File

@@ -129,14 +129,7 @@ chrome.runtime.onMessage.addListener(function (request, sender, callback) {
let sponsorTimeKey = "sponsorTimes" + currentVideoID;
chrome.storage.local.set({[sponsorTimeKey]: sponsorTimes});
//update startTimeChosen variable
if (!startTimeChosen) {
startTimeChosen = true;
document.getElementById("sponsorStart").innerHTML = "Sponsorship Ends Now";
} else {
startTimeChosen = false;
document.getElementById("sponsorStart").innerHTML = "Sponsorship Starts Now";
}
updateStartTimeChosen();
//display video times on screen
displaySponsorTimes();
@@ -192,6 +185,8 @@ function clearTimes() {
//hide submission section
document.getElementById("submissionSection").style.display = "none";
resetStartTimeChosen();
}
function submitTimes() {
@@ -220,6 +215,22 @@ function showNoticeAgain() {
document.getElementById("showNoticeAgain").style.display = "none";
}
function updateStartTimeChosen() {
//update startTimeChosen variable
if (!startTimeChosen) {
startTimeChosen = true;
document.getElementById("sponsorStart").innerHTML = "Sponsorship Ends Now";
} else {
resetStartTimeChosen();
}
}
//set it to false
function resetStartTimeChosen() {
startTimeChosen = false;
document.getElementById("sponsorStart").innerHTML = "Sponsorship Starts Now";
}
//this is not a YouTube video page
function displayNoVideo() {
document.getElementById("loadingIndicator").innerHTML = "This probably isn't a YouTube tab, or you clicked too early. " +