forked from calebsurface/ProPresenter-OBS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
78 lines (68 loc) · 2.01 KB
/
index.html
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
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="stylesheet.css">
<script type="text/javascript" src="lib/jquery-1.12.0.min.js"></script>
<script type="text/javascript" src="lib/jquery.json.min.js"></script>
<script type="text/javascript" src="lib/jquery.simple.websocket.js"></script>
<script type="text/javascript" src="config.js"></script>
<script type="text/javascript">
//Connect to ProPresenter Remote Stage Display
var webSocket = $.simpleWebSocket({
url: 'ws://' + config['propresenter_ip'] + ':' + config['propresenter_port'] + '/stagedisplay'
});
//Connect and send the password
webSocket.send({
"pwd": config['propresenter_password'],
"ptl": 610,
"acn": "ath"
}).done(function() {
// message send
console.log("SENT AUTH");
}).fail(function(e) {
// error sending
});
prev_text = '';
// reconnected listening
webSocket.listen(function(message) {
/* enable this to view Array of data in the console.
if (message['acn'] != "vid") {
console.log(message);
}
*/
// only parse fv arrays
if (message['acn'] == "fv") {
if (message['ary'][0]['txt'] != undefined) {
var text = '';
// check slide note for noText keyword. If noText is defined dont step into this IF
if (typeof message['ary'][2] !== 'undefined' && message['ary'][2]['txt'] !== config["noText"]) {
// replace carriage return \r and linefeed \n with <br> global
text = message['ary'][0]['txt'].replace(/\r\n|\n|\r/g, '<br />');
// if fading is true and repeated text is true
if (prev_text !== text || config['fade_repeated_text']){
// if fading is true
if (config['fade']){
$("#cs").fadeOut(config["fade_speed"], function(){
$("#cs").html(text);
$("#cs").fadeIn(config["fade_speed"]);
});
// no fade
}else{
$("#cs").html(text);
}
}
// noText keyword was defined on slide note so set #cs to blank
}else{
$("#cs").html("");
}
prev_text = text;
}
}
});
</script>
</head>
<body>
<div id="cs"></div>
</body>
</html>