diff --git a/assets/webconfig/content/effects_configurator.html b/assets/webconfig/content/effects_configurator.html index 484802c7..10bb0700 100644 --- a/assets/webconfig/content/effects_configurator.html +++ b/assets/webconfig/content/effects_configurator.html @@ -22,8 +22,10 @@
diff --git a/assets/webconfig/js/content_effectsconfigurator.js b/assets/webconfig/js/content_effectsconfigurator.js index 677fe156..b47445e8 100644 --- a/assets/webconfig/js/content_effectsconfigurator.js +++ b/assets/webconfig/js/content_effectsconfigurator.js @@ -8,7 +8,38 @@ $(hyperion).one("cmd-config-getschema", function(event) { $("#effectslist").html(EffectsHtml); $("#effectslist").trigger("change"); }); - + + function validateEditor() { + if(effects_editor.validate().length) + { + showInfoDialog('error','INVALID VALUES','Please check for red marked inputs and try again.'); + return false; + } + else + { + return true; + } + }; + + function validateName() { + effectName = $('#name-input').val(); + if (effectName == "") + { + showInfoDialog('error','INVALID NAME FIELD','Effect name is empty! Please fill in a name and try again.'); + return false; + } + else + { + return true; + } + }; + + function triggerTestEffect() { + var args = effects_editor.getEditor('root.args'); + requestTestEffect(effectName, ":/effects/" + effectPy.slice(1), JSON.stringify(args.getValue())); + }; + + effectName = ""; effects_editor = null; effectPy = ""; @@ -22,54 +53,35 @@ $(hyperion).one("cmd-config-getschema", function(event) { effectPy += effects[idx].schemaContent.script; } } - + effects_editor.on('change',function() { + if ($("#btn_cont_test").hasClass("btn-success") && validateName() && validateEditor()) + { + triggerTestEffect(); + } + }); }); $('#btn_write').off().on('click',function() { - - effectName = $('#name-input').val(); - if (effectName == "") + if(validateEditor() && validateName()) { - showInfoDialog('error','INVALID NAME FIELD','Effect name is empty! Please fill in a name and try again.') + requestWriteEffect(effectName,effectPy,JSON.stringify(effects_editor.getValue())); + showInfoDialog('success','SUCCESS!','Your effect has been created successfully!'); } - else - { - var errors = effects_editor.validate(); - if(errors.length) - { - showInfoDialog('error','INVALID VALUES','Please check for red marked inputs and try again.') - } - else - { - requestWriteEffect(effectName,effectPy,JSON.stringify(effects_editor.getValue())); - showInfoDialog('success','SUCCESS!','Your effect has been created successfully!') - } - } - }); - $('#btn_test').off().on('click',function() { - - effectName = $('#name-input').val(); - if (effectName == "") + $('#btn_start_test').off().on('click',function() { + if(validateEditor() && validateName()) { - showInfoDialog('error','INVALID NAME FIELD','Effect name is empty! Please fill in a name and try again.') + triggerTestEffect(); } - else - { - var errors = effects_editor.validate(); - if(errors.length) - { - showInfoDialog('error','INVALID VALUES','Please check for red marked inputs and try again.') - } - else - { - var args = effects_editor.getEditor('root.args'); - requestTestEffect(effectName, ":/effects/" + effectPy.slice(1), JSON.stringify(args.getValue())); - showInfoDialog('success','SUCCESS!','Your effect has been started!') - } - } - + }); + + $('#btn_stop_test').off().on('click',function() { + requestPriorityClear(); + }); + + $('#btn_cont_test').off().on('click',function() { + toggleClass('#btn_cont_test', "btn-success", "btn-danger"); }); $(document).ready( function() { diff --git a/assets/webconfig/lang/de.json b/assets/webconfig/lang/de.json index 25c9d9e4..016fb3b8 100644 --- a/assets/webconfig/lang/de.json +++ b/assets/webconfig/lang/de.json @@ -86,7 +86,9 @@ "effectsconfigurator_label_chooseeff" : "Basis-Effekt auswählen:", "effectsconfigurator_button_saveeffect" : "Effekt speichern", "effectsconfigurator_label_effectname" : "Effektname:", - "effectsconfigurator_button_testeffect" : "Effekt testen", + "effectsconfigurator_button_starttest" : "Starte Effekttest", + "effectsconfigurator_button_stoptest" : "Stoppe Effekttest", + "effectsconfigurator_button_conttest" : "Fortlaufender Test", "support_label_title" : "Unterstütze Hyperion", "support_label_intro" : "Hyperion ist ein kostenloses Open Source Projekt und ein kleines Team arbeitet an seiner Weiterentwicklung. Darum benötigen wir DEINE Unterstützung um den Ball weiter rollen zu lassen und um weiter in bessere Infrastruktur und Weiterentwicklung investieren zu können.", "support_label_spreadtheword" : "Weitersagen!",