Skip to content

Commit

Permalink
style fixes for web view
Browse files Browse the repository at this point in the history
  • Loading branch information
esamattis committed Mar 10, 2012
1 parent d2c6209 commit 1817371
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 13 deletions.
22 changes: 14 additions & 8 deletions web/client/main.coffee
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

`function strip(html)
{
var tmp = document.createElement("DIV");
tmp.innerHTML = html;
return tmp.textContent||tmp.innerText;
}`
helperDiv = document.createElement("DIV")
strip = (html) ->
helperDiv.innerHTML = html
helperDiv.textContent || tmp.innerText


class LightSimulator extends Backbone.View

Expand All @@ -24,7 +23,7 @@ class LightSimulator extends Backbone.View
apply: (cmd) ->
cssValue = "rgb(#{ cmd.r }, #{ cmd.g }, #{ cmd.b })"
@$el.css "background-color", cssValue
@valueDisplay.innerHTML = cssValue
@valueDisplay.innerHTML = "#{ cmd.r }, #{ cmd.g }, #{ cmd.b }"


class Log extends Backbone.View
Expand Down Expand Up @@ -86,9 +85,16 @@ $ ->

socket.on "cmds", (msg, a) ->
for lightpacket in msg.cmds

if msg.error
logError.log "#{ prettifyMsg msg }: Error: #{ JSON.stringify msg }"
continue

if l = lights[lightpacket.id]
l.apply lightpacket.cmd
logInfo.log "#{ prettifyMsg msg }: #{ JSON.stringify lightpacket }"
{r, g, b} = lightpacket.cmd

logInfo.log "#{ prettifyMsg msg }: id #{ lightpacket.id } - RGB #{ r } #{ g } #{ b }"
else
logError.log "#{ prettifyMsg msg }: Unkown light id #{ lightpacket.id }"

Expand Down
4 changes: 4 additions & 0 deletions web/client/style.styl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

a:visited, a
color lightblue

header
p
Expand All @@ -16,10 +18,12 @@ body
margin-bottom 0px
.info
float left
width 45%
margin-right 0px
.error
float left
color red
width 45%
margin-right 5em


Expand Down
3 changes: 2 additions & 1 deletion web/views/client/light.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</td>

</tr>

<!--
<tr>
<th> DMX-Address </th>
<td class="adress">
Expand All @@ -31,6 +31,7 @@
{{dipConfig}}
</td>
</tr>
-->

<tr>
<th> RGB value</th>
Expand Down
16 changes: 12 additions & 4 deletions web/views/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<p>

Valoja kuunnellaan koneen 192.168.10.1 portissa {{udpPort}}
Valot kuuntelevat UDP-paketteja koneen 192.168.10.1 portissa {{udpPort}}

</p>

Expand All @@ -14,6 +14,10 @@ Yksinkertainen koodiesimerkki löytyy <a href="https://github.com/epeli/effectse

</p>

<p>
<a href="#log">Debug logi löytyy sivun alalaidasta.</a>
</p>

<p>

Käyttäkää vapaasti, mutta muistakaa, että pitkästä while(1){}:stä saa
Expand All @@ -31,14 +35,18 @@ ip-bannin. Kaikkien pitää saada leikkiä! :)

<div class=clear></div>

<h2 id=log >Debug log</h2>

<div class=log >

<div class=error>
<div class=info>
logi...
</div>


<div class=info>
<div class=error>
virheet...
</div>



</div>

0 comments on commit 1817371

Please sign in to comment.