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

138 lines
3.2 KiB
JavaScript
Raw Normal View History

$(document).ready( function() {
var uiLock = false;
loadContentTo("#container_connection_lost","connection_lost");
loadContentTo("#container_restart","restart");
initWebSocket();
$(hyperion).on("cmd-serverinfo",function(event){
serverInfo = event.response.info;
2018-12-27 23:11:32 +01:00
// protect components from serverinfo updates
if(!compsInited)
{
comps = event.response.info.components
compsInited = true;
}
if(!priosInited)
{
priosInited = true;
}
$(hyperion).trigger("ready");
2018-12-27 23:11:32 +01:00
if (serverInfo.hyperion.config_modified)
$("#hyperion_reload_notify").fadeIn("fast");
else
$("#hyperion_reload_notify").fadeOut("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");
if (!serverInfo.hyperion.config_writeable)
{
showInfoDialog('uilock',$.i18n('InfoDialog_nowrite_title'),$.i18n('InfoDialog_nowrite_text'));
$('#wrapper').toggle(false);
uiLock = true;
}
else if (uiLock)
{
$("#modal_dialog").modal('hide');
$('#wrapper').toggle(true);
uiLock = false;
}
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).one("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).one("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("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.enable)
$("#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
});
$("#btn_hyperion_reload").on("click", function(){
initRestart();
});
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');
});
});