X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fchatty;a=blobdiff_plain;f=root%2Ftt%2Fchat%2Fview.tt;h=5804093d16a7506a8b7a03ccf722900104e8baea;hp=19fe0c0d4c49d2e0ad9770f95e9d1d9b6b1ae83a;hb=e26179af9aaf7cae5a0aa68ad87a50e4b1e1aba5;hpb=429699124ffcdd7a426b8db4223602639b9163ee diff --git a/root/tt/chat/view.tt b/root/tt/chat/view.tt index 19fe0c0..5804093 100644 --- a/root/tt/chat/view.tt +++ b/root/tt/chat/view.tt @@ -1,9 +1,42 @@ [% META title = 'Live' -%] +[% BLOCK js_include -%] + +[% END -%] [% BLOCK js -%] -$('form').validationEngine(); + Meteor.hostid = '' + Math.floor(999*Math.random()); + Meteor.host = "data."+location.hostname; + Meteor.registerEventCallback("process", addMessage); + Meteor.registerEventCallback("eof", function() { + addMessage("** stream closed **"); + }); + Meteor.registerEventCallback("reset", function() { + addMessage("** stream reset **"); + }); + Meteor.registerEventCallback("changemode", function(mode) { + addMessage("** mode changed to "+mode+" **"); + }); + Meteor.joinChannel("[% room.id %]", 5); + Meteor.mode = 'stream'; + Meteor.connect(); + + function addMessage(line) { + $("#chat").append("

"+line+"

"); + $("#chat").stop().animate({scrollTop:$("#chat").prop("scrollHeight")}, 350); + }; + + $("#submit").click(function(e) { + $.getJSON("", {msg: $("#msg").val()}, + function(data) { + }); + $("#msg").val(""); + e.preventDefault(); + }); + $("#msg").focus(); [% END -%]

Room: [% room.name %]

-[% FOREACH msg IN messages -%] -

[% msg.author.username %] ([% msg.posted %]): [% msg.content %]

-[% END -%] -[% form.render -%] +
+
+ Say your thing: + + +