X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/d7a18910f5d471a3fa37f3a1cf202fa5302ac25f..cb4f846ea59604ea425b6726ce27ac7cd6d383d5:/forum/skins/default/templates/answer_edit.html?ds=sidebyside diff --git a/forum/skins/default/templates/answer_edit.html b/forum/skins/default/templates/answer_edit.html index 137b684..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,13 +25,35 @@ $('#pre-collapse').text(txt); }); - + $('#id_revision').unbind().change(function(){ $("#select_revision").click(); }); - - + + + answer = $("textarea#editor")[0].value; }); + + + 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(); + } + } + + function beforeUnload(e) { + if($("textarea#editor")[0].value != answer) { + return yourWorkWillBeLost(e); + } + } + window.addEventListener('beforeunload', beforeUnload, true); + + var answer = ""; {% endblock %} @@ -52,6 +75,7 @@