$(document).ready( function() { //clear priority if people reload the page or lost connection while a wizard was active $(hyperion).one("cmd-config-getschema", function(event) { if(getStorage("wizardactive") === 'true') requestPriorityClear(); setStorage("wizardactive", false); }); function resetWizard() { $("#wizard_modal").modal('hide'); clearInterval(colorIntveralId); requestPriorityClear(); setStorage("wizardactive", false); $('#wizp1').toggle(true); $('#wizp2').toggle(false); } //rgb byte order wizard var colorIntveralId; var new_rgb_order; function changeColor() { var color = $("#wiz_canv_color").css('background-color'); if (color == 'rgb(255, 0, 0)') { $("#wiz_canv_color").css('background-color','rgb(0, 255, 0)'); requestSetColor('0','255','0'); } else { $("#wiz_canv_color").css('background-color','rgb(255, 0, 0)'); requestSetColor('255','0','0'); } } function startWizardRGB() { //create html $('#wiz_header').html(''+$.i18n('wiz_rgb_title')); $('#wizp1_body').html('Redefine ambient light!

'+$.i18n('wiz_rgb_title')+'

'+$.i18n('wiz_rgb_intro1')+'

'+$.i18n('wiz_rgb_intro2')+'

'); $('#wizp1_footer').html(''); $('#wizp2_body').html('Redefine ambient light!

'+$.i18n('wiz_rgb_expl')+'

'); $('#wizp2_body').append('
'+$.i18n('edt_append_s')+'
'); $('#wizp2_body').append(''); $('#wizp2_body').append('
'); $('#wizp2_footer').html('') //open modal $("#wizard_modal").modal({ backdrop : "static", keyboard: false, show: true }); //listen for continue $('#btn_wiz_cont').off().on('click',function() { beginWizardRGB(); $('#wizp1').toggle(false); $('#wizp2').toggle(true); }); } function beginWizardRGB() { $("#wiz_switchtime_select").off().on('change',function() { clearInterval(colorIntveralId); var time = $("#wiz_switchtime_select").val(); colorIntveralId = setInterval(function() { changeColor(); }, time*1000); }); $('.wselect').change(function () { var rgb_order = order = parsedConfJSON.device.colorOrder.split(""); var redS = $("#wiz_r_select").val(); var greenS = $("#wiz_g_select").val(); for (var i = 0; i