From: Chris Porter Date: Mon, 11 Aug 2014 18:13:35 +0000 (+0100) Subject: enhancements: X-Git-Url: https://jfr.im/git/irc/quakenet/qwebirc.git/commitdiff_plain/fc38a626f228cb10e6d5b5bf38594a71680944f4?hp=531be34e3f78dae7c41592da98c0a2adeaf68c79 enhancements: bigger more obvious input box, with placeholder text input box now activates on connect # in status window now tells user to type join better connection messages fixes: can now type "/ /wibble" to say "/wibble" /topic now accepts a channel as first arg --- diff --git a/css/colours.css b/css/colours.css index 0661e01..d34a7a2 100644 --- a/css/colours.css +++ b/css/colours.css @@ -106,5 +106,5 @@ } .qwebirc .infocolour { - background-color: #9090ff; + background-color: #d6d6ff; } diff --git a/css/qui.mcss b/css/qui.mcss index 4ce32a5..74a79e7 100644 --- a/css/qui.mcss +++ b/css/qui.mcss @@ -91,10 +91,18 @@ html { .qwebirc-qui .input input.keyboard-input { border: 0px; - margin: 2px 0px 0px 0px; + margin: 0px 0px 0px 0px; + font-size: 1.2em; + padding-left: 4px; + padding-top: 3px; + padding-bottom: 3px; width: 99%; } +.qwebirc-qui .input-flash { + background: #ffdddd; +} + .qwebirc-qui .input input.mobile-input { border: 0px; margin: 2px 0px 0px 0px; diff --git a/js/irc/baseircclient.js b/js/irc/baseircclient.js index e448201..85aa264 100644 --- a/js/irc/baseircclient.js +++ b/js/irc/baseircclient.js @@ -15,7 +15,7 @@ qwebirc.irc.RegisteredCTCPs = { }; qwebirc.irc.BaseIRCClient = new Class({ - Implements: [Options], + Implements: [Options, Events], options: { nickname: "qwebirc" }, @@ -40,11 +40,13 @@ qwebirc.irc.BaseIRCClient = new Class({ }); this.send = this.connection.send.bind(this.connection); - this.connect = this.connection.connect.bind(this.connection); this.disconnect = this.connection.disconnect.bind(this.connection); this.setupGenericErrors(); }, + connect: function() { + this.connection.connect.apply(this.connection); + }, dispatch: function(data) { var message = data[0]; if(message == "connect") { diff --git a/js/irc/commandparser.js b/js/irc/commandparser.js index f684446..d9362ce 100644 --- a/js/irc/commandparser.js +++ b/js/irc/commandparser.js @@ -47,8 +47,16 @@ qwebirc.irc.BaseCommandParser = new Class({ if(line.length == 0) return; - if(line.charAt(0) != "/") + if(line.charAt(0) != "/") { + if (this.getActiveWindow().type == qwebirc.ui.WINDOW_STATUS) { + if(line.charAt(0) != "#") + line = "#" + line; + + this.getActiveWindow().errorMessage("To join a channel type: /JOIN " + line); + return; + } line = "/SAY " + line; + } var line = line.substr(1); var allargs = line.splitMax(" ", 2); diff --git a/js/irc/commands.js b/js/irc/commands.js index 79d0c29..af9fb74 100644 --- a/js/irc/commands.js +++ b/js/irc/commands.js @@ -10,7 +10,8 @@ qwebirc.irc.Commands = new Class({ "Q": "QUERY", "BACK": "AWAY", "PRIVACY": "PRIVACYPOLICY", - "HOP": "CYCLE" + "HOP": "CYCLE", + "": "SAY" }; }, @@ -141,7 +142,12 @@ qwebirc.irc.Commands = new Class({ this.automode("-", "v", args); }], cmd_TOPIC: [true, 1, 1, function(args) { - this.send("TOPIC " + this.getActiveWindow().name + " :" + args[0]); + var w = this.getActiveWindow(); + if(w.client.isChannel(args[0])) { + this.send("TOPIC " + args[0]); + } else { + this.send("TOPIC " + w.name + " :" + args[0]); + } }], cmd_AWAY: [false, 1, 0, function(args) { this.send("AWAY :" + (args?args[0]:"")); diff --git a/js/irc/ircclient.js b/js/irc/ircclient.js index a26ae86..509ce12 100644 --- a/js/irc/ircclient.js +++ b/js/irc/ircclient.js @@ -26,6 +26,10 @@ qwebirc.irc.IRCClient = new Class({ this.loginRegex = new RegExp(this.ui.options.loginRegex); this.tracker = new qwebirc.irc.IRCTracker(this); }, + connect: function() { + this.parent(); + this.newServerInfoLine("CONNECTING", ""); + }, newLine: function(window, type, data) { if(!data) data = {}; @@ -56,6 +60,9 @@ qwebirc.irc.IRCClient = new Class({ newServerLine: function(type, data) { this.statusWindow.addLine(type, data); }, + newServerInfoLine: function(type, data) { + this.statusWindow.infoMessage(type, data); + }, newActiveLine: function(type, data) { this.getActiveWindow().addLine(type, data); }, @@ -225,7 +232,7 @@ qwebirc.irc.IRCClient = new Class({ /* we guarantee that +x is sent out before the joins */ if(this.ui.uiOptions.USE_HIDDENHOST) this.exec("/UMODE +x"); - + if(this.options.autojoin) { if(qwebirc.auth.loggedin() && this.ui.uiOptions.USE_HIDDENHOST) { var d = function() { @@ -241,7 +248,11 @@ qwebirc.irc.IRCClient = new Class({ } this.exec("/AUTOJOIN"); + } else { + var d = function() { this.newServerInfoLine("CONNECTED", ""); }.delay(1000, this); } + + this.fireEvent("signedOn"); }, userJoined: function(user, channel) { var nick = user.hostToNick(); @@ -567,7 +578,7 @@ qwebirc.irc.IRCClient = new Class({ }, connected: function() { qwebirc.connected = true; - this.newServerLine("CONNECT"); + this.newServerInfoLine("CONNECT", ""); }, serverError: function(message) { this.newServerLine("ERROR", {"m": message}); diff --git a/js/ui/baseui.js b/js/ui/baseui.js index ec54d47..0870af7 100644 --- a/js/ui/baseui.js +++ b/js/ui/baseui.js @@ -51,7 +51,9 @@ qwebirc.ui.BaseUI = new Class({ newClient: function(client) { client.id = this.clientId++; client.hilightController = new qwebirc.ui.HilightController(client); - + client.addEvent("signedOn", function() { + this.fireEvent("signedOn", client); + }.bind(this)); this.windows[client.id] = {} this.clients[client.id] = client; var w = this.newWindow(client, qwebirc.ui.WINDOW_STATUS, "Status"); diff --git a/js/ui/baseuiwindow.js b/js/ui/baseuiwindow.js index 5369d1a..f348beb 100644 --- a/js/ui/baseuiwindow.js +++ b/js/ui/baseuiwindow.js @@ -140,8 +140,12 @@ qwebirc.ui.Window = new Class({ errorMessage: function(message) { this.addLine("", message, "warncolour"); }, - infoMessage: function(message) { - this.addLine("", message, "infocolour"); + infoMessage: function(type, message) { + if(message === undefined) { + this.addLine("", type, "infocolour"); + } else { + this.addLine(type, message, "infocolour"); + } }, setHilighted: function(state) { if(state == qwebirc.ui.HILIGHT_NONE || state >= this.hilighted) diff --git a/js/ui/frontends/qui.js b/js/ui/frontends/qui.js index bbbe192..a1af4cf 100644 --- a/js/ui/frontends/qui.js +++ b/js/ui/frontends/qui.js @@ -146,6 +146,19 @@ qwebirc.ui.QUI = new Class({ form.addClass("input"); var inputbox = new Element("input"); + this.addEvent("signedOn", function() { + inputbox.placeholder = "type commands here, for example: /JOIN #channel"; + inputbox.addClass("input-flash"); + var d = function() { + inputbox.removeClass("input-flash"); + }.delay(250); + var d = function() { + inputbox.addClass("input-flash"); + }.delay(500); + var d = function() { + inputbox.removeClass("input-flash"); + }.delay(1250); + }); form.appendChild(inputbox); this.inputbox = inputbox; this.inputbox.maxLength = 470; @@ -157,6 +170,7 @@ qwebirc.ui.QUI = new Class({ this.resetTabComplete(); this.getActiveWindow().historyExec(inputbox.value); inputbox.value = ""; + inputbox.placeholder = ""; }.bind(this); if(!qwebirc.util.deviceHasKeyboard()) { diff --git a/js/ui/theme.js b/js/ui/theme.js index b8b6db3..3a87fd0 100644 --- a/js/ui/theme.js +++ b/js/ui/theme.js @@ -13,7 +13,9 @@ qwebirc.ui.themes.ThemeControlCodeMap = { qwebirc.ui.themes.Default = { "PREFIX": ["$C4==$O "], "SIGNON": ["Signed on!", true], - "CONNECT": ["Connected to server.", true], + "CONNECTING": ["Connecting to server, please wait...", true], + "CONNECT": ["Logging in, please wait...", true], + "CONNECTED": ["Connected and logged in -- ready to go!", true], "RAW": ["$m", true], "DISCONNECT": ["Disconnected from server: $m", true], "ERROR": ["ERROR: $m", true],