diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2018-02-12 12:47:37 +0100 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2018-02-12 12:48:03 +0100 |
commit | 3e3a12ffdf285a48cd6cbbef65094750401caf2f (patch) | |
tree | 46822a725b64aa151e2d532e647d2ce9462bfcc2 | |
parent | 1985d6ea80408f2f9e371ddeb9531501e9693cc5 (diff) |
zelfoverhoor: Onbeforeunload message in docent interface
-rw-r--r-- | modules/zelfoverhoor/docent.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/zelfoverhoor/docent.js b/modules/zelfoverhoor/docent.js index 388c7f7..c14fb2e 100644 --- a/modules/zelfoverhoor/docent.js +++ b/modules/zelfoverhoor/docent.js @@ -5,8 +5,18 @@ window.addEventListener("error",function(err){ xhr.send(str); }); +window.onbeforeunload=function(ev){ + if(editorIsOpen){ + var text="Je bent momenteel een vragenset aan het bewerken; weet je zeker dat je het window wilt sluiten?"; + ev.returnValue=text; + return text; + } + return undefined; +}; + var questionsets=null; var currentlyEditing=null; +var editorIsOpen=false; function getQuestionSets(){ var xhr=new XMLHttpRequest(); @@ -107,6 +117,7 @@ function openBlankSetEditor(){ document.getElementById("newqsetform").classList.remove("invisible"); document.getElementById("newqsetvisible").classList.add("invisible"); currentlyEditing=null; + editorIsOpen=true; } function doNewQSet(){ @@ -157,6 +168,7 @@ function closeQSetForm(){ document.getElementById("newqsetform").classList.add("invisible"); document.getElementById("newqsetvisible").classList.remove("invisible"); currentlyEditing=null; + editorIsOpen=false; } function renumberQuestions(){ |