Skip to content
This repository has been archived by the owner on Feb 20, 2019. It is now read-only.

Commit

Permalink
Only show page ids
Browse files Browse the repository at this point in the history
  • Loading branch information
ahultgren committed Apr 15, 2015
1 parent 9aa2c4a commit e2631af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions source/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

var socket = new WebSocket('ws://localhost:8080');
var thematrix = require('./thematrix');
var allowedMessages = ['LoadArticle', 'pageview', 'articleseen'];

socket.onmessage = (e) => {
console.log(e.data);
thematrix.draw(e.data.split('|'));
var data = e.data.split('|');

if(allowedMessages.indexOf(data[0]) > -1) {
thematrix.draw(data);
}
};

socket.onopen = () => console.log('Connected');
Expand Down
2 changes: 1 addition & 1 deletion source/js/thematrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var createCol = (text) => {

col.css({
left: Math.floor(Math.random() * width),
top: Math.floor(Math.random() * height)
top: Math.floor(Math.random() * height * 0.66)
});

killWhenDone(col, text.length);
Expand Down

0 comments on commit e2631af

Please sign in to comment.