Fixed prompt showing up when submitting.
This commit is contained in:
parent
6d543f4b2b
commit
6bbe9bf441
3 changed files with 7 additions and 2 deletions
|
@ -1,5 +1,7 @@
|
|||
/// <reference path="../Parser.ts" />
|
||||
|
||||
let forumPostingCloseOK: boolean = false;
|
||||
|
||||
function forumPostingInit(): void
|
||||
{
|
||||
const postingForm: HTMLDivElement = document.querySelector('.js-forum-posting');
|
||||
|
@ -18,7 +20,7 @@ function forumPostingInit(): void
|
|||
markupButtons = document.querySelectorAll('.forum__post__action--tag');
|
||||
|
||||
window.addEventListener("beforeunload", (e) => {
|
||||
if (postingText.value.length > 0) {
|
||||
if (!forumPostingCloseOK && postingText.value.length > 0) {
|
||||
const message: string = 'Are you sure you want to close the tab?';
|
||||
e.returnValue = message;
|
||||
return message;
|
||||
|
|
|
@ -98,6 +98,9 @@ window.addEventListener('load', () => {
|
|||
ctrlSubmit[i].addEventListener('keydown', ev => {
|
||||
if (ev.code === 'Enter' /* i hate this fucking language so much */
|
||||
&& ev.ctrlKey && !ev.altKey && !ev.shiftKey && !ev.metaKey) {
|
||||
// for a hackjob
|
||||
forumPostingCloseOK = true;
|
||||
|
||||
ctrlSubmit[i].form.submit();
|
||||
ev.preventDefault();
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@
|
|||
</div>
|
||||
|
||||
<div class="forum__post__buttons js-forum-posting-buttons">
|
||||
<button class="input__button">Submit</button>
|
||||
<button class="input__button" onclick="forumPostingCloseOK = true;">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue