X-Git-Url: https://jfr.im/git/irc/quakenet/qwebirc.git/blobdiff_plain/5f2808af69256656fead748a8c5ee46f41177ce1..326478c2a6e0551be206581287823f5053266461:/js/ui/baseui.js diff --git a/js/ui/baseui.js b/js/ui/baseui.js index cac20c2..a3aec90 100644 --- a/js/ui/baseui.js +++ b/js/ui/baseui.js @@ -93,7 +93,10 @@ qwebirc.ui.BaseUI = new Class({ if(this.active) this.active.deselect(); window.select(); /* calls setActiveWindow */ - document.title = window.name + " - " + this.options.appTitle; + this.updateTitle(window.name + " - " + this.options.appTitle); + }, + updateTitle: function(text) { + document.title = text; }, nextWindow: function(direction) { if(this.windowArray.length == 0 || !this.active) @@ -277,7 +280,7 @@ qwebirc.ui.StandardUI = new Class({ faqWindow: function() { this.addCustomWindow("FAQ", qwebirc.ui.FAQPane, "faqpane", this.uiOptions); }, - urlDispatcher: function(name) { + urlDispatcher: function(name, window) { if(name == "embedded") return ["a", this.embeddedWindow.bind(this)]; @@ -301,44 +304,31 @@ qwebirc.ui.StandardUI = new Class({ } }); -qwebirc.ui.SoundUI = new Class({ +qwebirc.ui.NotificationUI = new Class({ Extends: qwebirc.ui.StandardUI, initialize: function(parentElement, windowClass, uiName, options) { this.parent(parentElement, windowClass, uiName, options); - this.soundInited = false; - this.soundReady = false; + this.__beeper = new qwebirc.ui.Beeper(this.uiOptions); + this.__flasher = new qwebirc.ui.Flasher(this.uiOptions); - this.setBeepOnMention(this.uiOptions.BEEP_ON_MENTION); - }, - soundInit: function() { - if(this.soundInited) - return; - if(!$defined(Browser.Plugins.Flash) || Browser.Plugins.Flash.version < 8) - return; - this.soundInited = true; + this.beep = this.__beeper.beep.bind(this.__beeper); - this.soundPlayer = new qwebirc.sound.SoundPlayer(); - this.soundPlayer.addEvent("ready", function() { - this.soundReady = true; - }.bind(this)); - this.soundPlayer.go(); + this.flash = this.__flasher.flash.bind(this.__flasher); + this.cancelFlash = this.__flasher.cancelFlash.bind(this.__flasher); }, setBeepOnMention: function(value) { if(value) - this.soundInit(); - this.beepOnMention = value; + this.__beeper.soundInit(); + }, + updateTitle: function(text) { + if(this.__flasher.updateTitle(text)) + this.parent(text); }, - beep: function() { - if(!this.soundReady || !this.beepOnMention) - return; - - this.soundPlayer.beep(); - } }); qwebirc.ui.NewLoginUI = new Class({ - Extends: qwebirc.ui.SoundUI, + Extends: qwebirc.ui.NotificationUI, loginBox: function(callbackfn, initialNickname, initialChannels, autoConnect, autoNick) { this.postInitialize(); @@ -360,7 +350,7 @@ qwebirc.ui.QuakeNetUI = new Class({ this.client.exec("/MSG Q whois #" + auth); }.bind(window)]; } - return this.parent(name); + return this.parent(name, window); }, logout: function() { if(!qwebirc.auth.loggedin()) @@ -376,3 +366,5 @@ qwebirc.ui.QuakeNetUI = new Class({ } } }); + +qwebirc.ui.RootUI = qwebirc.ui.QuakeNetUI;