mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-11 14:07:13 +03:00
Improved promise calling in button updating function.
This commit is contained in:
14
content.js
14
content.js
@@ -655,12 +655,15 @@ function isSubmitButtonLoaded() {
|
|||||||
return document.getElementById("submitButton") !== null;
|
return document.getElementById("submitButton") !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeStartSponsorButton(showStartSponsor, uploadButtonVisible) {
|
async function changeStartSponsorButton(showStartSponsor, uploadButtonVisible) {
|
||||||
if(!sponsorVideoID) return false;
|
if(!sponsorVideoID) return false;
|
||||||
wait(isSubmitButtonLoaded).then(result => {
|
|
||||||
|
//make sure submit button is loaded
|
||||||
|
await wait(isSubmitButtonLoaded);
|
||||||
|
|
||||||
//if it isn't visible, there is no data
|
//if it isn't visible, there is no data
|
||||||
let shouldHide = (uploadButtonVisible && !hideDeleteButtonPlayerControls) ? "unset":"none"
|
let shouldHide = (uploadButtonVisible && !hideDeleteButtonPlayerControls) ? "unset" : "none"
|
||||||
document.getElementById("deleteButton").style.display = shouldHide;
|
document.getElementById("deleteButton").style.display = shouldHide;
|
||||||
|
|
||||||
if (showStartSponsor) {
|
if (showStartSponsor) {
|
||||||
showingStartSponsor = true;
|
showingStartSponsor = true;
|
||||||
@@ -681,7 +684,6 @@ function changeStartSponsorButton(showStartSponsor, uploadButtonVisible) {
|
|||||||
//disable submit button
|
//disable submit button
|
||||||
document.getElementById("submitButton").style.display = "none";
|
document.getElementById("submitButton").style.display = "none";
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleStartSponsorButton() {
|
function toggleStartSponsorButton() {
|
||||||
|
|||||||
Reference in New Issue
Block a user