From 5881c37fc4388a22cbe4699ac0e168fc40df0c6e Mon Sep 17 00:00:00 2001 From: chiba Date: Fri, 16 May 2008 02:16:46 +0000 Subject: DOMContentLoadedとTabSelectのどちらのイベントでも同様に現在開いている タブのURLを元に判断するように修正しました。 これは、ignore対象のページを開いているときにほかのタブでDOMContentLoadedイベントが走って意図しないpassAllKeysの解除が起こってしまうのを防ぐためにほどこしました。 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@11680 d0d07461-0603-4401-acd4-de1884942a52 --- autoIgnoreKey.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'autoIgnoreKey.js') diff --git a/autoIgnoreKey.js b/autoIgnoreKey.js index eb48465..8dc4ca1 100644 --- a/autoIgnoreKey.js +++ b/autoIgnoreKey.js @@ -39,17 +39,14 @@ const ignorePagesList = window.eval(liberator.globalVariables.autoignorekey_page .replace(/(?=\*)/g, ".") + "$", "i")); -document.getElementById('appcontent').addEventListener('DOMContentLoaded',function(event){ - var uri = event.target.documentURI; - liberator.modes.passAllKeys = isMatch(uri); - //liberator.log('load page: ' + gBrowser.selectedBrowser.contentDocument.URL); -},false); +document.getElementById('appcontent').addEventListener('DOMContentLoaded',passAllKeysIfTarget,false); +getBrowser().mTabBox.addEventListener('TabSelect',passAllKeysIfTarget,false); -getBrowser().mTabBox.addEventListener('TabSelect',function(event){ - var uri = this.parentNode.currentURI.spec; +function passAllKeysIfTarget() { + var uri = content.document.documentURI; liberator.modes.passAllKeys = isMatch(uri); - //liberator.log('select page: ' + gBrowser.selectedBrowser.contentDocument.URL); -},false); + //liberator.log('load page: ' + gBrowser.selectedBrowser.contentDocument.URL); +} function isMatch(uri) ignorePagesList.some(function(e) e.test(uri)) -- cgit v1.2.3