do submit on keydown
darcs-hash:20080905045736-84dde-7232813dafb70b75309f5cb9e58831fb49497918.gz
This commit is contained in:
parent
a0d607ecaa
commit
e29c2b2938
13
js/util.js
13
js/util.js
@ -19,10 +19,6 @@
|
|||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
// count character on keyup
|
// count character on keyup
|
||||||
function counter(event){
|
function counter(event){
|
||||||
if (event.keyCode == 13) {
|
|
||||||
$("#status_form").submit();
|
|
||||||
}
|
|
||||||
|
|
||||||
var maxLength = 140;
|
var maxLength = 140;
|
||||||
var currentLength = $("#status_textarea").val().length;
|
var currentLength = $("#status_textarea").val().length;
|
||||||
var remaining = maxLength - currentLength;
|
var remaining = maxLength - currentLength;
|
||||||
@ -36,9 +32,16 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#status_textarea").bind("keyup", counter);
|
function submitonreturn(event) {
|
||||||
|
if (event.keyCode == 13) {
|
||||||
|
$("#status_form").submit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($("#status_textarea").length) {
|
if ($("#status_textarea").length) {
|
||||||
|
$("#status_textarea").bind("keyup", counter);
|
||||||
|
$("#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();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user