2008-06-25 02:46:13 +09:00
|
|
|
$(document).ready(function(){
|
|
|
|
// count character on keyup
|
2008-07-02 03:30:16 +09:00
|
|
|
function counter(){
|
|
|
|
var maxLength = 140;
|
2008-06-25 02:46:13 +09:00
|
|
|
var currentLength = $("#status_textarea").val().length;
|
|
|
|
var remaining = 140 - currentLength;
|
2008-06-25 21:58:47 +09:00
|
|
|
var counter = $("#counter");
|
|
|
|
counter.text(remaining);
|
2008-06-25 02:46:13 +09:00
|
|
|
|
|
|
|
if(remaining <= 0) {
|
2008-06-25 21:58:47 +09:00
|
|
|
counter.attr("class", "toomuch");
|
2008-06-25 02:46:13 +09:00
|
|
|
} else {
|
2008-06-25 21:58:47 +09:00
|
|
|
counter.attr("class", "");
|
2008-06-25 02:46:13 +09:00
|
|
|
}
|
|
|
|
}
|
2008-07-09 16:14:39 +09:00
|
|
|
|
2008-06-25 02:46:13 +09:00
|
|
|
if ($("#status_textarea").length) {
|
|
|
|
$("#status_textarea").bind("keyup", counter);
|
2008-07-02 03:30:16 +09:00
|
|
|
// run once in case there's something in there
|
|
|
|
counter();
|
2008-06-25 02:46:13 +09:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2008-07-09 16:14:39 +09:00
|
|
|
function doreply(nick) {
|
|
|
|
rgx_username = /^[0-9a-zA-Z\-_.]*$/;
|
|
|
|
if (nick.match(rgx_username)) {
|
|
|
|
replyto = "@" + nick + " ";
|
|
|
|
if ($("#status_textarea")) {
|
2008-07-09 16:24:29 +09:00
|
|
|
$("#status_textarea").val(replyto);
|
2008-07-09 16:14:39 +09:00
|
|
|
$("#status_textarea").focus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|