-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdirectv.js
37 lines (30 loc) · 906 Bytes
/
directv.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
/*
Copyright (c) 2017 Mike Carlton
Released under terms of the MIT license:
http://www.opensource.org/licenses/mit-license
*/
function get(path, message) {
var uri = 'http://' + $('#ip').val() + ':' + $('#port').val() + path
var xhr = new XMLHttpRequest()
xhr.open('GET', uri)
xhr.onload = function(evt) {
if (xhr.status != 200) {
$.growl.error({ 'message': 'Something went wrong, got back status ' + xhr.status,
location: 'br', duration: 10000 })
}
}
xhr.send()
$.growl({ title: message, message: '', location: 'br', duration: 1000 });
}
function tochannel(channel) {
get('/tv/tune?major=' + channel, "Change to channel " + channel)
}
function dotv(self) {
get('/remote/processKey?key=' + self.id, self.textContent)
}
function enterchannel(self) {
tochannel($('#channel').val())
}
function gotochannel(self) {
tochannel(self.id)
}