aboutsummaryrefslogtreecommitdiffstats
path: root/autoIgnoreKey.js
diff options
context:
space:
mode:
authorchiba2008-05-16 02:16:46 +0000
committerchiba2008-05-16 02:16:46 +0000
commit5881c37fc4388a22cbe4699ac0e168fc40df0c6e (patch)
treec45b4cc86c039012f109c94a4bb085f8c4b90c0a /autoIgnoreKey.js
parent89662cf1f4c888c72618780f9202f65866319d33 (diff)
downloadvimperator-plugins-5881c37fc4388a22cbe4699ac0e168fc40df0c6e.tar.bz2
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
Diffstat (limited to 'autoIgnoreKey.js')
-rw-r--r--autoIgnoreKey.js15
1 files changed, 6 insertions, 9 deletions
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))