fix kb thread nav

This commit is contained in:
James Campos 2010-11-14 04:52:17 -08:00
parent 488b828515
commit 60db94c2ec
2 changed files with 8 additions and 6 deletions

View File

@ -376,9 +376,10 @@ keyAct = (e) ->
char = String.fromCharCode kc
hash = location.hash
if not hash or hash == '#navtop'
position = 0
position = -1
else
position = Number(hash.substring 2) or 0
temp = Number(hash.substring 2)
position = if temp is NaN then -1 else temp
count = g.count
if char in '1234567890'
temp = Number char
@ -409,7 +410,7 @@ keyAct = (e) ->
location.hash = 'p' + temp
when "K"
temp = position - count
if temp <= 0 then temp = 'navtop' else temp = 'p' + temp
if temp < 0 then temp = 'navtop' else temp = 'p' + temp
location.hash = temp
when "L"
temp = g.PAGENUM + count

View File

@ -464,9 +464,10 @@
char = String.fromCharCode(kc);
hash = location.hash;
if (!hash || hash === '#navtop') {
position = 0;
position = -1;
} else {
position = Number(hash.substring(2)) || 0;
temp = Number(hash.substring(2));
position = temp === NaN ? -1 : temp;
}
count = g.count;
if ((function(){ for (var _i=0, _len='1234567890'.length; _i<_len; _i++) { if ('1234567890'[_i] === char) return true; } return false; }).call(this)) {
@ -509,7 +510,7 @@
break;
case "K":
temp = position - count;
if (temp <= 0) {
if (temp < 0) {
temp = 'navtop';
} else {
temp = 'p' + temp;