]> jfr.im git - irc/quakenet/qwebirc.git/commitdiff
Fix last position bar position in Firefox 3 and IE6-8, also disable option for Konqueror.
authorChris Porter <redacted>
Wed, 24 Jun 2009 02:38:35 +0000 (03:38 +0100)
committerChris Porter <redacted>
Wed, 24 Jun 2009 02:38:35 +0000 (03:38 +0100)
js/ui/baseui.js
js/ui/panes/options.js

index 71c503ec04ae15069cd4e8bf7f8cb9a7e884d5b6..e342d67d877d9b786e8e938a594d116beefc0421 100644 (file)
@@ -25,8 +25,28 @@ qwebirc.ui.BaseUI = new Class({
     this.clientId = 0;
     
     this.windowFocused = true;
-    window.addEvent("blur", function() { if(this.windowFocused) { this.windowFocused = false; this.focusChange(false); } }.bind(this));
-    window.addEvent("focus", function() { if(!this.windowFocused) { this.windowFocused = true; this.focusChange(true); } }.bind(this));
+
+    if(Browser.Engine.trident) {
+      var checkFocus = function() {
+        var hasFocus = document.hasFocus();
+        if(hasFocus != this.windowFocused) {
+          this.windowFocused = hasFocus;
+          this.focusChange(hasFocus);
+        }
+      }
+
+      checkFocus.periodical(100, this);
+    } else {
+      var blur = function() { if(this.windowFocused) { this.windowFocused = false; this.focusChange(false); } }.bind(this);
+      var focus = function() { if(!this.windowFocused) { this.windowFocused = true; this.focusChange(true); } }.bind(this);
+
+      /* firefox requires both */
+
+      document.addEvent("blur", blur);
+      window.addEvent("blur", blur);
+      document.addEvent("focus", focus);
+      window.addEvent("focus", focus);
+    }
   },
   newClient: function(client) {
     client.id = this.clientId++;
index ba904871f38639ac2efd0143c502bd67a61ddd98..221d105c1345fe0c70e1ccf92c1b803349b09012 100644 (file)
@@ -2,6 +2,17 @@ qwebirc.config.CHECK_BOX = 1;
 qwebirc.config.TEXT_BOX = 2;
 qwebirc.config.RADIO_BUTTONS = 3;
 
+qwebirc.ui.supportsFocus = function() {
+  var ua = navigator.userAgent;
+  if(!$defined(ua))
+    return [true];
+      
+  if(Browser.Engine.ipod || ua.indexOf("Konqueror") != -1)
+    return [false, false];
+
+  return [true];
+}
+
 qwebirc.config.DEFAULT_OPTIONS = [
   [1, "BEEP_ON_MENTION", "Beep when nick mentioned or on query activity (requires Flash)", true, {
     enabled: function() {
@@ -15,23 +26,16 @@ qwebirc.config.DEFAULT_OPTIONS = [
     }
   }],
   [7, "FLASH_ON_MENTION", "Flash titlebar when nick mentioned or on query activity", true, {
-    enabled: function() {
-      var ua = navigator.userAgent;
-      if(!$defined(ua))
-        return [true];
-        
-      if(Browser.Engine.ipod || ua.indexOf("Konqueror") != -1)
-        return [false, false];
-
-      return [true];
-    }
+    enabled: qwebirc.ui.supportsFocus
   }],
   [2, "DEDICATED_MSG_WINDOW", "Send privmsgs to dedicated messages window", false],
   [4, "DEDICATED_NOTICE_WINDOW", "Send notices to dedicated message window", false],
   [3, "NICK_OV_STATUS", "Show status (@/+) before nicknames in nicklist", true],
   [5, "ACCEPT_SERVICE_INVITES", "Automatically join channels when invited by Q", true],
   [6, "USE_HIDDENHOST", "Hide your hostmask when authed to Q (+x)", true],
-  [8, "LASTPOS_LINE", "Show a last position indicator for each window", true],
+  [8, "LASTPOS_LINE", "Show a last position indicator for each window", true, {
+    enabled: qwebirc.ui.supportsFocus
+  }],
   [9, "NICK_COLOURS", "Automatically colour nicknames", false]
 ];