this.windowArray = [];
} else {
var index = this.windowArray.indexOf(window);
- if(index == 0) {
+ if(index == -1) {
+ return;
+ } else if(index == 0) {
this.selectWindow(this.windowArray[1]);
} else {
this.selectWindow(this.windowArray[index - 1]);
return null;
}
});
+
+var NewLoginUI = new Class({
+ Extends: UI,
+ loginBox: function(callbackfn, initialNickname, initialChannels, autoConnect, autoNick) {
+ this.postInitialize();
+ var w = this.newCustomWindow("Connect", true, WINDOW_CONNECT);
+ var callback = function(args) {
+ w.close();
+ callbackfn(args);
+ };
+
+ GenericLoginBox(w.lines, callback, initialNickname, initialChannels, autoConnect, autoNick);
+ }
+});
this.lines = new Element("div", {styles: {overflow: "auto", "width": "90"}});
- this.form = new Element("form");
- this.inputbox = new Element("input", {styles: {border: 0, width: "100%"}});
- this.inputbox.addClass("input");
-
- this.inputbox.addEvent("focus", function() {
- /* TODO: bring to top */
- //alert(":O");
- //alert(this.windowObject.windowEl);
- //MochaUI.focusWindow.pass(this.windowObject.windowEl, this.windowObject);
- //this.windowObject.focusWindow();
- this.parentObject.selectWindow(this);
- }.bind(this));
-
- this.form.addEvent("submit", function(e) {
- new Event(e).stop();
-
- this.client.exec(this.inputbox.value);
- this.inputbox.value = "";
- }.bind(this));
- //this.container.appendChild(form);
- this.form.appendChild(this.inputbox);
+ var toolbar = type != WINDOW_CUSTOM && type != WINDOW_CONNECT;
+
+ if(toolbar) {
+ this.form = new Element("form");
+ this.inputbox = new Element("input", {styles: {border: 0, width: "100%"}});
+ this.inputbox.addClass("input");
+
+ this.inputbox.addEvent("focus", function() {
+ /* TODO: bring to top */
+ //alert(":O");
+ //alert(this.windowObject.windowEl);
+ //MochaUI.focusWindow.pass(this.windowObject.windowEl, this.windowObject);
+ //this.windowObject.focusWindow();
+ this.parentObject.selectWindow(this);
+ }.bind(this));
+
+ this.form.addEvent("submit", function(e) {
+ new Event(e).stop();
+
+ this.client.exec(this.inputbox.value);
+ this.inputbox.value = "";
+ }.bind(this));
+ //this.container.appendChild(form);
+ this.form.appendChild(this.inputbox);
+ }
var prefs = {
width: 800,
height: 400,
title: name,
footerHeight: 0,
- toolbar: true,
container: $("pageWrapper"),
toolbarHeight: parentObject.inputHeight,
toolbarPosition: "bottom",
}.bind(this)
};
- if(type == WINDOW_STATUS)
- prefs.closable = false;
+ prefs.toolbar = toolbar;
+ prefs.closable = type != WINDOW_STATUS && type != WINDOW_CONNECT;
/* HACK */
/* var oldIndexLevel = MochaUI.Windows.indexLevel;
}
*/
var nw = new MochaUI.Window(prefs);
+ this.window = nw;
/*if(!focus) {
MochaUI.Windows.indexLevel = oldIndexLevel;
}*/
/* HACK */
- var toolbar = $(nw.options.id + "_toolbar");
+ if(toolbar) {
+ var toolbar = $(nw.options.id + "_toolbar");
+ toolbar.appendChild(this.form);
+ }
this.titleText = $(nw.options.id + "_title");
this.tabText = $(nw.options.id + "_dockTabText");
/*alert(toolbar.parentNode.getStyle("background"));*/
/*this.inputbox.setStyle("background", toolbar.parentNode.getStyle("background"));*/
- toolbar.appendChild(this.form);
this.windowObject = nw;
this.scroller = this.lines.parentNode.parentNode;
select: function() {
this.parent();
- this.inputbox.focus();
+ if(this.inputbox)
+ this.inputbox.focus();
},
setHilighted: function(state) {
this.parent(state);
this.tabText.setStyle("background-color", null);
this.tabText.setStyle("color", null);
}
- }
+ },
+ close: function() {
+ this.parent();
+
+ MochaUI.closeWindow(this.window.windowEl);
+ },
});
var QMochaUI = new Class({
- Extends: UI,
+ Extends: NewLoginUI,
initialize: function(parentElement, theme) {
this.parent(parentElement, QMochaUIWindow, "mochaui");
this.theme = theme;
this.parentElement.appendChild(form);
form.appendChild(inputbox);
inputbox.focus();
- },
- loginBox: function(callbackfn, intialNickname, initialChannels, autoConnect, autoNick) {
- this.parent(function(options) {
- this.postInitialize();
- callbackfn(options);
- }.bind(this), intialNickname, initialChannels, autoConnect);
}
});
parentObject.tabPanel.appendChild(this.tab);
parentObject.resize();
- if(type != WINDOW_STATUS) {
+ if(type != WINDOW_STATUS && type != WINDOW_CONNECT) {
tabclose = new Element("span");
tabclose.addClass("tabclose");
tabclose.addEvent("click", function(e) {
this.parentObject.resize();
this.tab.removeClass("tab-unselected");
this.tab.addClass("tab-selected");
+ this.parentObject.showInput(this.type == WINDOW_CONNECT || this.type == WINDOW_CUSTOM);
},
deselect: function() {
this.parent();
});
var SWMUI = new Class({
- Extends: UI,
+ Extends: NewLoginUI,
initialize: function(parentElement, theme) {
this.parent(parentElement, SWMUIWindow, "swmui");
this.resize();
},
+ showInput: function(state) {
+ this.entryPanel.setHidden(state);
+ this.resize();
+ },
resize: function() {
window.fireEvent("resize");
- },
- loginBox: function(callback, initialNickname, initialChannels, autoConnect) {
- this.parent(function(options) {
- this.postInitialize();
- callbackfn(options);
- }.bind(this), intialNickname, initialChannels, autoConnect);
}
});
parentObject.tabs.appendChild(this.tab);
- if(type != WINDOW_STATUS) {
+ if(type != WINDOW_STATUS && type != WINDOW_CONNECT) {
tabclose = new Element("span");
tabclose.addClass("tabclose");
tabclose.addEvent("click", function(e) {
this.outerContainer.removeClass("tab-invisible");
this.tab.removeClass("tab-unselected");
this.tab.addClass("tab-selected");
+ this.parentObject.showInput(this.type != WINDOW_CONNECT && this.type != WINDOW_CUSTOM);
},
deselect: function() {
this.parent();
});
var UglyUI = new Class({
- Extends: UI,
+ Extends: NewLoginUI,
initialize: function(parentElement, theme) {
this.parent(parentElement, UglyUIWindow, "uglyui");
this.theme = theme;
this.parentElement.appendChild(this.container);
var form = new Element("form");
+ this.form = form;
+
var inputbox = new Element("input");
inputbox.addClass("input");
form.appendChild(inputbox);
inputbox.focus();
},
- loginBox: function(callbackfn, intialNickname, initialChannels, autoConnect, autoNick) {
- this.parent(function(options) {
- this.postInitialize();
- callbackfn(options);
- }.bind(this), intialNickname, initialChannels, autoConnect, autoNick);
+ showInput: function(state) {
+ this.form.setStyle("display", state?"block":"none");
}
});