-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeeder.js
85 lines (69 loc) · 2.25 KB
/
feeder.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
var feeder = {
domain: "ranstey.hydna.net",
channel: "feedme",
synctimer: null,
closetimer: null,
currentchannel: 0,
synced: false,
sensitivity: 5,
feed: function(mychannel) {
console.log('Feeding...');
},
listentohydna: function() {
},
flashbutton: function(direction) {
},
init : function() {
}
};
//hydna stuff
/* var code = parseInt(prompt("Enter slideshow code", ""));
if (!isNaN(code) && code > 1 && code != remote.currentchannel) {
if (remote.channel) {
remote.channel.close();
}
var mychannel = String(code);
$('#loader_id').show();
$('#reconnect_id').hide();
// remote-control
remote.channel = new HydnaChannel(remote.domain+'/'+mychannel, 'rw');
remote.channel.onmessage = function(e) {
switch(e.data) {
case "synced":
clearTimeout(remote.synctimer);
$('#reconnect_id').hide();
$('#swipe_id').show();
$('#loader_id').hide();
break;
}
}
remote.channel.onopen = function(e) {
clearTimeout(remote.closetimer);
remote.currentchannel = code;
remote.channel.send(mychannel);
clearTimeout(remote.synctimer);
remote.synctimer = setTimeout( function() {
$('#reconnect_id').show();
$('#loader_id').hide();
}, 2000);
}
remote.channel.onclose = function(e) {
clearTimeout(remote.closetimer);
remote.closetimer = setTimeout( function() {
$('#reconnect_id').show();
$('#swipe_id').hide();
$('#loader_id').hide();
}, 2000);
}
} else {
if(code != "") {
if (code == remote.currentchannel) {
alert("You are already connected to this channel");
remote.channel.send(String(code));
} else {
alert("Invalid channel");
}
}
}
},
*/