X-Git-Url: https://jfr.im/git/irc/quakenet/qwebirc.git/blobdiff_plain/e20e5a6b73d37ddd1a4c6ded2dcc336e3299fecf..f065bc69f386c2ed1d9548a9199be5539a1fbd70:/js/ui/genericlogin.js diff --git a/js/ui/genericlogin.js b/js/ui/genericlogin.js index 1d7fba6..1693fa3 100644 --- a/js/ui/genericlogin.js +++ b/js/ui/genericlogin.js @@ -24,22 +24,20 @@ qwebirc.ui.ConfirmBox = function(parentElement, callback, initialNickname, initi var nick = new Element("b"); nick.set("text", initialNickname); - var c = initialChannels.split(","); - var ctext; + var c = initialChannels.split(" ")[0].split(","); - if(c.length > 1) { - var last = c.pop(); - ctext = c.join(", ") + " and " + last; - } else { - ctext = c.join(", "); + text.appendChild(document.createTextNode("To connect to IRC and join channel" + ((c.length>1)?"s":"") + " ")); + + for(var i=0;i 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])); + } - var channels = new Element("b"); - channels.set("text", ctext); - - text.appendChild(document.createTextNode("To connect to IRC and join channels ")); - text.appendChild(channels); - if(!autoNick) { text.appendChild(document.createTextNode(" as ")); text.appendChild(nick); @@ -53,17 +51,23 @@ qwebirc.ui.ConfirmBox = function(parentElement, callback, initialNickname, initi var td = new Element("td"); tr.appendChild(td); - var form = new Element("form"); - td.appendChild(form); - var yes = new Element("input", {"type": "submit", "value": "Connect"}); - form.appendChild(yes); - - form.addEvent("submit", function(e) { - new Event(e).stop(); + td.appendChild(yes); + yes.focus(); + yes.addEvent("click", function(e) { parentElement.removeChild(box); callback({"nickname": initialNickname, "autojoin": initialChannels}); }); + + var user = Cookie.read("user") + if(!$defined(user)) { + var auth = new Element("input", {"type": "submit", "value": "Log in"}); + td.appendChild(auth); + auth.addEvent("click", function(e) { + var cookie = Cookie.write("redirect", document.location); + document.location = "./auth/"; + }); + } } qwebirc.ui.LoginBox = function(parentElement, callback, initialNickname, initialChannels) { @@ -144,4 +148,4 @@ qwebirc.ui.LoginBox = function(parentElement, callback, initialNickname, initial chan.set("value", initialChannels); nick.focus(); -} \ No newline at end of file +}