summaryrefslogtreecommitdiff
path: root/modules/zelfoverhoor
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2018-02-12 12:47:37 +0100
committerTom Smeding <tom.smeding@gmail.com>2018-02-12 12:48:03 +0100
commit3e3a12ffdf285a48cd6cbbef65094750401caf2f (patch)
tree46822a725b64aa151e2d532e647d2ce9462bfcc2 /modules/zelfoverhoor
parent1985d6ea80408f2f9e371ddeb9531501e9693cc5 (diff)
zelfoverhoor: Onbeforeunload message in docent interface
Diffstat (limited to 'modules/zelfoverhoor')
-rw-r--r--modules/zelfoverhoor/docent.js12
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(){