Changeset 11680

Show
Ignore:
Timestamp:
05/16/08 11:16:46 (14 months ago)
Author:
chiba
Message:

DOMContentLoadedとTabSelectのどちらのイベントでも同様に現在開いている
タブのURLを元に判断するように修正しました。
これは、ignore対象のページを開いているときにほかのタブでDOMContentLoadedイベントが走って意図しないpassAllKeysの解除が起こってしまうのを防ぐためにほどこしました。

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/vimperator-plugins/trunk/autoIgnoreKey.js

    r9171 r11680  
    4040                   + "$", "i")); 
    4141 
    42 document.getElementById('appcontent').addEventListener('DOMContentLoaded',function(event){ 
    43     var uri = event.target.documentURI; 
     42document.getElementById('appcontent').addEventListener('DOMContentLoaded',passAllKeysIfTarget,false); 
     43getBrowser().mTabBox.addEventListener('TabSelect',passAllKeysIfTarget,false); 
     44 
     45function passAllKeysIfTarget() { 
     46    var uri = content.document.documentURI; 
    4447    liberator.modes.passAllKeys = isMatch(uri); 
    4548    //liberator.log('load page: ' + gBrowser.selectedBrowser.contentDocument.URL); 
    46 },false); 
    47  
    48 getBrowser().mTabBox.addEventListener('TabSelect',function(event){ 
    49     var uri = this.parentNode.currentURI.spec; 
    50     liberator.modes.passAllKeys = isMatch(uri); 
    51     //liberator.log('select page: ' + gBrowser.selectedBrowser.contentDocument.URL); 
    52 },false); 
     49} 
    5350 
    5451function isMatch(uri) ignorePagesList.some(function(e) e.test(uri))