hyperion.ng/assets/webconfig/effects.html
b1rdhous3 75fd7ed8ba Initial Hue Bridge support & Small changes (#177)
* Initial WebUI with sample functions

* Changed folder structure

* Light Reset Button and Translation fixing in Links

* Indentation fixed

* Reorganized menu and new function for setting effects

* Styling fix

* WebUI Initial Philips Hue support

* Encoding, refactoring etc

* Filename changes

* Typo fix

* Translation cleanup & adding

* Added Favicon

* Edited title
2016-08-15 13:51:41 +02:00

50 lines
1.5 KiB
HTML

<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header" lang="en" data-lang-token="menueffectstoken">Effects</h1>
<div class="col-lg-12" id="buttondiv">
<button type="button" class="btn btn-danger" id="effect_stop"><i class="fa fa-stop"></i></button><span lang="en" data-lang-token="buttoneffectstoptoken"> Stop Effect</span><br />
</div>
</div>
</div>
</div>
<script>
$(document).ready( function() {
webSocket = new WebSocket('ws://'+document.location.hostname+':19444');
var serverInfo;
webSocket.onerror = function(event) {
alert(event.data);
};
webSocket.onopen = function(event) {
webSocket.send('{"command":"serverinfo"}');
};
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;
$('#buttondiv').append('<button type="button" class="btn btn-success" onclick="playEffect(\''+effectName+'\')"><i class="fa fa-play"></i></button> '+effectName+'<br />');
}
}
$("#effect_stop").on("click", function() {
webSocket.send('{"command":"clear", "priority":1}');
});
});
function playEffect(effectName) {
console.log(effectName);
webSocket.send('{"command":"effect","effect":{"name":"'+effectName+'"},"priority":1}');
}
</script>