Show
Ignore:
Timestamp:
08/19/08 22:17:14 (3 months ago)
Author:
anekos
Message:

逆向きのコマンドも追加

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/vimperator-plugins/trunk/scroll_div.js

    r17906 r17907  
    5353 
    5454  // スクロール対象を変更 
    55   function shiftScrollElement () { 
     55  function shiftScrollElement (n) { 
    5656    let idx = content.document.__div_scroller_index || 0; 
    5757    let es = scrollableElements(); 
    58     idx++; 
     58    idx += (n || 1); 
     59    if (idx < 0) 
     60      idx = es.length - 1; 
    5961    if (idx >= es.length) 
    6062      idx = 0; 
     
    9092  liberator.mappings.addUserMap( 
    9193    [liberator.modes.NORMAL],  
     94    ['<Leader>k'], 
     95    'Scroll up', 
     96    function () scroll(-30) 
     97  ); 
     98 
     99  liberator.mappings.addUserMap( 
     100    [liberator.modes.NORMAL],  
    92101    [']d'], 
    93102    'Shift Scroll Element', 
    94     function () shiftScrollElement() 
     103    function () shiftScrollElement(1) 
    95104  ); 
    96105 
    97   scroll(100); 
    98  
     106  liberator.mappings.addUserMap( 
     107    [liberator.modes.NORMAL],  
     108    ['[d'], 
     109    'Shift Scroll Element', 
     110    function () shiftScrollElement(-1) 
     111  ); 
    99112 
    100113