2016-08-16 00:20:31 +02:00
< div class = "container-fluid" >
2016-08-13 20:05:01 +02:00
< div class = "row" >
< div class = "col-lg-12" >
2016-08-16 00:20:31 +02:00
< h1 class = "page-header" lang = "en" data-lang-token = "main_menu_effects_token" > Effects< / h1 >
< div class = "introd" >
< h4 lang = "en" data-lang-token = "remote_effects_intro" > The Effects remote enables you to set an effect for testing or demonstration purposes. Don't forget to stop it afterwards.< / h4 >
< / div >
< hr >
2016-08-13 20:05:01 +02:00
< div class = "col-lg-12" id = "buttondiv" >
2016-08-16 00:20:31 +02:00
< button type = "button" class = "btn btn-danger" id = "effect_stop" > < i class = "fa fa-stop" > < / i > < / button > < span lang = "en" data-lang-token = "remote_effects_label_stopeffect" > Stop Effect< / span > < br / >
2016-08-13 20:05:01 +02:00
< / div >
2016-08-15 13:51:41 +02:00
< / div >
< / div >
2016-08-13 20:05:01 +02:00
< / div >
< script >
$(document).ready( function() {
2016-08-18 21:14:50 +02:00
2016-08-13 20:05:01 +02:00
webSocket = new WebSocket('ws://'+document.location.hostname+':19444');
var serverInfo;
2016-08-18 21:14:50 +02:00
2016-08-13 20:05:01 +02:00
webSocket.onerror = function(event) {
alert(event.data);
};
2016-08-18 21:14:50 +02:00
2016-08-13 20:05:01 +02:00
webSocket.onopen = function(event) {
webSocket.send('{"command":"serverinfo"}');
};
2016-08-18 21:14:50 +02:00
2016-08-13 20:05:01 +02:00
webSocket.onmessage = function(response){
responseJSON = JSON.parse(response.data );
//console.log(response.data);
for(i = 0; i < responseJSON.info.effects.length ; i + + ) {
//console.log(responseJSON.info.effects[i].name);
var effectName = responseJSON.info.effects[i].name;
2016-08-18 21:14:50 +02:00
2016-08-13 20:05:01 +02:00
$('#buttondiv').append('< button type = "button" class = "btn btn-success" onclick = "playEffect(\''+effectName+'\')" > < i class = "fa fa-play" > < / i > < / button > '+effectName+'< br / > ');
}
}
2016-08-18 21:14:50 +02:00
2016-08-13 20:05:01 +02:00
$("#effect_stop").on("click", function() {
2016-08-18 21:14:50 +02:00
webSocket.send('{"command":"clear", "priority":1}');
2016-08-13 20:05:01 +02:00
});
});
2016-08-18 21:14:50 +02:00
2016-08-13 20:05:01 +02:00
function playEffect(effectName) {
console.log(effectName);
webSocket.send('{"command":"effect","effect":{"name":"'+effectName+'"},"priority":1}');
2016-08-18 21:14:50 +02:00
}
2016-08-13 20:05:01 +02:00
2016-08-18 21:14:50 +02:00
< / script >