From: Chris Porter Date: Wed, 24 Jun 2009 02:38:35 +0000 (+0100) Subject: Fix last position bar position in Firefox 3 and IE6-8, also disable option for Konqueror. X-Git-Url: https://jfr.im/git/irc/quakenet/qwebirc.git/commitdiff_plain/85449eee7cbb5c314a3f615e44474386985c5e2e Fix last position bar position in Firefox 3 and IE6-8, also disable option for Konqueror. --- diff --git a/js/ui/baseui.js b/js/ui/baseui.js index 71c503e..e342d67 100644 --- a/js/ui/baseui.js +++ b/js/ui/baseui.js @@ -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++; diff --git a/js/ui/panes/options.js b/js/ui/panes/options.js index ba90487..221d105 100644 --- a/js/ui/panes/options.js +++ b/js/ui/panes/options.js @@ -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] ];