X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/d7a18910f5d471a3fa37f3a1cf202fa5302ac25f..3b5cf11889534f64588a9dabc008e745d2c67c3a:/forum/skins/default/templates/answer_edit.html diff --git a/forum/skins/default/templates/answer_edit.html b/forum/skins/default/templates/answer_edit.html index 137b684..4265a3e 100644 --- a/forum/skins/default/templates/answer_edit.html +++ b/forum/skins/default/templates/answer_edit.html @@ -12,7 +12,8 @@ $().ready(function(){ $("#nav_questions").attr('className',"on"); $('#editor').TextAreaResizer(); - + + //toggle preview of editor var display = true; var txt = "{% trans "hide preview" %}"; @@ -24,13 +25,32 @@ $('#pre-collapse').text(txt); }); - + $('#id_revision').unbind().change(function(){ $("#select_revision").click(); }); - - + + + answer = $("textarea#editor")[0].value; }); + + + function submitClicked(e) { + if(!(browserTester('chrome') || browserTester('safari'))) { + $("input.submit")[0].disabled=true; + $("input.submit")[1].disabled=true; + } + window.removeEventListener('beforeunload', beforeUnload, true); + } + + function beforeUnload(e) { + if($("textarea#editor")[0].value != answer) { + return yourWorkWillBeLost(e); + } + } + window.addEventListener('beforeunload', beforeUnload, true); + + var answer = ""; {% endblock %} @@ -66,8 +86,8 @@