X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/d7a18910f5d471a3fa37f3a1cf202fa5302ac25f..40e2851e2e2bf5e35063597b30ada01d06d2cc11:/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..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 @@
{% trans "toggle preview" %} + {% if settings.WIKI_ON %}
{{ form.wiki }} {{ form.wiki.label_tag }} @@ -66,8 +90,8 @@
{{ form.summary.help_text }}
- - + +