Improved promise calling in button updating function.

This commit is contained in:
Ajay Ramachandran
2019-08-23 21:06:00 -04:00
parent f0e1979aab
commit c1efe02614

View File

@@ -655,9 +655,12 @@ function isSubmitButtonLoaded() {
return document.getElementById("submitButton") !== null;
}
function changeStartSponsorButton(showStartSponsor, uploadButtonVisible) {
async function changeStartSponsorButton(showStartSponsor, uploadButtonVisible) {
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
let shouldHide = (uploadButtonVisible && !hideDeleteButtonPlayerControls) ? "unset" : "none"
document.getElementById("deleteButton").style.display = shouldHide;
@@ -681,7 +684,6 @@ function changeStartSponsorButton(showStartSponsor, uploadButtonVisible) {
//disable submit button
document.getElementById("submitButton").style.display = "none";
}
});
}
function toggleStartSponsorButton() {