Show
Ignore:
Timestamp:
11/25/08 19:15:50 (5 years ago)
Author:
anekos
Message:

addUserMap を使用しないようにした

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/vimperator-plugins/branches/1.2/ldrize_cooperation.js

    r24577 r24841  
    110110    var _isEnable; 
    111111 
     112    function replaceMap (mode, key, desc, aroundFunc, extra) { 
     113      let old = liberator.mappings.get(mode, key); 
     114      let oldAction = old.action; 
     115      old.description = desc; 
     116      old.action = function () 
     117                      let (self = this, args = arguments) 
     118                        aroundFunc(function () oldAction.apply(self, args)); 
     119    } 
     120 
    112121    var LDRizeCooperation = new Class(); 
    113122    LDRizeCooperation.prototype = { 
     
    219228 
    220229            //Mappings 
    221             liberator.mappings.addUserMap([liberator.modes.NORMAL], [",f"], 
     230            liberator.mappings.add([liberator.modes.NORMAL], [",f"], 
    222231                "Start QuickHint mode with LDRize", 
    223232                function(){ 
     
    227236                } ,{}); 
    228237 
    229             liberator.mappings.addUserMap([liberator.modes.NORMAL], ["f"], 
     238            replaceMap(liberator.modes.NORMAL, "f", 
    230239                "Start QuickHint mode", 
    231                 function(){ 
     240                function(f){ 
    232241                    setHinttags(self.isEnableLDRizeCooperation() && self.isModHints); 
    233                     liberator.hints.show("o"); 
    234                 },{}); 
    235  
    236             liberator.mappings.addUserMap([liberator.modes.NORMAL], ["F"], 
     242                    f(); 
     243                }); 
     244 
     245            replaceMap(liberator.modes.NORMAL, "F", 
    237246                "Start QuickHint mode, but open link in a new tab", 
    238                 function(){ 
     247                function(f){ 
    239248                    setHinttags(self.isEnableLDRizeCooperation() && self.isModHints); 
    240                     liberator.hints.show("t"); 
    241                 },{}); 
    242  
    243             liberator.mappings.addUserMap([liberator.modes.NORMAL], [";"], 
     249                    f(); 
     250                }); 
     251 
     252            replaceMap(liberator.modes.NORMAL, ";", 
    244253                "Start an extended hint mode", 
    245                 function(arg){ 
     254                function(f){ 
    246255                    setHinttags(self.isEnableLDRizeCooperation() && self.isModHints); 
    247                     liberator.hints.show(arg); 
    248                 }, 
    249                 { flags: liberator.Mappings.flags.ARGUMENT }); 
     256                    f(); 
     257                }); 
     258 
    250259            //Commands 
    251260            liberator.commands.addUserCommand(["pin"], "LDRize Pinned Links",