hyperion.ng/assets/webconfig/js/content_index.js

123 lines
2.9 KiB
JavaScript
Raw Normal View History

$(document).ready( function() {
loadContentTo("#container_connection_lost","connection_lost");
loadContentTo("#container_restart","restart");
initWebSocket();
$(hyperion).on("cmd-serverinfo",function(event){
serverInfo = event.response.info;
// comps
comps = event.response.info.components
2018-12-27 23:11:32 +01:00
$(hyperion).trigger("ready");
2018-12-27 23:11:32 +01:00
comps.forEach( function(obj) {
if (obj.name == "ALL")
{
if(obj.enabled)
$("#hyperion_disabled_notify").fadeOut("fast");
else
$("#hyperion_disabled_notify").fadeIn("fast");
}
});
2018-12-27 23:11:32 +01:00
if (serverInfo.hyperion.enabled)
2017-04-07 21:33:40 +02:00
$("#hyperion_disabled_notify").fadeOut("fast");
2018-12-27 23:11:32 +01:00
else
$("#hyperion_disabled_notify").fadeIn("fast");
2018-12-27 23:11:32 +01:00
updateSessions();
}); // end cmd-serverinfo
2018-12-27 23:11:32 +01:00
$(hyperion).on("cmd-sessions-update", function(event) {
serverInfo.sessions = event.response.data;
updateSessions();
});
$(hyperion).on("cmd-sysinfo", function(event) {
requestServerInfo();
sysInfo = event.response.info;
2017-04-07 21:33:40 +02:00
currentVersion = sysInfo.hyperion.version;
});
2018-12-27 23:11:32 +01:00
$(hyperion).one("cmd-config-getschema", function(event) {
2018-12-27 23:11:32 +01:00
serverSchema = event.response.info;
requestServerConfig();
2018-12-27 23:11:32 +01:00
schema = serverSchema.properties;
});
$(hyperion).on("cmd-config-getconfig", function(event) {
2018-12-27 23:11:32 +01:00
serverConfig = event.response.info;
requestSysInfo();
2018-12-27 23:11:32 +01:00
showOptHelp = serverConfig.general.showOptHelp;
});
$(hyperion).on("cmd-config-setconfig", function(event) {
if (event.response.success === true) {
$('#hyperion_config_write_success_notify').fadeIn().delay(5000).fadeOut();
}
});
$(hyperion).on("error",function(event){
showInfoDialog("error","Error", event.reason);
});
$(hyperion).on("open",function(event){
requestServerConfigSchema();
});
2018-12-27 23:11:32 +01:00
$(hyperion).one("ready", function(event) {
loadContent();
});
2018-12-27 23:11:32 +01:00
$(hyperion).on("cmd-adjustment-update", function(event) {
serverInfo.adjustment = event.response.data
});
$(hyperion).on("cmd-videomode-update", function(event) {
serverInfo.videomode = event.response.data.videomode
});
$(hyperion).on("cmd-components-update", function(event) {
let obj = event.response.data
// notfication in index
if (obj.name == "ALL")
{
if(obj.enabled)
2018-12-27 23:11:32 +01:00
$("#hyperion_disabled_notify").fadeOut("fast");
else
$("#hyperion_disabled_notify").fadeIn("fast");
}
comps.forEach((entry, index) => {
if (entry.name === obj.name){
comps[index] = obj;
}
});
// notify the update
$(hyperion).trigger("components-updated");
});
$(hyperion).on("cmd-effects-update", function(event){
serverInfo.effects = event.response.data.effects
});
$(".mnava").bind('click.menu', function(e){
loadContent(e);
window.scrollTo(0, 0);
});
});
$(function(){
var sidebar = $('#side-menu'); // cache sidebar to a variable for performance
sidebar.delegate('a.inactive','click',function(){
sidebar.find('.active').toggleClass('active inactive');
$(this).toggleClass('active inactive');
});
});