keybinds: h/l - scroll left/right, H/L - move pages

This commit is contained in:
James Campos 2010-12-19 08:25:39 -08:00
parent 304c518a68
commit c498abc486
2 changed files with 32 additions and 18 deletions

View File

@ -468,10 +468,13 @@ keyModeNormal = (e) ->
count or= 1 count or= 1
switch char switch char
when "H" when "H"
unless g.REPLY if e.shiftKey
temp = g.PAGENUM - count unless g.REPLY
if temp < 0 then temp = 0 temp = g.PAGENUM - count
location.pathname = "/#{g.BOARD}/#{temp}#1" if temp < 0 then temp = 0
location.pathname = "/#{g.BOARD}/#{temp}#1"
else
window.scrollBy -20 * count, 0
when "I" when "I"
if g.reply if g.reply
unless qrLink = $ 'td.replyhl span[id] a:not(:first-child)' unless qrLink = $ 'td.replyhl span[id] a:not(:first-child)'
@ -527,10 +530,13 @@ keyModeNormal = (e) ->
else else
window.scrollBy 0, -20 * count window.scrollBy 0, -20 * count
when "L" when "L"
unless g.REPLY if e.shiftKey
temp = g.PAGENUM + count unless g.REPLY
if temp > 15 then temp = 15 temp = g.PAGENUM + count
location.pathname = "/#{g.BOARD}/#{temp}#0" if temp > 15 then temp = 15
location.pathname = "/#{g.BOARD}/#{temp}#0"
else
window.scrollBy 20 * count, 0
when "M" when "M"
if e.shiftKey if e.shiftKey
$("#imageExpand").click() $("#imageExpand").click()

View File

@ -593,12 +593,16 @@
count || (count = 1); count || (count = 1);
switch (char) { switch (char) {
case "H": case "H":
if (!g.REPLY) { if (e.shiftKey) {
temp = g.PAGENUM - count; if (!g.REPLY) {
if (temp < 0) { temp = g.PAGENUM - count;
temp = 0; if (temp < 0) {
temp = 0;
}
return location.pathname = "/" + g.BOARD + "/" + temp + "#1";
} }
return location.pathname = "/" + g.BOARD + "/" + temp + "#1"; } else {
return window.scrollBy(-20 * count, 0);
} }
break; break;
case "I": case "I":
@ -681,12 +685,16 @@
} }
break; break;
case "L": case "L":
if (!g.REPLY) { if (e.shiftKey) {
temp = g.PAGENUM + count; if (!g.REPLY) {
if (temp > 15) { temp = g.PAGENUM + count;
temp = 15; if (temp > 15) {
temp = 15;
}
return location.pathname = "/" + g.BOARD + "/" + temp + "#0";
} }
return location.pathname = "/" + g.BOARD + "/" + temp + "#0"; } else {
return window.scrollBy(20 * count, 0);
} }
break; break;
case "M": case "M":