forked from azhurb/stalker_portal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxpcom.webkit.js
88 lines (66 loc) · 1.88 KB
/
xpcom.webkit.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
86
87
88
/**
* WebKit STB constructor.
* @constructor
*/
function webkit_xpcom(){
this.StandBy = function(par){
gSTB.StandBy(par);
if (gSTB.SetLedIndicatorMode){
if (par){
gSTB.ExecAction('front_panel led-on');
}else{
gSTB.ExecAction('front_panel led-off');
}
gSTB.SetLedIndicatorMode(par ? 2 : 1);
}
if (gSTB.SetLedIndicatorLevels){
return;
}
_debug('gSTB.RDir(HardwareVersion).substr(0, 3)', gSTB.RDir('HardwareVersion').substr(0, 3));
if (['0.1', '0.2'].indexOf(gSTB.RDir('HardwareVersion').substr(0, 3)) == -1){
if (par){
gSTB.ExecAction('front_panel led-on');
}else{
gSTB.ExecAction('front_panel led-off');
}
}
};
this.setFrontPanel = function(num, use_colon){
_debug('stb.setFrontPanel', num, use_colon);
if (!num){
return;
}
num = num.toString();
var panel = ['.','.','.','.'].map(function(val, idx, arr){
if (num.length < arr.length - idx){
return val;
}else{
return num[num.length - arr.length + idx];
}
}).join('');
try{
gSTB.ExecAction('front_panel caption ' + panel);
if (use_colon){
gSTB.ExecAction('front_panel colon-on');
}else{
gSTB.ExecAction('front_panel colon-off');
}
}catch(e){
}
};
}
var stb;
//try{
var g_stb;
if (typeof(gSTB) == 'undefined'){
g_stb = {};
}else{
g_stb = gSTB;
}
webkit_xpcom.prototype = g_stb;
common_xpcom.prototype = new webkit_xpcom();
stb = new common_xpcom();
//stb.init();
//}catch(e){
// _debug(e)
//}