}\r
},\r
\r
- mark_accepted: function(id) {\r
- $('.accepted-answer').removeClass('accepted-answer');\r
- $('.accept-answer.on').removeClass('on');\r
- \r
+ mark_accepted: function(id) { \r
var $answer = $('#answer-container-' + id);\r
$answer.addClass('accepted-answer');\r
$answer.find('.accept-answer').addClass('on');\r
return false;\r
});\r
\r
- $cancel.click(function() {\r
- if (comment_in_form) {\r
- $comment = $('#comment-' + comment_in_form).slideDown('slow');\r
+ $cancel.click(function(event) {\r
+ if (confirm("You will lose all of your changes in this comment. Do you still wish to proceed?")){\r
+ if (comment_in_form) {\r
+ $comment = $('#comment-' + comment_in_form).slideDown('slow');\r
+ }\r
+ hide_comment_form();\r
+ cleanup_form();\r
}\r
- hide_comment_form();\r
return false;\r
});\r
}\r
\r
var call_settings = {\r
type:'POST',\r
- url:url\r
+ url:url,\r
+ data: ''\r
};\r
if (callback !== false){\r
call_settings.success = callback;\r
});\r
});\r
\r
+function yourWorkWillBeLost(e) {\r
+ if(browserTester('chrome')) {\r
+ return "You sure you want to leave? Your work will be lost.";\r
+ } else if(browserTester('safari')) {\r
+ return "You sure you want to leave? Your work will be lost.";\r
+ } else {\r
+ if(!e) e = window.event;\r
+ e.cancelBubble = true;\r
+ e.returnValue = 'If you leave your work will be lost.';\r
+\r
+ if (e.stopPropagation) {\r
+ e.stopPropagation();\r
+ e.preventDefault();\r
+ }\r
+ return e;\r
+ }\r
+}\r
+\r
+function browserTester(browserString) {\r
+ var test = navigator.userAgent;\r
+ return navigator.userAgent.toLowerCase().indexOf(browserString) > -1;\r
+}
\ No newline at end of file