mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Web: Add simple components control (#203)
This commit is contained in:
42
assets/webconfig/remote_components.html
Normal file
42
assets/webconfig/remote_components.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h1 class="page-header" lang="en" data-lang-token="main_menu_component_token">Effects</h1>
|
||||
<div class="introd">
|
||||
<h4 lang="en" data-lang-token="remote_components_intro">The components remote enables you to disable and enable certain components of Hyperion during runtime. Keep in mind this persist just until the next reboot! To enable/disable components permament, use the configuration section.</h4>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="col-lg-12" id="componentsbutton">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
webSocket = new WebSocket('ws://'+document.location.hostname+':19444');
|
||||
|
||||
new Enum('SMOOTHING', 'BLACKBORDER', 'KODICHECKER', 'FORWARDER', 'UDPLISTENER', 'BOBLIGHT_SERVER','GRABBER');
|
||||
|
||||
function Enum() {
|
||||
for (var i in arguments) {
|
||||
this[arguments[i]] = i;
|
||||
$('#componentsbutton').append('<button type="button" class="btn btn-success" onclick="compenable(\''+arguments[i]+'\')"><i class="fa fa-play"></i></button> '+arguments[i]+'<br />');
|
||||
$('#componentsbutton').append('<button type="button" class="btn btn-danger" onclick="compdisable(\''+arguments[i]+'\')"><i class="fa fa-play"></i></button> '+arguments[i]+'<br />');
|
||||
}
|
||||
}
|
||||
|
||||
function compenable(comp){
|
||||
|
||||
webSocket.send('{"command":"componentstate","componentstate":{"component":"'+comp+'","state":true}}');
|
||||
console.log('enable: '+comp);
|
||||
|
||||
}
|
||||
function compdisable(comp){
|
||||
|
||||
webSocket.send('{"command":"componentstate","componentstate":{"component":"'+comp+'","state":false}}');
|
||||
console.log('disable: '+comp);
|
||||
|
||||
}
|
||||
|
||||
</script>
|
Reference in New Issue
Block a user