X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/162b4fd442c169a61d2f5b2b3bd613546c8472da..4b20a67ddb4ebea2c6e09d51ee48da5a856edef8:/forum/skins/default/templates/question.html
diff --git a/forum/skins/default/templates/question.html b/forum/skins/default/templates/question.html
index 305f62c..a9a1706 100644
--- a/forum/skins/default/templates/question.html
+++ b/forum/skins/default/templates/question.html
@@ -13,6 +13,7 @@
{% block title %}{% spaceless %}{{ question.headline }}{% endspaceless %}{% endblock %}
{% block forejs %}
+
{% if not question.nis.closed %}
@@ -29,7 +30,7 @@
}
$('#editor').TextAreaResizer();
-
+
//toggle preview of editor
var display = true;
var txt = "[{% trans "hide preview" %}]";
@@ -40,8 +41,32 @@
$('#previewer').toggle();
$('#pre-collapse').text(txt);
});
+
});
-
+
+ function beforeUnload(e) {
+ if($("textarea#editor")[0].value != "") {
+ yourWorkWillBeLost(e);
+ }
+
+ $("textarea.commentBox").each(function() {
+ if(this.value != "") {
+ yourWorkWillBeLost(e);
+ }
+ });
+
+ return false;
+ }
+ window.addEventListener('beforeunload', beforeUnload, true);
+
+ function submitClicked() {
+ window.removeEventListener('beforeunload', beforeUnload, true);
+ $("input.submit").each(function() {
+ this.disabled=true;
+ });
+ }
+
+