From cc76a40ad3a001def2f2a9348bad82453d8fd5d6 Mon Sep 17 00:00:00 2001 From: drry Date: Fri, 21 Mar 2008 02:11:34 +0000 Subject: 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 --- autoIgnoreKey.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 autoIgnoreKey.js (limited to 'autoIgnoreKey.js') 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: -- cgit v1.2.3