Show
Ignore:
Timestamp:
12/01/08 12:03:49 (6 weeks ago)
Author:
anekos
Message:

Fix event listeners

Files:
1 modified

Legend:

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

    r24173 r25510  
    5555        }, 
    5656        /// On TabSelect (if Gmail Tab), we will give focus to the main canvas. 
    57         isGmail:function(uri, even) 
    58         { 
    59                 if (/^https?:\/\/mail\.google\.com\//.test(uri)) 
    60                 { 
    61                         window.setTimeout(function(){GViMail.focusMainFrame();}, 100); 
    62                 } 
    63         }, 
     57        get isGmail () (/^https?:\/\/mail\.google\.com\//.test(buffer.URL)), 
    6458        /// when you type some key to make an action, habitually, the main canvas looses focus. 
    6559        /// we will add an EventListener on keypress to avoid this. 
     
    156150        function () { GViMail.focusMainFrame(); }); 
    157151getBrowser().mTabBox.addEventListener('TabSelect', function(event){ 
    158  GViMail.isGmail(this.parentNode.currentURI.spec, event); 
     152        if (GViMail.isGmail) 
     153                window.setTimeout(function(){GViMail.focusMainFrame();}, 100); 
    159154 }, false); 
    160 window.addEventListener('keypress', GViMail.preventLooseFocus, true); 
    161  
     155window.addEventListener('keypress', function () { 
     156        if (GViMail.isGmail) 
     157                GViMail.preventLooseFocus(); 
     158}, true); 
    162159if (use_gvimail_css && (typeof liberator.globalVariables.styles == 'undefined' || liberator.globalVariables.styles == '')) 
    163160{