2017-02-08 14:36:28 +01:00
|
|
|
$(document).ready( function() {
|
|
|
|
performTranslation();
|
2021-05-01 17:00:44 +02:00
|
|
|
|
|
|
|
// update instance listing
|
|
|
|
updateHyperionInstanceListing();
|
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
var oldEffects = [];
|
|
|
|
var effects_editor = null;
|
2019-06-05 18:19:08 +02:00
|
|
|
var confFgEff = window.serverConfig.foregroundEffect.effect;
|
|
|
|
var confBgEff = window.serverConfig.backgroundEffect.effect;
|
2017-02-08 14:36:28 +01:00
|
|
|
var foregroundEffect_editor = null;
|
|
|
|
var backgroundEffect_editor = null;
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
if(window.showOptHelp)
|
2017-09-04 23:12:59 +02:00
|
|
|
{
|
2017-01-17 21:53:35 +01:00
|
|
|
//foreground effect
|
2019-06-05 18:19:08 +02:00
|
|
|
$('#conf_cont').append(createRow('conf_cont_fge'));
|
2017-01-17 21:53:35 +01:00
|
|
|
$('#conf_cont_fge').append(createOptPanel('fa-spinner', $.i18n("edt_conf_fge_heading_title"), 'editor_container_foregroundEffect', 'btn_submit_foregroundEffect'));
|
2021-05-01 17:00:44 +02:00
|
|
|
$('#conf_cont_fge').append(createHelpTable(window.schema.foregroundEffect.properties, $.i18n("edt_conf_fge_heading_title"), "foregroundEffectHelpPanelId"));
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-01-17 21:53:35 +01:00
|
|
|
//background effect
|
2019-06-05 18:19:08 +02:00
|
|
|
$('#conf_cont').append(createRow('conf_cont_bge'));
|
2017-01-17 21:53:35 +01:00
|
|
|
$('#conf_cont_bge').append(createOptPanel('fa-spinner', $.i18n("edt_conf_bge_heading_title"), 'editor_container_backgroundEffect', 'btn_submit_backgroundEffect'));
|
2021-05-01 17:00:44 +02:00
|
|
|
$('#conf_cont_bge').append(createHelpTable(window.schema.backgroundEffect.properties, $.i18n("edt_conf_bge_heading_title"), "backgroundEffectHelpPanelId"));
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-07-30 14:36:23 +02:00
|
|
|
//effect path
|
|
|
|
if(storedAccess != 'default')
|
|
|
|
{
|
2019-06-05 18:19:08 +02:00
|
|
|
$('#conf_cont').append(createRow('conf_cont_ef'));
|
2017-07-30 14:36:23 +02:00
|
|
|
$('#conf_cont_ef').append(createOptPanel('fa-spinner', $.i18n("edt_conf_effp_heading_title"), 'editor_container_effects', 'btn_submit_effects'));
|
2019-06-05 18:19:08 +02:00
|
|
|
$('#conf_cont_ef').append(createHelpTable(window.schema.effects.properties, $.i18n("edt_conf_effp_heading_title")));
|
2017-07-30 14:36:23 +02:00
|
|
|
}
|
2017-01-17 21:53:35 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$('#conf_cont').addClass('row');
|
|
|
|
$('#conf_cont').append(createOptPanel('fa-spinner', $.i18n("edt_conf_fge_heading_title"), 'editor_container_foregroundEffect', 'btn_submit_foregroundEffect'));
|
|
|
|
$('#conf_cont').append(createOptPanel('fa-spinner', $.i18n("edt_conf_bge_heading_title"), 'editor_container_backgroundEffect', 'btn_submit_backgroundEffect'));
|
2017-09-04 23:12:59 +02:00
|
|
|
if(storedAccess != 'default')
|
2017-07-30 14:36:23 +02:00
|
|
|
$('#conf_cont').append(createOptPanel('fa-spinner', $.i18n("edt_conf_effp_heading_title"), 'editor_container_effects', 'btn_submit_effects'));
|
2017-01-17 21:53:35 +01:00
|
|
|
}
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-01-17 21:53:35 +01:00
|
|
|
if(storedAccess != 'default')
|
|
|
|
{
|
|
|
|
effects_editor = createJsonEditor('editor_container_effects', {
|
2019-06-05 18:19:08 +02:00
|
|
|
effects : window.schema.effects
|
2017-01-17 21:53:35 +01:00
|
|
|
}, true, true);
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-01-17 21:53:35 +01:00
|
|
|
effects_editor.on('change',function() {
|
2020-11-01 19:47:30 +01:00
|
|
|
effects_editor.validate().length || window.readOnlyMode ? $('#btn_submit_effects').attr('disabled', true) : $('#btn_submit_effects').attr('disabled', false);
|
2017-01-17 21:53:35 +01:00
|
|
|
});
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-01-17 21:53:35 +01:00
|
|
|
$('#btn_submit_effects').off().on('click',function() {
|
|
|
|
requestWriteConfig(effects_editor.getValue());
|
|
|
|
});
|
|
|
|
}
|
2016-10-09 10:23:04 +02:00
|
|
|
|
2017-01-04 10:55:10 +01:00
|
|
|
foregroundEffect_editor = createJsonEditor('editor_container_foregroundEffect', {
|
2019-06-05 18:19:08 +02:00
|
|
|
foregroundEffect : window.schema.foregroundEffect
|
2017-01-04 10:55:10 +01:00
|
|
|
}, true, true);
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-01-04 10:55:10 +01:00
|
|
|
backgroundEffect_editor = createJsonEditor('editor_container_backgroundEffect', {
|
2019-06-05 18:19:08 +02:00
|
|
|
backgroundEffect : window.schema.backgroundEffect
|
2017-01-04 10:55:10 +01:00
|
|
|
}, true, true);
|
2017-09-04 23:12:59 +02:00
|
|
|
|
|
|
|
|
2017-01-17 21:53:35 +01:00
|
|
|
foregroundEffect_editor.on('ready',function() {
|
2017-09-04 23:12:59 +02:00
|
|
|
updateEffectlist();
|
2017-01-04 10:55:10 +01:00
|
|
|
});
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2021-05-01 17:00:44 +02:00
|
|
|
foregroundEffect_editor.on('change', function () {
|
|
|
|
var foregroundEffectEnable = foregroundEffect_editor.getEditor("root.foregroundEffect.enable").getValue();
|
|
|
|
if (foregroundEffectEnable) {
|
|
|
|
showInputOptionsForKey(foregroundEffect_editor, "foregroundEffect", "enable", true);
|
|
|
|
$('#foregroundEffectHelpPanelId').show();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
showInputOptionsForKey(foregroundEffect_editor, "foregroundEffect", "enable", false);
|
|
|
|
$('#foregroundEffectHelpPanelId').hide();
|
|
|
|
}
|
|
|
|
|
2020-11-01 19:47:30 +01:00
|
|
|
foregroundEffect_editor.validate().length || window.readOnlyMode ? $('#btn_submit_foregroundEffect').attr('disabled', true) : $('#btn_submit_foregroundEffect').attr('disabled', false);
|
2017-01-04 10:55:10 +01:00
|
|
|
});
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2021-05-01 17:00:44 +02:00
|
|
|
backgroundEffect_editor.on('change', function () {
|
|
|
|
var backgroundEffectEnable = backgroundEffect_editor.getEditor("root.backgroundEffect.enable").getValue();
|
|
|
|
if (backgroundEffectEnable) {
|
|
|
|
showInputOptionsForKey(backgroundEffect_editor, "backgroundEffect", "enable", true);
|
|
|
|
$('#backgroundEffectHelpPanelId').show();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
showInputOptionsForKey(backgroundEffect_editor, "backgroundEffect", "enable", false);
|
|
|
|
$('#backgroundEffectHelpPanelId').hide();
|
|
|
|
}
|
|
|
|
|
2020-11-01 19:47:30 +01:00
|
|
|
backgroundEffect_editor.validate().length || window.readOnlyMode ? $('#btn_submit_backgroundEffect').attr('disabled', true) : $('#btn_submit_backgroundEffect').attr('disabled', false);
|
2017-01-04 10:55:10 +01:00
|
|
|
});
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-01-04 10:55:10 +01:00
|
|
|
$('#btn_submit_foregroundEffect').off().on('click',function() {
|
2017-02-28 17:53:41 +01:00
|
|
|
var value = foregroundEffect_editor.getValue();
|
|
|
|
if(typeof value.foregroundEffect.effect == 'undefined')
|
2019-06-05 18:19:08 +02:00
|
|
|
value.foregroundEffect.effect = window.serverConfig.foregroundEffect.effect;
|
2017-09-04 23:12:59 +02:00
|
|
|
requestWriteConfig(value);
|
2017-01-04 10:55:10 +01:00
|
|
|
});
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-01-04 10:55:10 +01:00
|
|
|
$('#btn_submit_backgroundEffect').off().on('click',function() {
|
2017-02-28 17:53:41 +01:00
|
|
|
var value = backgroundEffect_editor.getValue();
|
|
|
|
if(typeof value.backgroundEffect.effect == 'undefined')
|
2019-06-05 18:19:08 +02:00
|
|
|
value.backgroundEffect.effect = window.serverConfig.backgroundEffect.effect;
|
2017-02-28 17:53:41 +01:00
|
|
|
requestWriteConfig(value);
|
2017-01-04 10:55:10 +01:00
|
|
|
});
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
//create introduction
|
2019-06-05 18:19:08 +02:00
|
|
|
if(window.showOptHelp)
|
2017-01-04 10:55:10 +01:00
|
|
|
{
|
2017-02-08 14:36:28 +01:00
|
|
|
createHint("intro", $.i18n('conf_effect_path_intro'), "editor_container_effects");
|
|
|
|
createHint("intro", $.i18n('conf_effect_fgeff_intro'), "editor_container_foregroundEffect");
|
|
|
|
createHint("intro", $.i18n('conf_effect_bgeff_intro'), "editor_container_backgroundEffect");
|
|
|
|
}
|
|
|
|
|
|
|
|
function updateEffectlist(){
|
2019-06-05 18:19:08 +02:00
|
|
|
var newEffects = window.serverInfo.effects;
|
2017-09-04 23:12:59 +02:00
|
|
|
if (newEffects.length != oldEffects.length)
|
2017-01-04 10:55:10 +01:00
|
|
|
{
|
2017-09-04 23:12:59 +02:00
|
|
|
$('#root_foregroundEffect_effect').html('');
|
|
|
|
var usrEffArr = [];
|
|
|
|
var sysEffArr = [];
|
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
for(var i = 0; i < newEffects.length; i++)
|
2017-01-04 10:55:10 +01:00
|
|
|
{
|
2017-09-04 23:12:59 +02:00
|
|
|
var effectName = newEffects[i].name;
|
|
|
|
if(!/^\:/.test(newEffects[i].file))
|
|
|
|
usrEffArr.push(effectName);
|
|
|
|
else
|
|
|
|
sysEffArr.push(effectName);
|
2017-02-08 14:36:28 +01:00
|
|
|
}
|
2017-09-04 23:12:59 +02:00
|
|
|
$('#root_foregroundEffect_effect').append(createSel(usrEffArr, $.i18n('remote_optgroup_usreffets')));
|
|
|
|
$('#root_foregroundEffect_effect').append(createSel(sysEffArr, $.i18n('remote_optgroup_syseffets')));
|
|
|
|
$('#root_backgroundEffect_effect').html($('#root_foregroundEffect_effect').html());
|
|
|
|
oldEffects = newEffects;
|
|
|
|
|
|
|
|
$('#root_foregroundEffect_effect').val(confFgEff);
|
|
|
|
$('#root_backgroundEffect_effect').val(confBgEff);
|
2017-01-04 10:55:10 +01:00
|
|
|
}
|
|
|
|
}
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
//interval update
|
2019-06-05 18:19:08 +02:00
|
|
|
$(window.hyperion).on("cmd-effects-update", function(event){
|
|
|
|
window.serverInfo.effects = event.response.data.effects
|
2018-12-27 23:11:32 +01:00
|
|
|
updateEffectlist();
|
|
|
|
});
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
removeOverlay();
|
2016-10-09 10:23:04 +02:00
|
|
|
});
|