aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay Ramachandran <[email protected]>2019-08-23 21:06:00 -0400
committerAjay Ramachandran <[email protected]>2019-08-23 21:06:00 -0400
commitc1efe02614257bbac64a174ffac655f7467599cf (patch)
tree7e78d5d50c1ee4995b8120478f6d88c88c77001f
parentf0e1979aabd0de673228030469e6004557074fbc (diff)
downloadSponsorBlock-c1efe02614257bbac64a174ffac655f7467599cf.tar.gz
SponsorBlock-c1efe02614257bbac64a174ffac655f7467599cf.zip
Improved promise calling in button updating function.
-rw-r--r--content.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/content.js b/content.js
index 0951ab29..1d1c6c3b 100644
--- a/content.js
+++ b/content.js
@@ -655,12 +655,15 @@ function isSubmitButtonLoaded() {
return document.getElementById("submitButton") !== null;
}
-function changeStartSponsorButton(showStartSponsor, uploadButtonVisible) {
- if(!sponsorVideoID) return false;
- wait(isSubmitButtonLoaded).then(result => {
+async function changeStartSponsorButton(showStartSponsor, uploadButtonVisible) {
+ if(!sponsorVideoID) return false;
+
+ //make sure submit button is loaded
+ await wait(isSubmitButtonLoaded);
+
//if it isn't visible, there is no data
- let shouldHide = (uploadButtonVisible && !hideDeleteButtonPlayerControls) ? "unset":"none"
- document.getElementById("deleteButton").style.display = shouldHide;
+ let shouldHide = (uploadButtonVisible && !hideDeleteButtonPlayerControls) ? "unset" : "none"
+ document.getElementById("deleteButton").style.display = shouldHide;
if (showStartSponsor) {
showingStartSponsor = true;
@@ -681,7 +684,6 @@ function changeStartSponsorButton(showStartSponsor, uploadButtonVisible) {
//disable submit button
document.getElementById("submitButton").style.display = "none";
}
- });
}
function toggleStartSponsorButton() {