diff options
author | anekos | 2008-08-19 13:17:14 +0000 |
---|---|---|
committer | anekos | 2008-08-19 13:17:14 +0000 |
commit | 736f14537db10911c2aaa76997377c5d3f182445 (patch) | |
tree | dae17aaa675bd35679bcdf773d0b0f395f1ec6e5 /scroll_div.js | |
parent | db5b9fbb7b72b4ae724297995970a3f0957622a6 (diff) | |
download | vimperator-plugins-736f14537db10911c2aaa76997377c5d3f182445.tar.bz2 |
逆向きのコマンドも追加
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@17907 d0d07461-0603-4401-acd4-de1884942a52
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) + ); })(); |