]> git.openstreetmap.org Git - osqa.git/commitdiff
should now be working for chrome/safari/firefox. still need to fix markdown display...
authorcourt <court@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Fri, 20 Aug 2010 14:55:35 +0000 (14:55 +0000)
committercourt <court@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Fri, 20 Aug 2010 14:55:35 +0000 (14:55 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@562 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/skins/default/templates/answer_edit.html
forum/skins/default/templates/ask.html
forum/skins/default/templates/node/comments.html
forum/skins/default/templates/question.html
forum/skins/default/templates/question_edit.html

index fbea230c6cff3fd536d8b07486b0aa4abd399197..4265a3e28fac37d2b67df14a21d91f034268cfce 100644 (file)
@@ -36,7 +36,7 @@
 
 
         function submitClicked(e) {
-            if(!is_chrome) {
+            if(!(browserTester('chrome') || browserTester('safari'))) {
                 $("input.submit")[0].disabled=true;
                 $("input.submit")[1].disabled=true;
             }
         }
 
         function beforeUnload(e) {
-            var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
             if($("textarea#editor")[0].value != answer) {
-                 if(is_chrome) {
-                     return "Are you sure you want to leave?  Your work will be lost.";
-                 } else {
-                     yourWorkWillBeLost(e);
-                 }
+                 return yourWorkWillBeLost(e);
             }
         }
         window.addEventListener('beforeunload', beforeUnload, true);
index 9549d29aa7d54e1eb0d9e1da85c4cf55bcf70da4..7b34ba4c9743a0e17574225c1b2eb8b02791edd1 100644 (file)
         });
 
         function submitClicked(e) {
-            if(!is_chrome)$("input.submit")[0].disabled=true;
+            if(!(browserTester('chrome') || browserTester('safari'))) {
+                $("input.submit")[0].disabled=true;
+            }
             window.removeEventListener('beforeunload', beforeUnload, true);
         }
 
         function beforeUnload(e) {
             if($("input#id_title")[0].value != "" || $("textarea#editor")[0].value != "" || $("input#id_tags")[0].value != "") {
-                if(is_chrome) {
-                    return "Are you sure you want to leave?  Your work will be lost.";
-                } else {
-                    yourWorkWillBeLost(e);
-                }
+                return yourWorkWillBeLost(e);
             }
         }
         window.addEventListener('beforeunload', beforeUnload, true);
 
-        var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
         var related_questions_url = "{% url related_questions %}";
         </script>
         <script src="{% media "/media/js/osqa.ask.js" %}" type="text/javascript"></script>
index 87ce889dedfb537599898e31d8df015265aabf3e..702d3ad26fa955fe9371d698a82de590f151dceb 100644 (file)
@@ -50,7 +50,7 @@
                     <span class="comments-chars-togo-msg">{% trans "characters needed" %}</span>\r
                     <span class="comments-chars-left-msg">{% trans "characters left" %}</span>\r
                 </span>\r
-                <input type="submit" class="comment-submit" value="{% trans " comment" %}" onclick="window.removeEventListener('beforeunload', beforeUnload, true)" />\r
+                <input type="submit" class="comment-submit" value="{% trans " comment" %}" />\r
                 <input type="submit" class="comment-cancel" value="{% trans " cancel" %}" />\r
             </div>\r
         </div>\r
index 010ed4369482d964d08a65ed9014b791faae0e47..64079783bdd3fbcfbd8d41d46f3333c77c092698 100644 (file)
         });\r
 \r
         function submitClicked(e) {\r
-            if(!is_chrome)$("input.submit")[0].disabled=true;\r
+            if(!(browserTester('chrome') || browserTester('safari'))) {\r
+                $("input.submit")[0].disabled=true;\r
+            }\r
             window.removeEventListener('beforeunload', beforeUnload, true);\r
         }\r
 \r
         function beforeUnload(e) {\r
-            var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;\r
 \r
             if($("textarea#editor")[0].value != "") {\r
-                if(is_chrome) {\r
-                    return "Are you sure you want to leave?  Your work will be lost.";\r
-                } else {\r
-                    yourWorkWillBeLost(e);\r
-                }\r
+                return yourWorkWillBeLost(e);\r
             }\r
 \r
             var commentBoxes = $("textarea.commentBox");\r
             for(var index = 0; index < commentBoxes.length; index++) {\r
                 if(commentBoxes[index].value != "") {\r
-                    if(is_chrome) {\r
-                        return "You sure you want to leave?  Your work will be lost.";\r
-                    } else {\r
-                        yourWorkWillBeLost(e);\r
-                    }\r
+                    return yourWorkWillBeLost(e);\r
                 }\r
             }\r
         }\r
index 47af6bf813a14012af33c86de73a25297ea9450f..402a0eb56b27a8e48214ad35c0053b8fe07564e4 100644 (file)
@@ -62,7 +62,7 @@
         });
 
         function submitClicked(e) {
-            if(!is_chrome) {
+            if(!(browserTester('chrome') || browserTester('safari'))) {
                 $("input.submit")[0].disabled=true;
                 $("input.submit")[1].disabled=true;
             }
         }
 
         function beforeUnload(e) {
-            var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
-
             if($("input#id_title")[0].value != title || $("textarea#editor")[0].value != body || $("input#id_tags")[0].value != tag) {
-                 if(is_chrome) {
-                     return "You sure you want to leave?  Your work will be lost.";
-                 } else {
-                     yourWorkWillBeLost(e);
-                 }
+                 return yourWorkWillBeLost(e);
             }
         }
         window.addEventListener('beforeunload', beforeUnload, true);