Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial stab at autoupdateing statuses
- Loading branch information
junkafarian
committed
Apr 12, 2012
1 parent
3c69656
commit ce43d99
Showing
4 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var socket = io.connect('http://localhost:3003'); | ||
|
||
function update_or_append_status(username, status) { | ||
$('.status-container[rel='+username+']').each(function (i,el) {el.innerHTML = status.status; console.log(el)}); | ||
} | ||
|
||
socket.on('status_update', function (data) { | ||
var to_update = document.getElementsByClassName("status-container"); | ||
for (var k in data) { | ||
var status = data[k]; | ||
update_or_append_status(status.username, status.status) | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<h1>Current status of all system users</h1> | ||
{{#statuses}} | ||
<p><a href="/status/{{username}}">{{username}}</a>: {{status.status}}</p> | ||
<p><a href="/status/{{username}}">{{username}}</a>: <span class="status-container" rel="{{username}}">{{status.status}}</span></p> | ||
{{/statuses}} |