X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/700b6dec7e4d655fee91e26f9757442162047281..483162a72bfe820b11db05c384c0fc6103d084cf:/forum/skins/default/templates/question.html diff --git a/forum/skins/default/templates/question.html b/forum/skins/default/templates/question.html index d03af25..6407978 100644 --- a/forum/skins/default/templates/question.html +++ b/forum/skins/default/templates/question.html @@ -30,7 +30,7 @@ } $('#editor').TextAreaResizer(); - + //toggle preview of editor var display = true; var txt = "[{% trans "hide preview" %}]"; @@ -42,6 +42,28 @@ $('#pre-collapse').text(txt); }); }); + + function submitClicked(e) { + if(!(browserTester('chrome') || browserTester('safari'))) { + $("input.submit")[0].disabled=true; + } + window.removeEventListener('beforeunload', beforeUnload, true); + } + + function beforeUnload(e) { + + if($("textarea#editor")[0].value != "") { + return yourWorkWillBeLost(e); + } + + var commentBoxes = $("textarea.commentBox"); + for(var index = 0; index < commentBoxes.length; index++) { + if(commentBoxes[index].value != "") { + return yourWorkWillBeLost(e); + } + } + } + window.addEventListener('beforeunload', beforeUnload, true);