1 [% META title = 'Live' -%]
2 [% BLOCK js_include -%]
3 <script type="text/javascript" src="http://data.chatty.com/meteor.js"></script>
6 Meteor.hostid = '' + Math.floor(999*Math.random());
7 Meteor.host = "data."+location.hostname;
8 Meteor.registerEventCallback("process", addMessage);
9 Meteor.registerEventCallback("eof", function() {
10 addMessage("** stream closed **");
12 Meteor.registerEventCallback("reset", function() {
13 addMessage("** stream reset **");
15 Meteor.registerEventCallback("changemode", function(mode) {
16 addMessage("** mode changed to "+mode+" **");
18 Meteor.joinChannel("[% room.id %]", 5);
19 Meteor.mode = 'stream';
22 function addMessage(line) {
23 $("#chat").append("<p>"+line+"</p>");
24 $("#chat").stop().animate({scrollTop:$("#chat").prop("scrollHeight")}, 350);
27 $("#submit").click(function(e) {
28 $.getJSON("", {msg: $("#msg").val()},
36 <h1>Room: [% room.name %]</h1>
37 <div id="chat" style="height: 300px; overflow: auto"></div>
39 <i>Say your thing:</i>
40 <input id="msg" type="input"></input>
41 <input id="submit" type="submit" value="Send"></input>