keyboard navigation - o for open

This commit is contained in:
James Campos 2010-11-14 00:14:41 -08:00
parent eea05abfa6
commit 5be92870f6
2 changed files with 10 additions and 3 deletions

View File

@ -361,7 +361,7 @@ iframeLoad = ->
keyboardNav = (e) -> keyboardNav = (e) ->
char = String.fromCharCode e.keyCode char = String.fromCharCode e.keyCode
unless char in '1234567890GHJKL' unless char in '1234567890GHJKLO'
return return
e.preventDefault() e.preventDefault()
hash = location.hash hash = location.hash
@ -404,6 +404,9 @@ keyboardNav = (e) ->
temp = g.PAGENUM + count temp = g.PAGENUM + count
if temp > 15 then temp = 15 if temp > 15 then temp = 15
location.pathname = "/#{g.BOARD}/#{temp}#1" location.pathname = "/#{g.BOARD}/#{temp}#1"
when "O"
qrLink = $ "#{hash} ~ span[id] a:not(:first-child)"
quickReply.call qrLink
g.count = 0 g.count = 0
nodeInserted = (e) -> nodeInserted = (e) ->

View File

@ -445,9 +445,9 @@
return recaptchaReload(); return recaptchaReload();
}; };
keyboardNav = function(e) { keyboardNav = function(e) {
var _i, _len, char, count, hash, position, temp; var _i, _len, char, count, hash, position, qrLink, temp;
char = String.fromCharCode(e.keyCode); char = String.fromCharCode(e.keyCode);
if (!((function(){ for (var _i=0, _len='1234567890GHJKL'.length; _i<_len; _i++) { if ('1234567890GHJKL'[_i] === char) return true; } return false; }).call(this))) { if (!((function(){ for (var _i=0, _len='1234567890GHJKLO'.length; _i<_len; _i++) { if ('1234567890GHJKLO'[_i] === char) return true; } return false; }).call(this))) {
return null; return null;
} }
e.preventDefault(); e.preventDefault();
@ -511,6 +511,10 @@
} }
location.pathname = ("/" + (g.BOARD) + "/" + (temp) + "#1"); location.pathname = ("/" + (g.BOARD) + "/" + (temp) + "#1");
break; break;
case "O":
qrLink = $("" + (hash) + " ~ span[id] a:not(:first-child)");
quickReply.call(qrLink);
break;
} }
return (g.count = 0); return (g.count = 0);
}; };