- var tbody = new Element("tbody");
- box.appendChild(tbody);
-
- var tr = new Element("tr");
- tbody.appendChild(tr);
- tr.addClass("tr1");
-
- var text = new Element("td");
- tr.appendChild(text);
-
- var nick = new Element("b");
- nick.set("text", initialNickname);
-
- var c = initialChannels.split(" ")[0].split(",");
-
- text.appendChild(document.createTextNode("To connect to " + networkName + " IRC and join channel" + ((c.length>1)?"s":"") + " "));
-
- for(var i=0;i<c.length;i++) {
- if((c.length > 1) && (i == c.length - 1)) {
- text.appendChild(document.createTextNode(" and "));
- } else if(i > 0) {
- text.appendChild(document.createTextNode(", "));
- }
- text.appendChild(new Element("b").set("text", c[i]));
-
- }
-
- if(!autoNick) {
- text.appendChild(document.createTextNode(" as "));
- text.appendChild(nick);
- }
-
- text.appendChild(document.createTextNode(" click 'Connect'."));
- text.appendChild(new Element("br"));
- if(qwebirc.auth.enabled() && qwebirc.auth.quakeNetAuth() && !qwebirc.auth.loggedin())
- text.appendChild(document.createTextNode("If you'd like to connect using your Q auth click 'Log in'."));
-
- var tr = new Element("tr");
- tbody.appendChild(tr);
- tr.addClass("tr2");
-
- var td = new Element("td");
- tr.appendChild(td);
-
- var yes = new Element("input", {"type": "submit", "value": "Connect"});
- td.appendChild(yes);
- yes.focus();
- yes.addEvent("click", function(e) {
- parentElement.removeChild(outerbox);
- callback({"nickname": initialNickname, "autojoin": initialChannels});
- });
-
- if(qwebirc.auth.enabled() && qwebirc.auth.quakeNetAuth() && !qwebirc.auth.loggedin()) {
- var auth = new Element("input", {"type": "submit", "value": "Log in"});
- td.appendChild(auth);
- auth.addEvent("click", qwebirc.ui.AuthLogin);
- }
-}
+ var box = (autoConnect ? "confirm" : "login");
+ var rootElement = parent.getElement("[name=" + box + "box]");
+ this.rootElement = rootElement;
+
+ this.util.exec = function(n, x) { rootElement.getElements(n).each(x); };
+ var util = this.util;
+ var exec = util.exec;
+ util.makeVisible(rootElement);
+
+ exec("[name=nickname]", util.setText(initialNickname));
+ exec("[name=channels]", util.setText(initialChannels));
+ exec("[name=prettychannels]", function(node) { this.__buildPrettyChannels(node, initialChannels); }.bind(this));
+ exec("[name=networkname]", util.setText(networkName));
+
+ var focus = "connect";
+ if(autoConnect) {
+ if(!autoNick)
+ exec("[name=nickselected]", util.makeVisible);
+
+ this.__validate = this.__validateConfirmData;
+ } else {
+ if(!initialNickname) {
+ focus = "nickname";
+ } else if(initialNickname && !initialChannels) {
+ focus = "channels";
+ }