]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/Meteor/meteorupdater.js
939aed00a0ea53c053a2b86be705a2e65e2619c2
[quix0rs-gnu-social.git] / plugins / Meteor / meteorupdater.js
1 // update the local timeline from a Meteor server
2 //
3
4 var MeteorUpdater = function()
5 {
6     return {
7
8         init: function(server, port, timeline)
9         {
10             var screen_name;
11
12             Meteor.callbacks["process"] = function(data) {
13                 var d = JSON.parse(data);
14                 screen_name = d['user']['screen_name'];
15
16                 if (timeline == 'public' ||
17                     $('address .url')[0].href+screen_name+'/all' == window.location.href ||
18                     $('address .url')[0].href+screen_name == window.location.href) {
19                     RealtimeUpdate.receive(d);
20                 }
21             };
22
23             Meteor.host = server;
24             Meteor.port = port;
25             Meteor.joinChannel(timeline, 0);
26             Meteor.connect();
27         }
28     }
29 }();
30