summaryrefslogtreecommitdiff
path: root/js/util.js
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2008-09-17 23:20:48 -0400
committerEvan Prodromou <evan@controlyourself.ca>2008-09-17 23:20:48 -0400
commit4af5b0441b7cd3a989510d7c62b339ed82440a7a (patch)
tree0b647aecef62479679655035304744d4c43ff55c /js/util.js
parent560cab34277603bc73d0472cc5a4e2842209c62c (diff)
split favor forms code
darcs-hash:20080918032048-5ed1f-90a55a52e5444d9ae85c0d52af204b44fb895f58.gz
Diffstat (limited to 'js/util.js')
-rw-r--r--js/util.js19
1 files changed, 15 insertions, 4 deletions
diff --git a/js/util.js b/js/util.js
index d7e799eb7..d5e1c8720 100644
--- a/js/util.js
+++ b/js/util.js
@@ -52,14 +52,25 @@ $(document).ready(function(){
// set the focus
$("#status_textarea").focus();
}
+
+ // XXX: refactor this code
+
+ var favoptions = {dataType: 'xml',
+ success: function(xml) {
+ var new_form = $('form.disfavor', xml);
+ var id = new_form.id.replace('disfavor', 'favor');
+ $('form#'+id).replace(new_form);
+ }};
- var options = {dataType: 'xml',
+ var disoptions = {dataType: 'xml',
success: function(xml) {
- // replace the form with what's returned
+ var new_form = $('form.favor', xml);
+ var id = new_form.id.replace('favor', 'disfavor');
+ $('form#'+id).replace(new_form);
}};
- $("form.favor").ajaxForm(options);
- $("form.disfavor").ajaxForm(options);
+ $("form.favor").ajaxForm(favoptions);
+ $("form.disfavor").ajaxForm(disoptions);
});
function doreply(nick) {