custom effects can now be deleted again

added comments on function
This commit is contained in:
Paulchen Panther 2018-12-20 14:29:18 +01:00 committed by GitHub
parent b4095d10e1
commit 0e68459850
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,6 +70,7 @@ $(document).ready( function() {
}); });
}); });
// disable or enable control elements
$("#name-input").on('change keyup', function(event) { $("#name-input").on('change keyup', function(event) {
effectName = $(this).val(); effectName = $(this).val();
if ($(this).val() == '') { if ($(this).val() == '') {
@ -81,6 +82,7 @@ $(document).ready( function() {
} }
}); });
// Save Effect
$('#btn_write').off().on('click',function() { $('#btn_write').off().on('click',function() {
requestWriteEffect(effectName,effectPy,JSON.stringify(effects_editor.getValue())); requestWriteEffect(effectName,effectPy,JSON.stringify(effects_editor.getValue()));
$(hyperion).one("cmd-create-effect", function(event) { $(hyperion).one("cmd-create-effect", function(event) {
@ -93,21 +95,25 @@ $(document).ready( function() {
}); });
// Start test
$('#btn_start_test').off().on('click',function() { $('#btn_start_test').off().on('click',function() {
triggerTestEffect(); triggerTestEffect();
}); });
// Stop test
$('#btn_stop_test').off().on('click',function() { $('#btn_stop_test').off().on('click',function() {
requestPriorityClear(); requestPriorityClear();
testrun = false; testrun = false;
}); });
// Continuous test
$('#btn_cont_test').off().on('click',function() { $('#btn_cont_test').off().on('click',function() {
toggleClass('#btn_cont_test', "btn-success", "btn-danger"); toggleClass('#btn_cont_test', "btn-success", "btn-danger");
}); });
// Delete Effect
$('#btn_delete').off().on('click',function() { $('#btn_delete').off().on('click',function() {
var name = $("#effectsdellist").val(); var name = $("#effectsdellist").val().split("_")[1];
requestDeleteEffect(name); requestDeleteEffect(name);
$(hyperion).one("cmd-delete-effect", function(event) { $(hyperion).one("cmd-delete-effect", function(event) {
if (event.response.success) if (event.response.success)
@ -115,11 +121,13 @@ $(document).ready( function() {
}); });
}); });
// disable or enable Delete Effect Button
$('#effectsdellist').off().on('change', function(){ $('#effectsdellist').off().on('change', function(){
$(this).val() == null ? $('#btn_edit, #btn_delete').prop('disabled',true) : ""; $(this).val() == null ? $('#btn_edit, #btn_delete').prop('disabled',true) : "";
$(this).val().startsWith("int_") ? $('#btn_delete').prop('disabled',true) : $('#btn_delete').prop('disabled',false); $(this).val().startsWith("int_") ? $('#btn_delete').prop('disabled',true) : $('#btn_delete').prop('disabled',false);
}); });
// Load Effect
$('#btn_edit').off().on('click', function(){ $('#btn_edit').off().on('click', function(){
var name = $("#effectsdellist").val().replace("ext_",""); var name = $("#effectsdellist").val().replace("ext_","");