Refactoring

This commit is contained in:
Mattias Erming 2014-05-23 01:14:01 +02:00
parent 81d88d4c64
commit a516a1ac12
4 changed files with 13 additions and 101 deletions

View file

@ -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;
}
}

View file

@ -15,33 +15,14 @@
<div id="wrap" class="table">
<aside id="sidebar">
<div id="logo">
<a href="<%= homepage %>" target="_blank">
<img src="/img/play.svg" title="Work in progress" width="122" height="122">
</a>
</div>
<div id="menu">
<button class="btn">
Menu
</button>
<div class="options">
<button class="opt" data-target="#settings">
Settings
</button>
<hr/>
<button class="opt" data-target="#sign-out">
Sign out
</button>
</div>
</div>
<div id="networks"></div>
</aside>
<div id="main">
<div id="windows">
<div id="settings" class="window"></div>
<div id="sign-out" class="window"></div>
<div id="shout" class="window"></div>
</div>
<div id="chat">
</div>
<div id="chat"></div>
</div>
</div>

View file

@ -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")

View file

@ -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;