X-Git-Url: https://jfr.im/git/irc/quakenet/qwebirc.git/blobdiff_plain/144ee52fea86c59ef9773ace65db4f09f7b8c192..326478c2a6e0551be206581287823f5053266461:/js/ui/baseui.js diff --git a/js/ui/baseui.js b/js/ui/baseui.js index a61da84..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) @@ -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();