JSONEditor.defaults.editors.colorPicker = JSONEditor.defaults.editors.string.extend({ getValue: function() { if ($(this.input).data("colorpicker") !== undefined) { var color = $(this.input).data('colorpicker').color.toRGB(); return [color.r,color.g, color.b]; } else { return [0,0,0]; } }, setValue: function(val) { function rgb2hex(rgb) { return "#" + ("0" + parseInt(rgb[0],10).toString(16)).slice(-2) + ("0" + parseInt(rgb[1],10).toString(16)).slice(-2) + ("0" + parseInt(rgb[2],10).toString(16)).slice(-2); } $(this.input).colorpicker('updateInput', 'rgb('+val+')'); $(this.input).colorpicker('updateData', val); $(this.input).colorpicker('updatePicker', rgb2hex(val)); $(this.input).colorpicker('updateComponent', 'rgb('+val+')'); }, build: function() { this._super(); var myinput = this; $(myinput.input).parent().attr("class", $(myinput.input).parent().attr('class') + " colorpicker-element input-group"); $(myinput.input).append(""); $(myinput.input).colorpicker({ format: 'rgb', customClass: 'colorpicker-2x', sliders: { saturation: { maxLeft: 200, maxTop: 200 }, hue: { maxTop: 200 }, }, }) $("#event_catcher").detach().insertAfter(myinput.input); $("#event_catcher").attr("id", "selector"); $(this.input).colorpicker().on('changeColor', function(e) { $(myinput).val(e.color.toRGB()).change(); }); } }); JSONEditor.defaults.resolvers.unshift(function(schema) { if(schema.type === "array" && schema.format === "colorpicker") { return "colorPicker"; } }); var oldDelList = []; function updateDelEffectlist(event){ var newDelList = event.response.info.effects if(newDelList.length != oldDelList.length) { var EffectHtml = null; for(var idx=0; idx'+newDelList[idx].name+''; } } $("#effectsdellist").html(EffectHtml); oldDelList = newDelList; $('#effectsdellist').trigger('change'); } } $(hyperion).one("cmd-config-getschema", function(event) { effects = parsedConfSchemaJSON.properties.effectSchemas.internal EffectsHtml = ""; for(var idx=0; idx'+$.i18n(effects[idx].schemaContent.title)+''; } $("#effectslist").html(EffectsHtml); $("#effectslist").trigger("change"); }); function validateEditor() { if(effects_editor.validate().length) { showInfoDialog('error', $.i18n('infoDialog_effconf_invalidvalue_title'), $.i18n('infoDialog_effconf_invalidvalue_text')); return false; } 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 = ""; $("#effectslist").off().on("change", function(event) { for(var idx=0; idx