summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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(){