forked from GNUsocial/gnu-social
ajaxForm on returned forms
darcs-hash:20080918150438-5ed1f-72853ffa3b2d4a3719ba72a1aedb7191f7213e4e.gz
This commit is contained in:
parent
0f787d649b
commit
9501023295
28
js/util.js
28
js/util.js
@ -31,7 +31,7 @@ $(document).ready(function(){
|
|||||||
counter.attr("class", "");
|
counter.attr("class", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitonreturn(event) {
|
function submitonreturn(event) {
|
||||||
if (event.keyCode == 13) {
|
if (event.keyCode == 13) {
|
||||||
$("#status_form").submit();
|
$("#status_form").submit();
|
||||||
@ -41,14 +41,14 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($("#status_textarea").length) {
|
if ($("#status_textarea").length) {
|
||||||
$("#status_textarea").bind("keyup", counter);
|
$("#status_textarea").bind("keyup", counter);
|
||||||
$("#status_textarea").bind("keydown", submitonreturn);
|
$("#status_textarea").bind("keydown", submitonreturn);
|
||||||
|
|
||||||
// run once in case there's something in there
|
// run once in case there's something in there
|
||||||
counter();
|
counter();
|
||||||
|
|
||||||
// set the focus
|
// set the focus
|
||||||
$("#status_textarea").focus();
|
$("#status_textarea").focus();
|
||||||
}
|
}
|
||||||
@ -58,15 +58,19 @@ $(document).ready(function(){
|
|||||||
var favoptions = {dataType: 'xml',
|
var favoptions = {dataType: 'xml',
|
||||||
success: function(xml) {
|
success: function(xml) {
|
||||||
var new_form = $('form.disfavor', xml).get(0);
|
var new_form = $('form.disfavor', xml).get(0);
|
||||||
var id = new_form.id.replace('disfavor', 'favor');
|
var dis = new_form.id;
|
||||||
$('form#'+id).replaceWith(new_form);
|
var fav = dis.replace('disfavor', 'favor');
|
||||||
|
$('form#'+fav).replaceWith(new_form);
|
||||||
|
$('form#'+dis).ajaxForm(disoptions);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
var disoptions = {dataType: 'xml',
|
var disoptions = {dataType: 'xml',
|
||||||
success: function(xml) {
|
success: function(xml) {
|
||||||
var new_form = $('form.favor', xml).get(0);
|
var new_form = $('form.favor', xml).get(0);
|
||||||
var id = new_form.id.replace('favor', 'disfavor');
|
var fav = new_form.id;
|
||||||
$('form#'+id).replaceWith(new_form);
|
var dis = dis.replace('favor', 'disfavor');
|
||||||
|
$('form#'+dis).replaceWith(new_form);
|
||||||
|
$('form#'+fav).ajaxForm(favoptions);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
function addAjaxHidden() {
|
function addAjaxHidden() {
|
||||||
@ -76,12 +80,12 @@ $(document).ready(function(){
|
|||||||
ajax.setAttribute('value', 1);
|
ajax.setAttribute('value', 1);
|
||||||
this.appendChild(ajax);
|
this.appendChild(ajax);
|
||||||
}
|
}
|
||||||
|
|
||||||
$("form.favor").ajaxForm(favoptions);
|
$("form.favor").ajaxForm(favoptions);
|
||||||
$("form.disfavor").ajaxForm(disoptions);
|
$("form.disfavor").ajaxForm(disoptions);
|
||||||
|
|
||||||
$("form.favor").each(addAjaxHidden);
|
$("form.favor").each(addAjaxHidden);
|
||||||
$("form.disfavor").each(addAjaxHidden);
|
$("form.disfavor").each(addAjaxHidden);
|
||||||
});
|
});
|
||||||
|
|
||||||
function doreply(nick) {
|
function doreply(nick) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user