diff options
author | drry | 2008-03-21 02:11:34 +0000 |
---|---|---|
committer | drry | 2008-03-21 02:11:34 +0000 |
commit | cc76a40ad3a001def2f2a9348bad82453d8fd5d6 (patch) | |
tree | d46fb40b49e9f5e3a2a3303fb5943ecfaef2c941 /autoIgnoreKey.js | |
parent | 0d19a1e18f331d8a73a34839947209d1c58949b9 (diff) | |
download | vimperator-plugins-cc76a40ad3a001def2f2a9348bad82453d8fd5d6.tar.bz2 |
lang/javascript/vimperator-plugins/trunk/xpathBlink.js
lang/javascript/vimperator-plugins/trunk/autoIgnoreKey.js
lang/javascript/vimperator-plugins/trunk/copy.js
lang/javascript/vimperator-plugins/trunk/lookupDictionary.js
lang/javascript/vimperator-plugins/trunk/splitBrowser.js
lang/javascript/vimperator-plugins/trunk/gmperator.js:
* 消えたファイルを trunk にコピーしました。
* ほか。
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@8235 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'autoIgnoreKey.js')
-rw-r--r-- | autoIgnoreKey.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/autoIgnoreKey.js b/autoIgnoreKey.js new file mode 100644 index 0000000..07dd218 --- /dev/null +++ b/autoIgnoreKey.js @@ -0,0 +1,48 @@ +/** + * Auto switch vimperator key navigation + * For vimperator 0.5.3 + * @author teramako teramako@gmail.com + * @version 0.3 + */ + +(function(){ +/* + * String or RegExp + * e.g) + * * /^https?:\/\/mail\.google\.com\// + * * 'http://reader.livedoor.com/reader/' + */ +const ignorePageList = [ + /^https?:\/\/mail\.google\.com\//, + /^http:\/\/reader\.livedoor\.com\/(?:reader|public)\// +]; +document.getElementById('appcontent').addEventListener('DOMContentLoaded',function(event){ + if (event.target.documentURI != gBrowser.currentURI.spec) return; + if ( isMatch(event.target.documentURI) ){ + vimperator.addMode(null, vimperator.modes.ESCAPE_ALL_KEYS); + } else { + vimperator.setMode(vimperator.modes.NORMAL); + } + //vimperator.log('load page: ' + gBrowser.selectedBrowser.contentDocument.URL); +},false); +getBrowser().mTabBox.addEventListener('TabSelect',function(event){ + var uri = this.parentNode.currentURI.spec; + if ( isMatch(uri) ){ + vimperator.addMode(null, vimperator.modes.ESCAPE_ALL_KEYS); + } else { + vimperator.setMode(vimperator.modes.NORMAL); + } + //vimperator.log('select page: ' + gBrowser.selectedBrowser.contentDocument.URL); +},false); +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); + } + }); +} +})(); + +// vim: set fdm=marker sw=4 ts=4 et: |