+ return w;
+ },
+ addCustomWindow: function(windowName, class_, cssClass, options) {
+ if(!$defined(options))
+ options = {};
+
+ if(this.customWindows[windowName]) {
+ this.selectWindow(this.customWindows[windowName]);
+ return;
+ }
+
+ var d = this.newCustomWindow(windowName, true);
+ this.customWindows[windowName] = d;
+
+ d.addEvent("close", function() {
+ this.customWindows[windowName] = null;
+ }.bind(this));
+
+ if(cssClass)
+ d.lines.addClass("qwebirc-" + cssClass);
+
+ var ew = new class_(d.lines, options);
+ ew.addEvent("close", function() {
+ d.close();
+ }.bind(this));
+
+ d.setSubWindow(ew);
+ },
+ embeddedWindow: function() {
+ this.addCustomWindow("Add webchat to your site", qwebirc.ui.EmbedWizard, "embeddedwizard", {baseURL: this.options.baseURL, uiOptions: this.uiOptions, optionsCallback: function() {
+ this.optionsWindow();
+ }.bind(this)});
+ },
+ optionsWindow: function() {
+ this.addCustomWindow("Options", qwebirc.ui.OptionsPane, "optionspane", this.uiOptions);
+ },
+ aboutWindow: function() {
+ this.addCustomWindow("About", qwebirc.ui.AboutPane, "aboutpane", this.uiOptions);
+ },
+ privacyWindow: function() {
+ this.addCustomWindow("Privacy policy", qwebirc.ui.PrivacyPolicyPane, "privacypolicypane", this.uiOptions);
+ },
+ feedbackWindow: function() {
+ this.addCustomWindow("Feedback", qwebirc.ui.FeedbackPane, "feedbackpane", this.uiOptions);
+ },
+ faqWindow: function() {
+ this.addCustomWindow("FAQ", qwebirc.ui.FAQPane, "faqpane", this.uiOptions);
+ },
+ urlDispatcher: function(name, window) {
+ if(name == "embedded")
+ return ["a", this.embeddedWindow.bind(this)];
+
+ if(name == "options")
+ return ["a", this.optionsWindow.bind(this)];
+
+ /* doesn't really belong here */
+ if(name == "whois") {
+ return ["span", function(nick) {
+ if(this.uiOptions.QUERY_ON_NICK_CLICK) {
+ window.client.exec("/QUERY " + nick);
+ } else {
+ window.client.exec("/WHOIS " + nick);
+ }
+ }.bind(this)];
+ }
+
+ return null;
+ },
+ tabComplete: function(element) {
+ this.tabCompleter.tabComplete(element);
+ },
+ resetTabComplete: function() {
+ this.tabCompleter.reset();
+ },
+ setModifiableStylesheet: function(name) {
+ this.__styleSheet = new qwebirc.ui.style.ModifiableStylesheet(qwebirc.global.staticBaseURL + "css/" + name + qwebirc.FILE_SUFFIX + ".mcss");
+
+ if($defined(this.options.hue)) {
+ this.setModifiableStylesheetValues(this.options.hue, 0, 0);
+ } else {
+ this.setModifiableStylesheetValues(this.uiOptions.STYLE_HUE, 0, 0);
+ }
+ },
+ setModifiableStylesheetValues: function(hue, saturation, lightness) {
+ if(!$defined(this.__styleSheet))
+ return;
+ this.__styleSheet.set(function(x) {
+ return x.setHue(hue).setSaturation(x.hsb[1] + saturation).setBrightness(x.hsb[2] + lightness);
+ });
+ }
+});
+
+qwebirc.ui.NotificationUI = new Class({
+ Extends: qwebirc.ui.StandardUI,
+ initialize: function(parentElement, windowClass, uiName, options) {
+ this.parent(parentElement, windowClass, uiName, options);
+
+ this.__beeper = new qwebirc.ui.Beeper(this.uiOptions);
+ this.__flasher = new qwebirc.ui.Flasher(this.uiOptions);
+
+ this.beep = this.__beeper.beep.bind(this.__beeper);
+
+ this.flash = this.__flasher.flash.bind(this.__flasher);
+ this.cancelFlash = this.__flasher.cancelFlash.bind(this.__flasher);
+ },
+ setBeepOnMention: function(value) {
+ if(value)
+ this.__beeper.soundInit();
+ },
+ updateTitle: function(text) {
+ if(this.__flasher.updateTitle(text))
+ this.parent(text);
+ },
+ focusChange: function(value) {
+ this.parent(value);
+ this.__flasher.focusChange(value);
+ }
+});
+
+qwebirc.ui.NewLoginUI = new Class({
+ Extends: qwebirc.ui.NotificationUI,
+ loginBox: function(callbackfn, initialNickname, initialChannels, autoConnect, autoNick) {
+ this.postInitialize();
+
+ /* I'd prefer something shorter and snappier! */
+ var w = this.newCustomWindow("Connection details", true, qwebirc.ui.WINDOW_CONNECT);
+ var callback = function(args) {
+ w.close();
+ callbackfn(args);
+ };
+
+ qwebirc.ui.GenericLoginBox(w.lines, callback, initialNickname, initialChannels, autoConnect, autoNick, this.options.networkName);