$(document).ready(function() { $('#tabs').tabs({ }); $('#colorwheel').wheelColorPicker(); $("#btn-refresh-devices").on("click", getDevices); getActive(); getDevices(); }); function setColor() { var color = $('#colorwheel').val(); console.log(color); $.ajax({ url: 'ajax/ajax_setcolor.php', data: {color: color} }); } function setPattern(pattern) { $.ajax({ url: 'ajax/ajax_setpattern.php', data: {pattern: pattern} }); } function disableAuto() { $.ajax({ url: 'ajax/ajax_disableauto.php' }); } function lightsOff() { $.ajax({ url: 'ajax/ajax_lightsoff.php' }); } function getActive() { $.ajax({ url: 'ajax/ajax_getactive.php', dataType: 'text', success: function(data, stat, jqo) { $("#active-all").removeClass('active'); $("#active-up").removeClass('active'); $("#active-down").removeClass('active'); $("#active-wall").removeClass('active'); $("#active-cldn").removeClass('active'); $("#active-post").removeClass('active'); $("#" + data).addClass('active'); } }); } function escapeHTML(str) { return str.replace(/[<>]/g, function(match) { switch (match) { case '&': return '&'; case '<': return '<'; case '>': return '>'; default: return match; } }); } function getDevices() { $.ajax({ url: 'ajax/getdevices.php', dataType: 'json', success: function(data, stat, jqo) { var div = $("#devices"); div.html(""); var html = ""; data.forEach((device) => { html += "