diff options
author | anekos | 2008-12-01 03:03:49 +0000 |
---|---|---|
committer | anekos | 2008-12-01 03:03:49 +0000 |
commit | 8f348054e218bdb778bb8d3cffbc6dbf342c7e8e (patch) | |
tree | ff1540cdbb3a3ce38a0198eb9577d7d75c85a3ee | |
parent | 0e8d65f2ca815d3000f4f4b7e9ac55cff2df10aa (diff) | |
download | vimperator-plugins-8f348054e218bdb778bb8d3cffbc6dbf342c7e8e.tar.bz2 |
Fix event listeners
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@25510 d0d07461-0603-4401-acd4-de1884942a52
-rw-r--r-- | gvimail.js | 17 |
1 files changed, 7 insertions, 10 deletions
@@ -54,13 +54,7 @@ GViMail.getMainCanvas().contentWindow.focus();
},
/// On TabSelect (if Gmail Tab), we will give focus to the main canvas.
- isGmail:function(uri, even)
- {
- if (/^https?:\/\/mail\.google\.com\//.test(uri))
- {
- window.setTimeout(function(){GViMail.focusMainFrame();}, 100);
- }
- },
+ get isGmail () (/^https?:\/\/mail\.google\.com\//.test(buffer.URL)),
/// when you type some key to make an action, habitually, the main canvas looses focus.
/// we will add an EventListener on keypress to avoid this.
preventLooseFocus:function()
@@ -155,10 +149,13 @@ mappings.addUserMap(GViMail.modes, ["zf"], "Focus main frame",
function () { GViMail.focusMainFrame(); });
getBrowser().mTabBox.addEventListener('TabSelect', function(event){
- GViMail.isGmail(this.parentNode.currentURI.spec, event);
+ if (GViMail.isGmail)
+ window.setTimeout(function(){GViMail.focusMainFrame();}, 100);
}, false);
-window.addEventListener('keypress', GViMail.preventLooseFocus, true);
-
+window.addEventListener('keypress', function () {
+ if (GViMail.isGmail)
+ GViMail.preventLooseFocus();
+}, true);
if (use_gvimail_css && (typeof liberator.globalVariables.styles == 'undefined' || liberator.globalVariables.styles == ''))
{
liberator.globalVariables.styles = 'style,gvimail';
|