summaryrefslogtreecommitdiff
path: root/js/util.js
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-04-26 21:16:09 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-04-26 21:16:09 -0400
commit7405d9dfa684975309150537069a1268a67ed6be (patch)
treee1cba0be5af154d2f5ebe79b98dcc1ae716dc750 /js/util.js
parent192bc42c917999236ad26be0aef6f441e8100d2b (diff)
Don't add a node if it's already there
Try not to double-add a node on Ajax submit. Normally not a big deal, but may happen if the CometPlugin (or in the future Strophe or other auto-update plugins) is enabled.
Diffstat (limited to 'js/util.js')
-rw-r--r--js/util.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/js/util.js b/js/util.js
index 15a14625c..f15c4f2bb 100644
--- a/js/util.js
+++ b/js/util.js
@@ -188,11 +188,15 @@ $(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);
+ id = li.id;
+ 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();