forked from GNUsocial/gnu-social
409bc56ff2
darcs-hash:20080701183016-84dde-f1aed06f7bd67a665ba55c03f036d98bd208c3b9.gz
24 lines
697 B
JavaScript
24 lines
697 B
JavaScript
$(document).ready(function(){
|
|
// count character on keyup
|
|
function counter(){
|
|
var maxLength = 140;
|
|
var currentLength = $("#status_textarea").val().length;
|
|
var remaining = 140 - currentLength;
|
|
var counter = $("#counter");
|
|
counter.text(remaining);
|
|
|
|
if(remaining <= 0) {
|
|
counter.attr("class", "toomuch");
|
|
} else {
|
|
counter.attr("class", "");
|
|
}
|
|
}
|
|
|
|
if ($("#status_textarea").length) {
|
|
$("#status_textarea").bind("keyup", counter);
|
|
// run once in case there's something in there
|
|
counter();
|
|
}
|
|
});
|
|
|