Improved rendering speed

This commit is contained in:
Mattias Erming 2014-05-04 02:33:05 +02:00
parent ea543e90e1
commit 81b75086d4
3 changed files with 71 additions and 42 deletions

View File

@ -11,6 +11,12 @@ h1,
h2 { h2 {
margin: 0; margin: 0;
} }
ul,
li {
list-style: none;
margin: 0;
padding: 0;
}
a { a {
color: #1abc9c; color: #1abc9c;
text-decoration: none; text-decoration: none;
@ -133,6 +139,20 @@ button::-moz-focus-inner {
font: 13px "Consolas", monospace; font: 13px "Consolas", monospace;
height: 100%; height: 100%;
} }
#chat form {
bottom: 0;
height: 35px;
position: absolute;
right: 0;
left: 0;
}
#chat form .input {
border: 0;
border-top: 1px solid #bdc3c7;
height: 35px;
padding: 0 10px;
width: 100%;
}
#chat .lobby .messages, #chat .lobby .messages,
#chat .query .messages { #chat .query .messages {
right: 0; right: 0;
@ -235,27 +255,25 @@ button::-moz-focus-inner {
right: 0; right: 0;
width: 160px; width: 160px;
} }
#chat .users li {
display: table-row;
text-align: left;
}
#chat .users .user { #chat .users .user {
display: block;
padding: 4px 12px; padding: 4px 12px;
text-align: left;
width: 160px;
} }
#chat .count { #chat .count {
background: #ecf0f1; background: #ecf0f1;
color: #aeb6bf; color: #aeb6bf;
margin-bottom: 4px; margin-bottom: 4px;
}
#chat .count span {
display: block;
padding: 10px 12px; padding: 10px 12px;
} }
#chat .form { #chat .count + li .user {
bottom: 0; padding-top: 8px
height: 35px;
position: absolute;
right: 0;
left: 0;
}
#chat .input {
border: 0;
border-top: 1px solid #bdc3c7;
height: 35px;
padding: 0 10px;
width: 100%;
} }

View File

@ -58,51 +58,59 @@
{{#each windows}} {{#each windows}}
<div id="window-{{id}}" class="window {{type}}"> <div id="window-{{id}}" class="window {{type}}">
<div class="chat"> <div class="chat">
<div class="messages"> <ul class="messages">
<div class="show-more"> <li class="show-more">
<button class="btn">Show more</button> <button class="btn">Show more</button>
</div> </li>
{{partial "messages"}} {{partial "messages"}}
</div> </ul>
<div class="users"> <ul class="users">
{{partial "users"}} {{partial "users"}}
</ul>
</div> </div>
</div> <form onSubmit="return false" data-target="{{id}}">
<form class="form" onSubmit="return false" data-target="{{id}}"> <input class="input">
<input type="text" class="input">
</form> </form>
</div> </div>
{{/each}} {{/each}}
</script> </script>
<script type="text/html" class="users"> <script type="text/html" class="users">
<div class="count"> <li class="count">
Users: {{users.length}} <span>
</div> Users:
{{users.length}}
</span>
</li>
{{#each users}} {{#each users}}
<li>
<button class="user"> <button class="user">
{{mode}}{{name}} {{mode}}{{name}}
</button> </button>
</li>
{{/each}} {{/each}}
</script> </script>
<script type="text/html" class="messages"> <script type="text/html" class="messages">
{{#slice messages limit=100}} {{#slice messages limit=100}}
<div class="msg {{type}}"> <li class="msg {{type}}">
<span class="from"> <span class="from">
<button class="user">{{from}}</button> <button class="user">
{{from}}
</button>
</span> </span>
<span class="text"> <span class="text">
{{#if type}} {{#if type}}
<em class="type">{{type}}</em> <em class="type">
{{type}}
</em>
{{/if}} {{/if}}
{{{uri text}}} {{{uri text}}}
</span> </span>
<span class="time"> <span class="time">
{{time}} {{time}}
</span> </span>
</div> </li>
{{/slice}} {{/slice}}
</script> </script>
</div> </div>

View File

@ -138,6 +138,8 @@ function input(data) {
user = client.me; user = client.me;
client.send(args[1], text); client.send(args[1], text);
} }
var chan = _.findWhere(network.channels, {name: args[1]});
if (typeof chan !== "undefined") {
var msg = new Msg({ var msg = new Msg({
from: user, from: user,
text: text, text: text,
@ -147,6 +149,7 @@ function input(data) {
id: chan.id, id: chan.id,
msg: msg, msg: msg,
}); });
}
break; break;
case "notice": case "notice":