mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-31 11:56:40 +03:00
Made the sponsorships starts button update with the clear times button.
This commit is contained in:
27
popup.js
27
popup.js
@@ -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. " +
|
||||
|
||||
Reference in New Issue
Block a user