]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - js/util.js
4f2e7c724d99f8c2adc67124c593a53a4c4d6b5c
[quix0rs-gnu-social.git] / js / util.js
1 $(document).ready(function(){
2         // count character on keyup
3         function counter(){
4             var maxLength     = 140;
5             var currentLength = $("#status_textarea").val().length;
6             var remaining = 140 - currentLength;
7             var counter = $("#counter");
8             counter.text(remaining);
9
10             if(remaining <= 0) {
11                 counter.attr("class", "toomuch");
12                 } else {
13                 counter.attr("class", "");
14                 }
15         }
16
17         if ($("#status_textarea").length) {
18             $("#status_textarea").bind("keyup", counter);
19             // run once in case there's something in there
20                         counter();
21         }
22 });
23