-
-
Notifications
You must be signed in to change notification settings - Fork 141
/
Copy patheffects.js
135 lines (110 loc) · 5.36 KB
/
effects.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
$(document).ready( function() {
performTranslation();
var oldEffects = [];
var effects_editor = null;
var foregroundEffect_editor = null;
var backgroundEffect_editor = null;
var soundEffect_editor = null;
var isSound = (window.serverInfo.sound != null);
{
//foreground effect
$('#conf_cont').append(createOptPanel('<svg data-src="svg/effects_startup_effect.svg" fill="currentColor" class="svg4hyperhdr"></svg>', $.i18n("edt_conf_fge_heading_title"), 'editor_container_foregroundEffect', 'btn_submit_foregroundEffect'));
$('#conf_cont').append(createHelpTable(window.schema.foregroundEffect.properties, $.i18n("edt_conf_fge_heading_title")));
//background effect
$('#conf_cont').append(createOptPanel('<svg data-src="svg/effects_background_effect.svg" fill="currentColor" class="svg4hyperhdr"></svg>', $.i18n("edt_conf_bge_heading_title"), 'editor_container_backgroundEffect', 'btn_submit_backgroundEffect'));
$('#conf_cont').append(createHelpTable(window.schema.backgroundEffect.properties, $.i18n("edt_conf_bge_heading_title")));
if (isSound)
{
//sound effect
$('#conf_cont').append(createOptPanel('<svg data-src="svg/effects_sound_device.svg" fill="currentColor" class="svg4hyperhdr"></svg>', $.i18n("edt_conf_sound_heading_title"), 'editor_container_soundEffect', 'btn_submit_soundEffect'));
$('#conf_cont').append(createHelpTable(window.schema.soundEffect.properties, $.i18n("edt_conf_sound_heading_title")));
}
}
var newEffects = window.serverInfo.effects.sort(function(a, b) {
if (a.name.indexOf('Music:') >= 0 && b.name.indexOf('Music:') < 0)
return 1;
if (a.name.indexOf('Music:') < 0 && b.name.indexOf('Music:') >= 0)
return -1;
return (a.name > b.name);
});
var _foregroundEffect = window.schema.foregroundEffect;
var _backgroundEffect = window.schema.backgroundEffect;
_foregroundEffect.properties.effect.enum = [];
_backgroundEffect.properties.effect.enum = [];
_foregroundEffect.properties.effect.options.enum_titles = [];
_backgroundEffect.properties.effect.options.enum_titles = [];
for(var i = 0; i < newEffects.length; i++)
{
var effectName = newEffects[i].name.toString();
_foregroundEffect.properties.effect.enum.push(effectName);
_backgroundEffect.properties.effect.enum.push(effectName);
_foregroundEffect.properties.effect.options.enum_titles.push(effectName);
_backgroundEffect.properties.effect.options.enum_titles.push(effectName);
}
foregroundEffect_editor = createJsonEditor('editor_container_foregroundEffect', {
foregroundEffect : _foregroundEffect
}, true, true, undefined, true);
backgroundEffect_editor = createJsonEditor('editor_container_backgroundEffect', {
backgroundEffect : _backgroundEffect
}, true, true, undefined, true);
if (isSound)
{
var devices =window.serverInfo.sound.sound_available;
var _soundEffect = window.schema.soundEffect;
_soundEffect.properties.device.enum = [];
_soundEffect.properties.device.options = {};
_soundEffect.properties.device.options.enum_titles = [];
for(var i = 0; i < devices.length; i++)
{
_soundEffect.properties.device.enum.push(devices[i].toString());
_soundEffect.properties.device.options.enum_titles.push(devices[i].toString());
}
soundEffect_editor = createJsonEditor('editor_container_soundEffect', {
soundEffect : _soundEffect
}, true, true);
};
foregroundEffect_editor.on('ready',function() {
});
foregroundEffect_editor.on('change',function() {
foregroundEffect_editor.validate().length ? $('#btn_submit_foregroundEffect').attr('disabled', true) : $('#btn_submit_foregroundEffect').attr('disabled', false);
});
backgroundEffect_editor.on('change',function() {
backgroundEffect_editor.validate().length ? $('#btn_submit_backgroundEffect').attr('disabled', true) : $('#btn_submit_backgroundEffect').attr('disabled', false);
});
if (isSound)
{
soundEffect_editor.on('change',function() {
soundEffect_editor.validate().length ? $('#btn_submit_soundEffect').attr('disabled', true) : $('#btn_submit_soundEffect').attr('disabled', false);
});
};
$('#btn_submit_foregroundEffect').off().on('click',function() {
var value = foregroundEffect_editor.getValue();
if(typeof value.foregroundEffect.effect == 'undefined' && window.serverConfig.foregroundEffect != null)
value.foregroundEffect.effect = window.serverConfig.foregroundEffect.effect;
requestWriteConfig(value);
});
$('#btn_submit_backgroundEffect').off().on('click',function() {
var value = backgroundEffect_editor.getValue();
if(typeof value.backgroundEffect.effect == 'undefined' && window.serverConfig.backgroundEffect != null)
value.backgroundEffect.effect = window.serverConfig.backgroundEffect.effect;
requestWriteConfig(value);
});
if (isSound)
{
$('#btn_submit_soundEffect').off().on('click',function() {
var value = soundEffect_editor.getValue();
if(typeof value.soundEffect.device == 'undefined' && window.serverConfig.soundEffect != null)
value.soundEffect.device = window.serverConfig.soundEffect.device;
requestWriteConfig(value);
});
};
//create introduction
if(window.showOptHelp)
{
createHint("intro", $.i18n('conf_effect_fgeff_intro'), "editor_container_foregroundEffect");
createHint("intro", $.i18n('conf_effect_bgeff_intro'), "editor_container_backgroundEffect");
if (isSound)
createHint("intro", $.i18n('conf_effect_sndeff_intro'), "editor_container_soundEffect");
}
removeOverlay();
});