X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/9b59b6bb395208c913ce5ce19212dd5341cfa98a..8c29337f201187a1d8aa0110c9faf36b5d4f9219:/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 66712ac..c9d8466 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,20 +25,35 @@ $('#pre-collapse').text(txt); }); - + $('#id_revision').unbind().change(function(){ $("#select_revision").click(); }); + + + answer = $("textarea#editor")[0].value; }); - function beforeUnload(e) { - if($("textarea#editor")[0].value != "") { - yourWorkWillBeLost(e); + + function submitClicked(e, f) { + if(!(browserTester('chrome') || browserTester('safari'))) { + $("input.submit")[0].disabled=true; + $("input.submit")[1].disabled=true; + } + window.removeEventListener('beforeunload', beforeUnload, true); + if (f) { + f.submit(); } + } - return false; + function beforeUnload(e) { + if($("textarea#editor")[0].value != answer) { + return yourWorkWillBeLost(e); + } } window.addEventListener('beforeunload', beforeUnload, true); + + var answer = ""; {% endblock %} @@ -59,6 +75,7 @@