From a516a1ac12ba544d5c310866013f94345f20aa92 Mon Sep 17 00:00:00 2001 From: Mattias Erming Date: Fri, 23 May 2014 01:14:01 +0200 Subject: [PATCH] Refactoring --- client/css/style.css | 64 ++++---------------------------------------- client/index.html | 25 +++-------------- client/js/chat.js | 15 ----------- lib/server.js | 10 +++---- 4 files changed, 13 insertions(+), 101 deletions(-) diff --git a/client/css/style.css b/client/css/style.css index c23d646..17fc778 100644 --- a/client/css/style.css +++ b/client/css/style.css @@ -75,60 +75,9 @@ button::-moz-focus-inner { padding: 6px 12px; text-transform: uppercase; } -#logo { - margin: 30px 0 30px; - text-align: center; - transition: all .5s; -} -#menu, #networks { margin: 20px; } -#menu hr { - background: #e5e5e5; - border: 0; - height: 1px; - margin: 3px 0; -} -#menu.visible .btn { - border-color: #7f8c8d; - color: #7f8c8d; -} -#menu.visible .options { - display: block; -} -#menu .btn { - width: 100%; -} -#menu .options { - background: #f3f5f5; - border-radius: 3px; - display: none; - margin-top: 15px; -} -#menu .opt { - color: rgba(52, 73, 94, 0.75); - display: block; - font-size: 14px; - font-weight: bold; - padding: 6px 15px 8px; - text-align: left; - transition: all .25s; - width: 100%; -} -#menu .opt.active, -#menu .opt:hover { - background: #e1e4e7; - color: #34495e; -} -#menu .opt:first-child { - border-radius: 3px 3px 0 0; - padding-top: 10px; -} -#menu .opt:last-child { - border-radius: 0 0 3px 3px; - padding-bottom: 10px; -} #networks button { border-radius: 3px; color: #1abc9c; @@ -150,7 +99,7 @@ button::-moz-focus-inner { background-color: #ebedef; color: #526476; } -#networks .network { +#networks .network + .network { border-top: 2px solid #ebedef; margin-top: 14px; padding-top: 14px; @@ -234,6 +183,10 @@ button::-moz-focus-inner { #chat .normal .user, #chat .topic .user { color: #e74c3c; + transition: all .1s; +} +#chat .user:hover { + color: #000; } #chat .action, #chat .action .user { @@ -328,10 +281,3 @@ button::-moz-focus-inner { #chat .count + li .user { padding-top: 8px } - -@media (max-height: 480px) { - #logo { - display: block !important; - margin-top: -135px; - } -} diff --git a/client/index.html b/client/index.html index e830ace..8ea081b 100644 --- a/client/index.html +++ b/client/index.html @@ -15,33 +15,14 @@
-
-
+
+
+
-
diff --git a/client/js/chat.js b/client/js/chat.js index 1dd5b7f..2b2311a 100644 --- a/client/js/chat.js +++ b/client/js/chat.js @@ -92,20 +92,6 @@ $(function() { var networks = $("#networks") .html(render("networks", {networks: data.networks})); - - var target = null; - if (location.hash) { - var id = location.hash; - target = sidebar - .find("button[data-target='" + id + "']"); - } else { - target = sidebar - .find("#networks") - .find("button") - .last() - } - - target.trigger("click"); break; case "part": @@ -129,7 +115,6 @@ $(function() { if (!target) { return; } - location.hash = target; sidebar.find(".active").removeClass("active"); button.addClass("active") .find(".badge") diff --git a/lib/server.js b/lib/server.js index 18b214d..2b88e04 100644 --- a/lib/server.js +++ b/lib/server.js @@ -381,7 +381,6 @@ function event(e, data) { case "kick": var chan = _.findWhere(channels, {name: data.channel}); if (typeof chan === "undefined") { - // TODO: Throw error break; } if (data.client == this.client.me) { @@ -477,7 +476,6 @@ function event(e, data) { case "names": var chan = _.findWhere(channels, {name: data.channel}); if (typeof chan === "undefined") { - // TODO: Throw error break; } chan.users = []; @@ -533,9 +531,13 @@ function event(e, data) { case "notice": var chan = channels[0]; + var from = data.from || "-!-"; + if (data.to == "*" || data.from.indexOf(".") !== -1) { + from = "-!-"; + } var msg = new Msg({ type: "notice", - from: (data.to == "*" ? "-!-" : data.from) || "-!-", + from: from, text: data.message, }); chan.messages.push(msg); @@ -548,7 +550,6 @@ function event(e, data) { case "part": var chan = _.findWhere(channels, {name: data.channels[0]}); if (typeof chan === "undefined") { - // TODO: Throw error break; } if (data.nick == this.client.me) { @@ -600,7 +601,6 @@ function event(e, data) { case "topic": var chan = _.findWhere(channels, {name: data.channel}); if (typeof chan === "undefined") { - // TODO: Throw error break; } var from = data.nick || chan.name;