summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2008-09-18 11:04:38 -0400
committerEvan Prodromou <evan@controlyourself.ca>2008-09-18 11:04:38 -0400
commit950102329522aba7c0cc6f6bb24e5f0cb1ccc14e (patch)
treec8d9830101ca2e0e278fe4f25f09d4dd27f851e7 /js
parent0f787d649b843e5081f6992be46e61531882a204 (diff)
ajaxForm on returned forms
darcs-hash:20080918150438-5ed1f-72853ffa3b2d4a3719ba72a1aedb7191f7213e4e.gz
Diffstat (limited to 'js')
-rw-r--r--js/util.js28
1 files changed, 16 insertions, 12 deletions
diff --git a/js/util.js b/js/util.js
index 636573625..98dce3694 100644
--- a/js/util.js
+++ b/js/util.js
@@ -31,7 +31,7 @@ $(document).ready(function(){
counter.attr("class", "");
}
}
-
+
function submitonreturn(event) {
if (event.keyCode == 13) {
$("#status_form").submit();
@@ -41,14 +41,14 @@ $(document).ready(function(){
}
return true;
}
-
+
if ($("#status_textarea").length) {
$("#status_textarea").bind("keyup", counter);
$("#status_textarea").bind("keydown", submitonreturn);
-
+
// run once in case there's something in there
counter();
-
+
// set the focus
$("#status_textarea").focus();
}
@@ -58,15 +58,19 @@ $(document).ready(function(){
var favoptions = {dataType: 'xml',
success: function(xml) {
var new_form = $('form.disfavor', xml).get(0);
- var id = new_form.id.replace('disfavor', 'favor');
- $('form#'+id).replaceWith(new_form);
+ var dis = new_form.id;
+ var fav = dis.replace('disfavor', 'favor');
+ $('form#'+fav).replaceWith(new_form);
+ $('form#'+dis).ajaxForm(disoptions);
}};
-
+
var disoptions = {dataType: 'xml',
success: function(xml) {
var new_form = $('form.favor', xml).get(0);
- var id = new_form.id.replace('favor', 'disfavor');
- $('form#'+id).replaceWith(new_form);
+ var fav = new_form.id;
+ var dis = dis.replace('favor', 'disfavor');
+ $('form#'+dis).replaceWith(new_form);
+ $('form#'+fav).ajaxForm(favoptions);
}};
function addAjaxHidden() {
@@ -76,12 +80,12 @@ $(document).ready(function(){
ajax.setAttribute('value', 1);
this.appendChild(ajax);
}
-
+
$("form.favor").ajaxForm(favoptions);
$("form.disfavor").ajaxForm(disoptions);
-
+
$("form.favor").each(addAjaxHidden);
- $("form.disfavor").each(addAjaxHidden);
+ $("form.disfavor").each(addAjaxHidden);
});
function doreply(nick) {