[Vimperator] plugin: auto ignore key (version 0.5.3)

M.Terada teramako at gmail.com
Sat Feb 2 05:21:11 PST 2008


Hi

vimperator is very useful.
But vimperator spoils the key navigation of the web pages like gmail.
So I press Shift-i which ignore vimperator key navigation, and use the page.
That's a bother.

So I coded vimperator plugin for version 0.5.3

autoIgnoreKey.js
-----------------------
/**
 * Auto ignore vimperator key
 * @author teramako teramako at gmail.com
 * @version 0.2a
 */

(function(){
/*
 * String or RegExp
 * e.g)
 *  * /^https?:\/\/mail\.google\.com\//
 *  * 'http://reader.livedoor.com/reader/'
 */
var ignorePageList = [
        /^https?:\/\/mail\.google\.com\//
];
document.getElementById('appcontent').addEventListener('DOMContentLoaded',function(event){
        if ( isMatch(event.target.documentURI) ){
                vimperator.addMode(null, vimperator.modes.ESCAPE_ALL_KEYS);
                //vimperator.log('Map ignored: '+ event.target.documentURI);
        }
},true);
getBrowser().mTabBox.addEventListener('select',function(event){
        if (!('updateCurrentBrowser' in this.parentNode) ||
event.target.localName != 'tabpanels'){
                var uri = this.parentNode.currentURI.spec;
                if ( isMatch(uri) ){
                        vimperator.addMode(null,
vimperator.modes.ESCAPE_ALL_KEYS);
                        //vimperator.log('Map ignored: '+ uri);
                }
        }
},true);
function isMatch(uri){
        return ignorePageList.some(function(e,i,a){
                if (typeof e == 'string'){
                        return uri.indexOf(e) != -1;
                } else if (e instanceof RegExp){
                        return e.test(uri);
                }
        });
}
})();
--------------------

P.S.
I'm not good at English.
So I glad you understand my English

--
teramako


More information about the Vimperator mailing list