diff options
Diffstat (limited to 'scroll_div.js')
-rw-r--r-- | scroll_div.js | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/scroll_div.js b/scroll_div.js index 3eb57cf..7d71310 100644 --- a/scroll_div.js +++ b/scroll_div.js @@ -52,10 +52,12 @@ } // スクロール対象を変更 - function shiftScrollElement () { + function shiftScrollElement (n) { let idx = content.document.__div_scroller_index || 0; let es = scrollableElements(); - idx++; + idx += (n || 1); + if (idx < 0) + idx = es.length - 1; if (idx >= es.length) idx = 0; content.document.__div_scroller_index = idx; @@ -89,13 +91,24 @@ liberator.mappings.addUserMap( [liberator.modes.NORMAL], + ['<Leader>k'], + 'Scroll up', + function () scroll(-30) + ); + + liberator.mappings.addUserMap( + [liberator.modes.NORMAL], [']d'], 'Shift Scroll Element', - function () shiftScrollElement() + function () shiftScrollElement(1) ); - scroll(100); - + liberator.mappings.addUserMap( + [liberator.modes.NORMAL], + ['[d'], + 'Shift Scroll Element', + function () shiftScrollElement(-1) + ); })(); |