From: court Date: Fri, 20 Aug 2010 14:55:35 +0000 (+0000) Subject: should now be working for chrome/safari/firefox. still need to fix markdown display... X-Git-Tag: live~572 X-Git-Url: https://git.openstreetmap.org./osqa.git/commitdiff_plain/3b5cf11889534f64588a9dabc008e745d2c67c3a should now be working for chrome/safari/firefox. still need to fix markdown display when editing a question or answer. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@562 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- diff --git a/forum/skins/default/templates/answer_edit.html b/forum/skins/default/templates/answer_edit.html index fbea230..4265a3e 100644 --- a/forum/skins/default/templates/answer_edit.html +++ b/forum/skins/default/templates/answer_edit.html @@ -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; } @@ -44,13 +44,8 @@ } 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); diff --git a/forum/skins/default/templates/ask.html b/forum/skins/default/templates/ask.html index 9549d29..7b34ba4 100644 --- a/forum/skins/default/templates/ask.html +++ b/forum/skins/default/templates/ask.html @@ -62,22 +62,19 @@ }); 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 %}"; diff --git a/forum/skins/default/templates/node/comments.html b/forum/skins/default/templates/node/comments.html index 87ce889..702d3ad 100644 --- a/forum/skins/default/templates/node/comments.html +++ b/forum/skins/default/templates/node/comments.html @@ -50,7 +50,7 @@ {% trans "characters needed" %} {% trans "characters left" %} - + diff --git a/forum/skins/default/templates/question.html b/forum/skins/default/templates/question.html index 010ed43..6407978 100644 --- a/forum/skins/default/templates/question.html +++ b/forum/skins/default/templates/question.html @@ -44,29 +44,22 @@ }); 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) { - var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1; if($("textarea#editor")[0].value != "") { - if(is_chrome) { - return "Are you sure you want to leave? Your work will be lost."; - } else { - yourWorkWillBeLost(e); - } + return yourWorkWillBeLost(e); } var commentBoxes = $("textarea.commentBox"); for(var index = 0; index < commentBoxes.length; index++) { if(commentBoxes[index].value != "") { - if(is_chrome) { - return "You sure you want to leave? Your work will be lost."; - } else { - yourWorkWillBeLost(e); - } + return yourWorkWillBeLost(e); } } } diff --git a/forum/skins/default/templates/question_edit.html b/forum/skins/default/templates/question_edit.html index 47af6bf..402a0eb 100644 --- a/forum/skins/default/templates/question_edit.html +++ b/forum/skins/default/templates/question_edit.html @@ -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; } @@ -70,14 +70,8 @@ } 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);