mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-02-08 15:16:43 +01:00
Bail out early if submit button isn't present
This commit is contained in:
parent
b24a252cb8
commit
47ba4747b3
1 changed files with 6 additions and 3 deletions
|
@ -231,11 +231,14 @@ function setupImageUpload() {
|
||||||
|
|
||||||
function disableUploadButton() {
|
function disableUploadButton() {
|
||||||
const submitButton = $('.button.input--separate-top');
|
const submitButton = $('.button.input--separate-top');
|
||||||
if (submitButton !== null) {
|
|
||||||
submitButton.disabled = true;
|
if (!submitButton) {
|
||||||
submitButton.innerText = 'Please wait...';
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
submitButton.disabled = true;
|
||||||
|
submitButton.innerText = 'Please wait...';
|
||||||
|
|
||||||
// delay is needed because Safari stops the submit if the button is immediately disabled
|
// delay is needed because Safari stops the submit if the button is immediately disabled
|
||||||
requestAnimationFrame(() => submitButton.setAttribute('disabled', 'disabled'));
|
requestAnimationFrame(() => submitButton.setAttribute('disabled', 'disabled'));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue