summaryrefslogtreecommitdiff
path: root/js/util.js
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-05-11 17:53:23 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-05-11 17:53:23 -0400
commit99f8501d321ae9d8087abbe6523e28ce5fd095d3 (patch)
treefb721b4360f0748df3cb3b522565ad4566422555 /js/util.js
parent7f0e57598a5837bbb87f197baa147be29c7df531 (diff)
parent251fd2c232d96ea09db971a6608231c679395c01 (diff)
Merge branch '0.8.x' of git@gitorious.org:laconica/dev into 0.8.x
Conflicts: config.php.sample
Diffstat (limited to 'js/util.js')
-rw-r--r--js/util.js35
1 files changed, 26 insertions, 9 deletions
diff --git a/js/util.js b/js/util.js
index 53e6eb792..3f14bc61c 100644
--- a/js/util.js
+++ b/js/util.js
@@ -166,6 +166,22 @@ $(document).ready(function(){
$("#notice_action-submit").addClass("disabled");
return true;
},
+ timeout: '60000',
+ error: function (xhr, textStatus, errorThrown) { $("#form_notice").removeClass("processing");
+ $("#notice_action-submit").removeAttr("disabled");
+ $("#notice_action-submit").removeClass("disabled");
+ if (textStatus == "timeout") {
+ alert ("Sorry! We had trouble sending your notice. The servers are overloaded. Please try again, and contact the site administrator if this problem persists");
+ }
+ else {
+ if ($(".error", xhr.responseXML).length > 0) {
+ $('#form_notice').append(document._importNode($(".error", xhr.responseXML).get(0), true));
+ }
+ else {
+ alert("Sorry! We had trouble sending your notice ("+xhr.status+" "+xhr.statusText+"). Please report the problem to the site administrator if this happens again.");
+ }
+ }
+ },
success: function(xml) { if ($("#error", xml).length > 0) {
var result = document._importNode($("p", xml).get(0), true);
result = result.textContent || result.innerHTML;
@@ -178,11 +194,14 @@ $(document).ready(function(){
alert(result);
}
else {
- $("#notices_primary .notices").prepend(document._importNode($("li", xml).get(0), true));
- $("#notices_primary .notice:first").css({display:"none"});
- $("#notices_primary .notice:first").fadeIn(2500);
- NoticeHover();
- NoticeReply();
+ li = $("li", xml).get(0);
+ if ($("#"+li.id).length == 0) {
+ $("#notices_primary .notices").prepend(document._importNode(li, true));
+ $("#notices_primary .notice:first").css({display:"none"});
+ $("#notices_primary .notice:first").fadeIn(2500);
+ NoticeHover();
+ NoticeReply();
+ }
}
$("#notice_data-text").val("");
counter();
@@ -192,10 +211,8 @@ $(document).ready(function(){
$("#notice_action-submit").removeClass("disabled");
}
};
- if (document.body.id != 'inbox' && document.body.id != 'outbox') {
- $("#form_notice").ajaxForm(PostNotice);
- $("#form_notice").each(addAjaxHidden);
- }
+ $("#form_notice").ajaxForm(PostNotice);
+ $("#form_notice").each(addAjaxHidden);
NoticeHover();
NoticeReply();
});