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

123 lines
3.1 KiB
JavaScript
Raw Normal View History

$(document).ready( function() {
loadContentTo("#container_connection_lost","connection_lost");
loadContentTo("#container_restart","restart");
initWebSocket();
$(window.hyperion).on("cmd-serverinfo",function(event){
window.serverInfo = event.response.info;
// comps
window.comps = event.response.info.components
2018-12-27 23:11:32 +01:00
$(window.hyperion).trigger("ready");
2018-12-27 23:11:32 +01:00
window.comps.forEach( function(obj) {
if (obj.name == "ALL")
{
if(obj.enabled)
$("#hyperion_disabled_notify").fadeOut("fast");
else
$("#hyperion_disabled_notify").fadeIn("fast");
}
});
if (window.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
$(window.hyperion).on("cmd-sessions-update", function(event) {
window.serverInfo.sessions = event.response.data;
2018-12-27 23:11:32 +01:00
updateSessions();
});
$(window.hyperion).on("cmd-sysinfo", function(event) {
requestServerInfo();
window.sysInfo = event.response.info;
2017-04-07 21:33:40 +02:00
window.currentVersion = window.sysInfo.hyperion.version;
});
2018-12-27 23:11:32 +01:00
$(window.hyperion).one("cmd-config-getschema", function(event) {
window.serverSchema = event.response.info;
requestServerConfig();
2018-12-27 23:11:32 +01:00
window.schema = window.serverSchema.properties;
});
$(window.hyperion).on("cmd-config-getconfig", function(event) {
window.serverConfig = event.response.info;
requestSysInfo();
2018-12-27 23:11:32 +01:00
window.showOptHelp = window.serverConfig.general.showOptHelp;
});
$(window.hyperion).on("cmd-config-setconfig", function(event) {
if (event.response.success === true) {
$('#hyperion_config_write_success_notify').fadeIn().delay(5000).fadeOut();
}
});
$(window.hyperion).on("error",function(event){
showInfoDialog("error","Error", event.reason);
});
$(window.hyperion).on("open",function(event){
requestServerConfigSchema();
});
2018-12-27 23:11:32 +01:00
$(window.hyperion).one("ready", function(event) {
loadContent();
});
2018-12-27 23:11:32 +01:00
$(window.hyperion).on("cmd-adjustment-update", function(event) {
window.serverInfo.adjustment = event.response.data
2018-12-27 23:11:32 +01:00
});
$(window.hyperion).on("cmd-videomode-update", function(event) {
window.serverInfo.videomode = event.response.data.videomode
2018-12-27 23:11:32 +01:00
});
$(window.hyperion).on("cmd-components-update", function(event) {
2018-12-27 23:11:32 +01:00
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");
}
window.comps.forEach((entry, index) => {
2018-12-27 23:11:32 +01:00
if (entry.name === obj.name){
window.comps[index] = obj;
2018-12-27 23:11:32 +01:00
}
});
// notify the update
$(window.hyperion).trigger("components-updated");
2018-12-27 23:11:32 +01:00
});
$(window.hyperion).on("cmd-effects-update", function(event){
window.serverInfo.effects = event.response.data.effects
2018-12-27 23:11:32 +01:00
});
$(".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');
});
});