マッチするページの場合、自動的にvimperatorのkeyをオフにする autoIgnoreKey プラグイン
Vimperator2.0がある今もうすでにこのプラグインは古いものです
vimperator plugin の autoIgnoreKey.js の改良にて新しいものを書きましたので、以下のコードは古いものです。
GmailとかLivedoor Reader等へ訪れた場合、vimperatorにキーを奪われてしまう。毎回、Iを押してオフにするのが面倒になってプラグインを書いてみた。
ignorePageList配列にに文字列か正規表現でvimperatorのキーをオフにしたいURIを入れておけば、読み込み時に自動的にオフになるはず。
追記
タブを切り替えた瞬間にオフにするようにしたいなぁ
livedoorクリップ:takayuki0510
ふむ、オイラもそう思っていた。ということで付け加えてみたよ。
追追記
こちらも頑張って更新したらtsukkeeさんの方が早かった。tsukkeeさんのスクリプトの方がシンプルで良いかも。
HOME/.vimperator/plugin/autoIgnoreKey.js
/** * Auto ignore vimperator key * @author teramako [email protected] * @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); } }); } })();