diff --git a/js/app.nocr.js b/js/app.nocr.js index c94ce06..d789c90 100644 --- a/js/app.nocr.js +++ b/js/app.nocr.js @@ -1 +1 @@ -var objectDataByName = function(arr, name) { ret = null; angular.forEach(arr, function(item, index) { if (item.name == name) { logger("Found " + item.data.length + " data points for '" + item.name + "'", "dbg"); ret = item.data; return; } }); return ret;};var millisecondsToMidnight = function() { var now = new Date(); var then = new Date(now); then.setHours(24, 0, 0, 0); return (then - now);}var lpad = function(n, width, z) { z = z || '0'; n = n + ''; return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;};hours2Hm = function(num) { num = num * 60; var hours = Math.floor(num / 60); var minutes = num % 60; return lpad("" + hours, 2) + ":" + lpad("" + minutes, 2);};hexToRgb = function(hex) { var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; hex = hex.replace(shorthandRegex, function(m, r, g, b) { return r + r + g + g + b + b; }); var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); return result ? { r : parseInt(result[1], 16), g : parseInt(result[2], 16), b : parseInt(result[3], 16) } : null;};isJson = function(item) { item = typeof item !== "string" ? JSON.stringify(item) : item; try { item = JSON.parse(item); } catch (e) { return false; } if (typeof item === "object" && item !== null) { return true; } return false;};colorLuminance = function(hex, lum) { hex = String(hex).replace(/[^0-9a-f]/gi, ""); if (hex.length < 6) { hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; } lum = lum || 0; var rgb = "#", c, i; for (i = 0; i < 3; i++) { c = parseInt(hex.substr(i * 2, 2), 16); c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16); rgb += ("00" + c).substr(c.length); } return rgb;};logger = function(l, err) { if (!err) err = "inf"; msg = moment().format("HH:mm:ss") + "| " + l; if (err == "dbg") { console.debug(msg); } if (err == "inf") { console.log(msg); } if (err == "wrn") { console.warn(msg); } if (err == "err") { console.error(msg); }};logObj = function(msg, err) { if (!err) err = "inf"; if (err == "dbg") { console.debug(msg); } if (err == "inf") { console.log(msg); } if (err == "wrn") { console.warn(msg); } if (err == "err") { console.error(msg); }};function number_format(number, decimals, dec_point, thousands_sep) { number = (number + '').replace(/[^0-9+\-Ee.]/g, ''); var n = !isFinite(+number) ? 0 : +number, prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep, dec = (typeof dec_point === 'undefined') ? '.' : dec_point, s = '', toFixedFix = function(n, prec) { var k = Math.pow(10, prec); return '' + Math.round(n * k) / k; }; s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.'); if (s[0].length > 3) { s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); } if ((s[1] || '').length < prec) { s[1] = s[1] || ''; s[1] += new Array(prec - s[1].length + 1).join('0'); } return s.join(dec);}Array.prototype.random = function() { return this[Math.round((Math.random() * (this.length - 1)))];};function genKey(key) { var uc = [ 'A', 'B', 'C', 'E', 'F', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'T', 'W', 'Y', 'Z' ]; var lc = [ 'a', 'b', 'd', 'e', 'g', 'h', 'k', 'n', 'p', 'q', 'r', 's', 't', 'x', 'y', 'z' ]; var nc = [ '2', '3', '4', '5', '6', '7', '8', '9' ]; var sc = [ '=', '-', '.', '_', '@' ]; var an = [].concat(uc).concat(lc).concat(nc); var ny = [].concat(sc).concat(an); return key.replace(/[xlunas]/g, function(c) { return (c === 'u' ? uc.random() : (c === 'l' ? lc.random() : (c === 'n' ? nc.random() : (c === 's' ? sc.random() : (c === 'a' ? an.random() : ny.random()))))); });}var Base64 = { _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", encode : function(input) { var output = ""; var chr1, chr2, chr3, enc1, enc2, enc3, enc4; var i = 0; input = Base64._utf8_encode(input); while (i < input.length) { chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); } return output; }, decode : function(input) { var output = ""; var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); while (i < input.length) { enc1 = this._keyStr.indexOf(input.charAt(i++)); enc2 = this._keyStr.indexOf(input.charAt(i++)); enc3 = this._keyStr.indexOf(input.charAt(i++)); enc4 = this._keyStr.indexOf(input.charAt(i++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; output = output + String.fromCharCode(chr1); if (enc3 != 64) { output = output + String.fromCharCode(chr2); } if (enc4 != 64) { output = output + String.fromCharCode(chr3); } } output = Base64._utf8_decode(output); return output; }, _utf8_encode : function(string) { string = string.replace(/\r\n/g, "\n"); var utftext = ""; for (var n = 0; n < string.length; n++) { var c = string.charCodeAt(n); if (c < 128) { utftext += String.fromCharCode(c); } else if ((c > 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128); } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); } } return utftext; }, _utf8_decode : function(utftext) { var string = ""; var i = 0; var c = c1 = c2 = 0; while (i < utftext.length) { c = utftext.charCodeAt(i); if (c < 128) { string += String.fromCharCode(c); i++; } else if ((c > 191) && (c < 224)) { c2 = utftext.charCodeAt(i + 1); string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); i += 2; } else { c2 = utftext.charCodeAt(i + 1); c3 = utftext.charCodeAt(i + 2); string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); i += 3; } } return string; }};var toastTimeout = null;function toast(text) { $("#snackbar").html(text); if (!$("#snackbar").hasClass("show")) { $("#snackbar").addClass("show"); } if (toastTimeout === null) { toastTimeout = setTimeout(function() { if (toastTimeout) { $("#snackbar").removeClass("show"); toastTimeout = null; } }, 2990); }};$(document).ready(function() { $("#page-loading").hide(); $("#page-loaded").show(1000); logger("Application Loaded");});var app = angular.module("myApp", [ 'ngRoute' ]);app.config([ "$locationProvider", "$routeProvider", function($locationProvider, $routeProvider) { $locationProvider.html5Mode(true); $routeProvider.when('/', { templateUrl : '/pages/home.php', controller : 'HomeCtrl' }).when('/about', { templateUrl : '/pages/about.php', controller : 'AboutCtrl' }).when('/config', { templateUrl : '/pages/config.php', controller : 'ConfigCtrl' }).otherwise({ templateUrl : '/pages/404.php' });} ]);class Duration { constructor() { this.start = new Date().getTime(); }; end() { return new Date().getTime() - this.start; }; prettyEnd() { var ret = ""; const ms2h = 1 / (60 * 60 * 1000); const ms2m = 1 / (60 * 1000); const ms2s = 1 / (1000); var ms = this.end(); var h = Math.floor(ms * ms2h); ms -= h / ms2h; var m = Math.floor(ms * ms2m); ms -= m / ms2m; var s = Math.floor(ms * ms2s); ms -= s / ms2s; ret += (h > 0) ? (h + "h") : (""); ret += ((ret.length > 0) ? (" ") : ("")) + ((m > 0 || ret.length) ? (m + "m") : ("")); ret += ((ret.length > 0) ? (" ") : ("")) + ((s > 0 || ret.length) ? (s + "s") : ("")); ret += ((ret.length > 0) ? (" ") : ("")) + ms + "ms"; return ret; };};var addSensorReading = function(arr, sensor, value) { return addSensorReadingWithDate(arr, sensor, value, new Date());};var addSensorReadingWithDate = function(arr, sensor, value, dte) { found = false; if (value == undefined) { return false; } angular.forEach(arr, function(item, index) { if (item.name == sensor.name) { found = true; item.data.push({ t : dte, y : value }); item.data.sort(function(a, b) { if (a.t < b.t) { return -1; } if (a.t > b.t) { return 1; } return 0; }); } }); if (!found) { rgb = hexToRgb(sensor.colour); arr.push({ name : sensor.name, label : sensor.label, backgroundColor : "rgba(" + rgb.r + ", " + rgb.g + ", " + rgb.b + ", 0.2)", borderColor : "rgba(" + rgb.r + ", " + rgb.g + ", " + rgb.b + ", 1)", borderWidth : 1, fill : false, data : [ { t : new Date(), y : value } ] }); } return true;};var createDayGraph = function(id, arr, title, ind, xlabels, yhours) { var ctx = $(id); var myChart = new Chart(ctx, { type : 'line', fill : false, data : { datasets : arr, labels : xlabels }, options : { responsive : true, aspectRatio : 2, legend : { display : true }, title : { display : true, fontSize : 18, text : title }, scales : { yAxes : [ { ticks : { stepSize : ((yhours) ? (1) : (undefined)), callback : function(value, index, values) { return yhours ? (hours2Hm(value)) : (value + ind); } } } ], xAxes : [ { type : 'time', ticks : { callback : function(value, index, values) { d = new Date(value); if (d.getDate() == 1 || (d.getDate() == 31 && d.getMonth() == 11)) { return value; } return undefined; }, source : 'labels' }, time : { unit : 'day', displayFormats : { day : 'MMM DD' } }, } ] }, tooltips : { callbacks : { title : function(tooltipItem, data) { return moment(tooltipItem[0].label).format("MMMM D"); }, label : function(tooltipItem, data) { var label = data.datasets[tooltipItem.datasetIndex].label || ''; if (label) { label += ': '; } if (yhours) { h = tooltipItem.value; m = (tooltipItem.value - Math.floor(tooltipItem.value)) * 60; hh = lpad("" + Math.floor(h), 2, "0"); mm = lpad("" + Math.floor(m), 2, "0"); label += hh + ":" + mm; } else { label += (Math.round(tooltipItem.value * 100) / 100) + ind; } return label; } } } } }); return myChart;};var createMinuteGraph = function(id, arr, title, ind) { var ctx = $(id); var myChart = new Chart(ctx, { type : 'line', fill : false, data : { datasets : arr, }, options : { responsive : true, aspectRatio : 2, legend : { display : true }, title : { display : true, fontSize : 18, text : title }, scales : { yAxes : [ { ticks : { callback : function(value, index, values) { return value + ind; } } } ], xAxes : [ { type : 'time', distribution : 'linear', time : { unit : 'minute', displayFormats : { minute : "HH:mm" } }, } ] }, tooltips : { callbacks : { title : function(tooltipItem, data) { label = data.datasets[tooltipItem[0].datasetIndex].data[tooltipItem[0].index].t; return moment(label).format("MMMM Do, HH:mm:ss"); }, label : function(tooltipItem, data) { var label = data.datasets[tooltipItem.datasetIndex].label || ''; if (label) { label += ': '; } label += (Math.round(tooltipItem.value * 100) / 100) + ind; return label; } } } } }); return myChart;};app.directive('compile', [ '$compile', function($compile) { return function(scope, element, attrs) { scope.$watch(function(scope) { return scope.$eval(attrs.compile); }, function(value) { element.html(value); $compile(element.contents())(scope); }); };} ]);app.directive('imageonload', [ function() { return { restrict : 'A', link : function(scope, element, attrs) { element.bind('load', function() { scope.$apply(attrs.imageonload); }); } };} ]);app.service('apiSvc', [ "$http", "$timeout", "$interval", function($http, $timeout, $interval) { apiSvc = this; apiSvc._queue = []; apiSvc._queueTick = function() { call = apiSvc._queue.shift(); if (call) { logger("apiSvc._queueTick(): Processing queue item", "dbg"); apiSvc.queue_processing = true; apiSvc.call(call.api, call.data, function(data) { call.notify(data); $timeout(apiSvc._queueTick, 200); }, call.exludelog); } else { logger("apiSvc._queueTick(): Queue is empty", "dbg"); apiSvc.queue_processing = false; } }; apiSvc._queueCheck = function() { if (!apiSvc.queue_processing) { logger("apiSvc._queueCheck(): Starting queue processor", "dbg"); apiSvc._queueTick(); } }; $timeout(apiSvc._queueCheck, 1000); apiSvc.queue = function(api, data, notify, excludelog) { apiSvc._queue.push({ api : api, data : data, notify : notify, excludelog : excludelog }); }; apiSvc.call = function(api, data, notify, excludelog) { data = (typeof data == "function") ? data() : data; excludelog = (excludelog == undefined) ? ([]) : (Array.isArray(excludelog) ? excludelog : [ excludelog ]); txdata = {}; logtxdata = {}; for ( var attrname in data) { txdata[attrname] = data[attrname]; logtxdata[attrname] = (excludelog.indexOf(attrname) == -1) ? (data[attrname]) : ("********"); } logger("apiSvc.call('" + api + "')", "dbg"); logObj(logtxdata, "dbg"); $http({ method : "POST", url : '/api/' + api + ".php", data : $.param(txdata), headers : { 'Content-Type' : 'application/x-www-form-urlencoded' } }).then(function(data) { logger("apiSvc.call(): success", "dbg"); ldata = {}; if (isJson(data.data)) { ldata = data.data; } else { logger("apiSvc.call(): malformed response", "wrn"); ldata.console = data.data.trim().split(/\r\n|\r|\n/); ldata.success = false; ldata.status = "error"; ldata.message = ""; logObj(ldata, "wrn"); } if (typeof notify == "function") { logger("apiSvc.call(): calling notifier", "dbg"); notify(ldata); } }, function(data) { ldata = {}; if (data.status == -1) { logger("apiSvc.call(): No Internet", "err"); } else { logger("apiSvc.call(): HTTP failed with status code " + data.status, "err"); logger("apiSvc.call(): HTTP failed with status text '" + data.statusText + "'", "err"); } if (typeof notify == "function") { if (data.data == null) { data.data = ""; } datastr = (data.data + "").trim(); ldata.console = (datastr.length) ? (data.split(/\r\n|\r|\n/)) : ([]); ldata.success = false; ldata.status = "error"; ldata.message = ""; logger("apiSvc.call(): calling notifier", "dbg"); notify(ldata); } }); };} ]);app.controller('AboutCtrl', [ "$scope", function($scope) { $scope.app_id = app_id; $scope.build_date = build_date; $scope.api_build_date = api_build_date; $scope.app_version = app_version;} ]);app.controller('ComingSoonCtrl', [ "$scope", function($scope) { $scope.title="Coming soon";} ]);app.controller('ConfigCtrl', [ "$scope", function($scope) { $scope.title="Cofiguration";} ]);app.controller('FooterCtrl', [ "$scope", function($scope) { $scope.nowDate = Date.now();} ]);app.controller('HomeCtrl', [ "$scope", "$timeout", "$interval", "apiSvc", function($scope, $timeout, $interval, apiSvc) { $scope.title = "Home Control"; $scope.loading = true; $scope.api_calls = []; $scope.sensor_temperature = []; $scope.sensor_humidity = []; $scope.server_cpu_load = []; $scope.server_cpu_wait = []; $scope.server_temperature = []; $scope.server_mem_load = []; $scope.server_hdd_load = []; $scope.history = {}; logger("Started HomeCtrl"); $scope.preventRefresh = function(ev) { ev.preventDefault(); return false; }; var processLoad = function(history, dst, obj, val) { if (history) { if (r = objectDataByName(history, obj.name)) { logger("Processing " + r.length + " historic values into '" + obj.name + "'", "dbg"); angular.forEach(r, function(item, index) { addSensorReadingWithDate(dst, obj, item.y, new Date(item.t)); }); } } addSensorReading(dst, obj, val); }; var tidyData = function(dst) { remove = new Date(); remove.setDate(remove.getDate() - 1); angular.forEach(dst, function(item, index) { while (item.date, item.data.length > 0 && item.data[0].t <= remove) { item.data.shift(); } }); }; var updateMinuteGraph = function(g, id, src, title, units) { ret = g; if (g) { g.update(); } else { ret = createMinuteGraph(id, src, title, units); } return ret; }; var clearLog = function() { console.clear(); logger("Console log cleared"); }; $scope.console_clear_call = $interval(clearLog, 5 * 60 * 1000); var getEnv = function() { apiSvc.call("getEnv", {}, function(data) { logger("HomeCtrl::handleGetEnv()", "dbg"); logObj(data, "dbg"); if (data.success) { $scope.env = data.env; var obj = {}; Object.assign(obj, $scope.env.demand); processLoad($scope.history.sensor_temperature, $scope.sensor_temperature, obj, obj.temperature); processLoad($scope.history.sensor_humidity, $scope.sensor_humidity, obj, obj.humidity); angular.forEach($scope.env.sensors, function(item, index) { processLoad($scope.history.sensor_temperature, $scope.sensor_temperature, item, item.temperature); processLoad($scope.history.sensor_humidity, $scope.sensor_humidity, item, item.humidity); }); var obj = {}; Object.assign(obj, $scope.env.pi); processLoad($scope.history.server_cpu_load, $scope.server_cpu_load, obj, obj.cpu_load); processLoad($scope.history.server_cpu_wait, $scope.server_cpu_wait, obj, obj.cpu_wait); processLoad($scope.history.server_temperature, $scope.server_temperature, obj, obj.temperature); processLoad($scope.history.server_mem_load, $scope.server_mem_load, obj, obj.mem_load); processLoad($scope.history.server_hdd_load, $scope.server_hdd_load, obj, obj.sd_load); $scope.history = {}; tidyData($scope.sensor_temperature); tidyData($scope.sensor_humidity); tidyData($scope.server_cpu_load); tidyData($scope.server_cpu_wait); tidyData($scope.server_temperature); tidyData($scope.server_mem_load); tidyData($scope.server_hdd_load); $scope.sensor_temperature_graph = updateMinuteGraph($scope.sensor_temperature_graph, '#sensor-temperature-graph', $scope.sensor_temperature, "Temperature", "°C"); $scope.sensor_humidity_graph = updateMinuteGraph($scope.sensor_humidity_graph, '#sensor-humidity-graph', $scope.sensor_humidity, "Humidity", "%"); $scope.server_cpu_load_graph = updateMinuteGraph($scope.server_cpu_load_graph, '#server-cpu_load-graph', $scope.server_cpu_load, "CPU Load", "%"); $scope.server_cpu_wait_graph = updateMinuteGraph($scope.server_cpu_wait_graph, '#server-cpu_wait-graph', $scope.server_cpu_wait, "CPU Wait", "%"); $scope.server_temperature_graph = updateMinuteGraph($scope.server_temperature_graph, '#server-temperature-graph', $scope.server_temperature, "Temperature", "°C"); $scope.server_mem_load_graph = updateMinuteGraph($scope.server_mem_load_graph, '#server-mem_load-graph', $scope.server_mem_load, "Memory Usage", "%"); $scope.server_hdd_load_graph = updateMinuteGraph($scope.server_hdd_load_graph, '#server-hdd_load-graph', $scope.server_hdd_load, "Storage Usage", "%"); } else { $scope.env = null; } if (data.message.length) { toast(data.message); } $scope.loading = false; }); }; getEnv(); $scope.env_api_call = $interval(getEnv, 5000); var getSnapshotImage = function() { apiSvc.queue("getSnapshotImage", {}, function(data) { logger("HomeCtrl::handleGetSnapshotImage()", "dbg"); logObj(data, "dbg"); if (data.success) { $scope.camshot = data.camshot; } else { $scope.camshot = null; } if (data.message.length) { toast(data.message); } $scope.loading = false; }); }; getSnapshotImage(); $scope.snapshot_image_api_call = $interval(getSnapshotImage, 10000); var getApiData = function(o) { var d = new Duration(); apiSvc.queue(o.api, function() { return { today : moment().format("MMDD") }; }, function(data) { logger(o.api + "(): Data transfer: " + d.prettyEnd()); logObj(data, "dbg"); if (data.success) { o.success(data); } else { } if (data.message.length) { toast(data.message); } $scope.loading = false; processApiCalls(); if (o.requeue) { logger("Call to '" + o.api + "' being requeued", "dbg") $timeout(function() { $scope.api_calls.push(o); }, Math.max(millisecondsToMidnight(), 5 * 60 * 1000)); } else { logger("Call to '" + o.api + "' singleshot - no requeue", "dbg") } }); }; var processApiCalls = function(ms) { logger("processApiCalls(): called", "dbg"); data = $scope.api_calls.shift(); if (data) { getApiData(data); } else { logger("API queue complete"); var stm = millisecondsToMidnight(); logger("Milliseconds of sleep: " + stm, "dbg"); $scope.history_api_call = $timeout(processApiCalls, Math.max(millisecondsToMidnight() + 60 * 1000, 5 * 60 * 1000)); } }; $scope.api_calls.push({ api : "schedule/getTemperature", requeue : true, success : function(data) { $scope.schedule_temperature_graph = createDayGraph('#schedule-temperature-graph', data.data, "Temperature", "°C", data.xlabels); } }); $scope.api_calls.push({ api : "schedule/getHumidity", requeue : true, success : function(data) { $scope.schedule_humidity_graph = createDayGraph('#schedule-humidity-graph', data.data, "Humidity", "%", data.xlabels); } }); $scope.api_calls.push({ api : "schedule/getSun", requeue : true, success : function(data) { angular.forEach(data.data, function(item, index) { angular.forEach(item.data, function(item, index) { ts = moment(item.t); ts.local(); h = parseFloat(ts.format("H")) + (parseFloat(ts.format("m")) / 60.0); item.t = ts.format(); item.y = h; }); }); $scope.schedule_sun_graph = createDayGraph('#schedule-sun-graph', data.data, "Sun rise and set", "", data.xlabels, true); } }); $scope.api_calls.push({ api : "schedule/getDaylight", requeue : true, success : function(data) { $scope.schedule_daylight_graph = createDayGraph('#schedule-daylight-graph', data.data, "Daylight hours", "", data.xlabels); } }); $scope.api_calls.push({ api : "history/getServerCpuLoad", success : function(data) { $scope.history.server_cpu_load = data.history; } }); $scope.api_calls.push({ api : "history/getServerCpuWait", success : function(data) { $scope.history.server_cpu_wait = data.history; } }); $scope.api_calls.push({ api : "history/getServerTemperature", success : function(data) { $scope.history.server_temperature = data.history; } }); $scope.api_calls.push({ api : "history/getServerMemoryLoad", success : function(data) { $scope.history.server_mem_load = data.history; } }); $scope.api_calls.push({ api : "history/getServerHddLoad", success : function(data) { $scope.history.server_hdd_load = data.history; } }); $scope.api_calls.push({ api : "history/getSensorTemperature", success : function(data) { $scope.history.sensor_temperature = data.history; } }); $scope.api_calls.push({ api : "history/getSensorHumidity", success : function(data) { $scope.history.sensor_humidity = data.history; } }); $scope.history_api_call = $timeout(processApiCalls, 100);} ]); \ No newline at end of file +var objectDataByName = function(arr, name) { ret = null; angular.forEach(arr, function(item, index) { if (item.name == name) { logger("Found " + item.data.length + " data points for '" + item.name + "'", "dbg"); ret = item.data; return; } }); return ret;};var millisecondsToMidnight = function() { var now = new Date(); var then = new Date(now); then.setHours(24, 0, 0, 0); return (then - now);}var lpad = function(n, width, z) { z = z || '0'; n = n + ''; return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;};hours2Hm = function(num) { num = num * 60; var hours = Math.floor(num / 60); var minutes = num % 60; return lpad("" + hours, 2) + ":" + lpad("" + minutes, 2);};hexToRgb = function(hex) { var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; hex = hex.replace(shorthandRegex, function(m, r, g, b) { return r + r + g + g + b + b; }); var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); return result ? { r : parseInt(result[1], 16), g : parseInt(result[2], 16), b : parseInt(result[3], 16) } : null;};isJson = function(item) { item = typeof item !== "string" ? JSON.stringify(item) : item; try { item = JSON.parse(item); } catch (e) { return false; } if (typeof item === "object" && item !== null) { return true; } return false;};colorLuminance = function(hex, lum) { hex = String(hex).replace(/[^0-9a-f]/gi, ""); if (hex.length < 6) { hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; } lum = lum || 0; var rgb = "#", c, i; for (i = 0; i < 3; i++) { c = parseInt(hex.substr(i * 2, 2), 16); c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16); rgb += ("00" + c).substr(c.length); } return rgb;};logger = function(l, err) { if (typeof l == "object") return logObj(l, err); if (!err) err = "inf"; msg = moment().format("HH:mm:ss") + "| " + l; if (err == "dbg") { console.debug(msg); } if (err == "inf") { console.log(msg); } if (err == "wrn") { console.warn(msg); } if (err == "err") { console.error(msg); }};logObj = function(msg, err) { if (!err) err = "inf"; if (err == "dbg") { console.debug(msg); } if (err == "inf") { console.log(msg); } if (err == "wrn") { console.warn(msg); } if (err == "err") { console.error(msg); }};function number_format(number, decimals, dec_point, thousands_sep) { number = (number + '').replace(/[^0-9+\-Ee.]/g, ''); var n = !isFinite(+number) ? 0 : +number, prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep, dec = (typeof dec_point === 'undefined') ? '.' : dec_point, s = '', toFixedFix = function(n, prec) { var k = Math.pow(10, prec); return '' + Math.round(n * k) / k; }; s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.'); if (s[0].length > 3) { s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); } if ((s[1] || '').length < prec) { s[1] = s[1] || ''; s[1] += new Array(prec - s[1].length + 1).join('0'); } return s.join(dec);}Array.prototype.random = function() { return this[Math.round((Math.random() * (this.length - 1)))];};function genKey(key) { var uc = [ 'A', 'B', 'C', 'E', 'F', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'T', 'W', 'Y', 'Z' ]; var lc = [ 'a', 'b', 'd', 'e', 'g', 'h', 'k', 'n', 'p', 'q', 'r', 's', 't', 'x', 'y', 'z' ]; var nc = [ '2', '3', '4', '5', '6', '7', '8', '9' ]; var sc = [ '=', '-', '.', '_', '@' ]; var an = [].concat(uc).concat(lc).concat(nc); var ny = [].concat(sc).concat(an); return key.replace(/[xlunas]/g, function(c) { return (c === 'u' ? uc.random() : (c === 'l' ? lc.random() : (c === 'n' ? nc.random() : (c === 's' ? sc.random() : (c === 'a' ? an.random() : ny.random()))))); });}var Base64 = { _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", encode : function(input) { var output = ""; var chr1, chr2, chr3, enc1, enc2, enc3, enc4; var i = 0; input = Base64._utf8_encode(input); while (i < input.length) { chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); } return output; }, decode : function(input) { var output = ""; var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); while (i < input.length) { enc1 = this._keyStr.indexOf(input.charAt(i++)); enc2 = this._keyStr.indexOf(input.charAt(i++)); enc3 = this._keyStr.indexOf(input.charAt(i++)); enc4 = this._keyStr.indexOf(input.charAt(i++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; output = output + String.fromCharCode(chr1); if (enc3 != 64) { output = output + String.fromCharCode(chr2); } if (enc4 != 64) { output = output + String.fromCharCode(chr3); } } output = Base64._utf8_decode(output); return output; }, _utf8_encode : function(string) { string = string.replace(/\r\n/g, "\n"); var utftext = ""; for (var n = 0; n < string.length; n++) { var c = string.charCodeAt(n); if (c < 128) { utftext += String.fromCharCode(c); } else if ((c > 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128); } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); } } return utftext; }, _utf8_decode : function(utftext) { var string = ""; var i = 0; var c = c1 = c2 = 0; while (i < utftext.length) { c = utftext.charCodeAt(i); if (c < 128) { string += String.fromCharCode(c); i++; } else if ((c > 191) && (c < 224)) { c2 = utftext.charCodeAt(i + 1); string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); i += 2; } else { c2 = utftext.charCodeAt(i + 1); c3 = utftext.charCodeAt(i + 2); string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); i += 3; } } return string; }};var toastTimeout = null;function toast(text) { $("#snackbar").html(text); if (!$("#snackbar").hasClass("show")) { $("#snackbar").addClass("show"); } if (toastTimeout === null) { toastTimeout = setTimeout(function() { if (toastTimeout) { $("#snackbar").removeClass("show"); toastTimeout = null; } }, 2990); }};$(document).ready(function() { $("#page-loading").hide(); $("#page-loaded").show(1000); logger("Application Loaded");});var app = angular.module("myApp", [ 'ngRoute' ]);app.config([ "$locationProvider", "$routeProvider", function($locationProvider, $routeProvider) { $locationProvider.html5Mode(true); $routeProvider.when('/', { templateUrl : '/pages/home.php', controller : 'HomeCtrl' }).when('/about', { templateUrl : '/pages/about.php', controller : 'AboutCtrl' }).when('/config', { templateUrl : '/pages/config.php', controller : 'ConfigCtrl' }).otherwise({ templateUrl : '/pages/404.php' });} ]);class Duration { constructor() { this.start = new Date().getTime(); }; end() { return new Date().getTime() - this.start; }; prettyEnd() { var ret = ""; const ms2h = 1 / (60 * 60 * 1000); const ms2m = 1 / (60 * 1000); const ms2s = 1 / (1000); var ms = this.end(); var h = Math.floor(ms * ms2h); ms -= h / ms2h; var m = Math.floor(ms * ms2m); ms -= m / ms2m; var s = Math.floor(ms * ms2s); ms -= s / ms2s; ret += (h > 0) ? (h + "h") : (""); ret += ((ret.length > 0) ? (" ") : ("")) + ((m > 0 || ret.length) ? (m + "m") : ("")); ret += ((ret.length > 0) ? (" ") : ("")) + ((s > 0 || ret.length) ? (s + "s") : ("")); ret += ((ret.length > 0) ? (" ") : ("")) + ms + "ms"; return ret; };};var addSensorReading = function(arr, sensor, value) { return addSensorReadingWithDate(arr, sensor, value, new Date());};var addSensorReadingWithDate = function(arr, sensor, value, dte) { found = false; if (value == undefined) { return false; } angular.forEach(arr, function(item, index) { if (item.name == sensor.name) { found = true; item.data.push({ t : dte, y : value }); item.data.sort(function(a, b) { if (a.t < b.t) { return -1; } if (a.t > b.t) { return 1; } return 0; }); } }); if (!found) { rgb = hexToRgb(sensor.colour); arr.push({ name : sensor.name, label : sensor.label, backgroundColor : "rgba(" + rgb.r + ", " + rgb.g + ", " + rgb.b + ", 0.2)", borderColor : "rgba(" + rgb.r + ", " + rgb.g + ", " + rgb.b + ", 1)", borderWidth : 1, fill : false, data : [ { t : new Date(), y : value } ] }); } return true;};var createDayGraph = function(id, arr, title, ind, xlabels, yhours) { var ctx = $(id); var myChart = new Chart(ctx, { type : 'line', fill : false, data : { datasets : arr, labels : xlabels }, options : { responsive : true, aspectRatio : 2, legend : { display : true }, title : { display : true, fontSize : 18, text : title }, scales : { yAxes : [ { ticks : { stepSize : ((yhours) ? (1) : (undefined)), callback : function(value, index, values) { return yhours ? (hours2Hm(value)) : (value + ind); } } } ], xAxes : [ { type : 'time', ticks : { callback : function(value, index, values) { d = new Date(value); if (d.getDate() == 1 || (d.getDate() == 31 && d.getMonth() == 11)) { return value; } return undefined; }, source : 'labels' }, time : { unit : 'day', displayFormats : { day : 'MMM DD' } }, } ] }, tooltips : { callbacks : { title : function(tooltipItem, data) { return moment(tooltipItem[0].label).format("MMMM D"); }, label : function(tooltipItem, data) { var label = data.datasets[tooltipItem.datasetIndex].label || ''; if (label) { label += ': '; } if (yhours) { h = tooltipItem.value; m = (tooltipItem.value - Math.floor(tooltipItem.value)) * 60; hh = lpad("" + Math.floor(h), 2, "0"); mm = lpad("" + Math.floor(m), 2, "0"); label += hh + ":" + mm; } else { label += (Math.round(tooltipItem.value * 100) / 100) + ind; } return label; } } } } }); return myChart;};var createMinuteGraph = function(id, arr, title, ind) { var ctx = $(id); var myChart = new Chart(ctx, { type : 'line', fill : false, data : { datasets : arr, }, options : { responsive : true, aspectRatio : 2, legend : { display : true }, title : { display : true, fontSize : 18, text : title }, scales : { yAxes : [ { ticks : { callback : function(value, index, values) { return value + ind; } } } ], xAxes : [ { type : 'time', distribution : 'linear', time : { unit : 'minute', displayFormats : { minute : "HH:mm" } }, } ] }, tooltips : { callbacks : { title : function(tooltipItem, data) { label = data.datasets[tooltipItem[0].datasetIndex].data[tooltipItem[0].index].t; return moment(label).format("MMMM Do, HH:mm:ss"); }, label : function(tooltipItem, data) { var label = data.datasets[tooltipItem.datasetIndex].label || ''; if (label) { label += ': '; } label += (Math.round(tooltipItem.value * 100) / 100) + ind; return label; } } } } }); return myChart;};app.directive('compile', [ '$compile', function($compile) { return function(scope, element, attrs) { scope.$watch(function(scope) { return scope.$eval(attrs.compile); }, function(value) { element.html(value); $compile(element.contents())(scope); }); };} ]);app.directive('imageonload', [ function() { return { restrict : 'A', link : function(scope, element, attrs) { element.bind('load', function() { scope.$apply(attrs.imageonload); }); } };} ]);app.service('apiSvc', [ "$http", "$timeout", "$interval", function($http, $timeout, $interval) { apiSvc = this; apiSvc._queue = []; apiSvc._queueTick = function() { call = apiSvc._queue.shift(); if (call) { logger("apiSvc._queueTick(): Processing queue item", "dbg"); apiSvc.queue_processing = true; apiSvc.call(call.api, call.data, function(data) { call.notify(data); $timeout(apiSvc._queueTick, 200); }, call.exludelog); } else { logger("apiSvc._queueTick(): Queue is empty", "dbg"); apiSvc.queue_processing = false; } }; apiSvc._queueCheck = function() { if (!apiSvc.queue_processing) { logger("apiSvc._queueCheck(): Starting queue processor", "dbg"); apiSvc._queueTick(); } }; $timeout(apiSvc._queueCheck, 1000); apiSvc.queue = function(api, data, notify, excludelog) { apiSvc._queue.push({ api : api, data : data, notify : notify, excludelog : excludelog }); }; apiSvc.call = function(api, data, notify, excludelog) { data = (typeof data == "function") ? data() : data; excludelog = (excludelog == undefined) ? ([]) : (Array.isArray(excludelog) ? excludelog : [ excludelog ]); txdata = {}; logtxdata = {}; for ( var attrname in data) { txdata[attrname] = data[attrname]; logtxdata[attrname] = (excludelog.indexOf(attrname) == -1) ? (data[attrname]) : ("********"); } logger("apiSvc.call('" + api + "')", "dbg"); logger(logtxdata, "dbg"); $http({ method : "POST", url : '/api/' + api + ".php", data : $.param(txdata), headers : { 'Content-Type' : 'application/x-www-form-urlencoded' } }).then(function(data) { logger("apiSvc.call(): success", "dbg"); ldata = {}; if (isJson(data.data)) { ldata = data.data; } else { logger("apiSvc.call(): malformed response", "wrn"); ldata.console = data.data.trim().split(/\r\n|\r|\n/); ldata.success = false; ldata.status = "error"; ldata.message = ""; logger(ldata, "wrn"); } if (typeof notify == "function") { logger("apiSvc.call(): calling notifier", "dbg"); notify(ldata); } }, function(data) { ldata = {}; if (data.status == -1) { logger("apiSvc.call(): No Internet", "err"); } else { logger("apiSvc.call(): HTTP failed with status code " + data.status, "err"); logger("apiSvc.call(): HTTP failed with status text '" + data.statusText + "'", "err"); } if (typeof notify == "function") { if (data.data == null) { data.data = ""; } datastr = (data.data + "").trim(); ldata.console = (datastr.length) ? (data.split(/\r\n|\r|\n/)) : ([]); ldata.success = false; ldata.status = "error"; ldata.message = ""; logger("apiSvc.call(): calling notifier", "dbg"); notify(ldata); } }); };} ]);app.controller('AboutCtrl', [ "$scope", function($scope) { $scope.app_id = app_id; $scope.build_date = build_date; $scope.api_build_date = api_build_date; $scope.app_version = app_version;} ]);app.controller('ComingSoonCtrl', [ "$scope", function($scope) { $scope.title="Coming soon";} ]);app.controller('ConfigCtrl', [ "$scope", function($scope) { $scope.title="Cofiguration";} ]);app.controller('FooterCtrl', [ "$scope", function($scope) { $scope.nowDate = Date.now();} ]);app.controller('HomeCtrl', [ "$scope", "$timeout", "$interval", "apiSvc", function($scope, $timeout, $interval, apiSvc) { $scope.title = "Home Control"; $scope.loading = true; $scope.api_calls = []; $scope.sensor_temperature = []; $scope.sensor_humidity = []; $scope.server_cpu_load = []; $scope.server_cpu_wait = []; $scope.server_temperature = []; $scope.server_mem_load = []; $scope.server_hdd_load = []; $scope.history = {}; logger("Started HomeCtrl"); $scope.preventRefresh = function(ev) { ev.preventDefault(); return false; }; var processLoad = function(history, dst, obj, val) { if (history) { if (r = objectDataByName(history, obj.name)) { logger("Processing " + r.length + " historic values into '" + obj.name + "'", "dbg"); angular.forEach(r, function(item, index) { addSensorReadingWithDate(dst, obj, item.y, new Date(item.t)); }); } } addSensorReading(dst, obj, val); }; var tidyData = function(dst) { remove = new Date(); remove.setDate(remove.getDate() - 1); angular.forEach(dst, function(item, index) { while (item.date, item.data.length > 0 && item.data[0].t <= remove) { item.data.shift(); } }); }; var updateMinuteGraph = function(g, id, src, title, units) { ret = g; if (g) { g.update(); } else { ret = createMinuteGraph(id, src, title, units); } return ret; }; var clearLog = function() { console.clear(); logger("Console log cleared"); }; $scope.console_clear_call = $interval(clearLog, 5 * 60 * 1000); var getEnv = function() { apiSvc.call("getEnv", {}, function(data) { logger("HomeCtrl::handleGetEnv()", "dbg"); logger(data, "dbg"); if (data.success) { $scope.env = data.env; var obj = {}; Object.assign(obj, $scope.env.demand); processLoad($scope.history.sensor_temperature, $scope.sensor_temperature, obj, obj.temperature); processLoad($scope.history.sensor_humidity, $scope.sensor_humidity, obj, obj.humidity); angular.forEach($scope.env.sensors, function(item, index) { processLoad($scope.history.sensor_temperature, $scope.sensor_temperature, item, item.temperature); processLoad($scope.history.sensor_humidity, $scope.sensor_humidity, item, item.humidity); }); var obj = {}; Object.assign(obj, $scope.env.pi); processLoad($scope.history.server_cpu_load, $scope.server_cpu_load, obj, obj.cpu_load); processLoad($scope.history.server_cpu_wait, $scope.server_cpu_wait, obj, obj.cpu_wait); processLoad($scope.history.server_temperature, $scope.server_temperature, obj, obj.temperature); processLoad($scope.history.server_mem_load, $scope.server_mem_load, obj, obj.mem_load); processLoad($scope.history.server_hdd_load, $scope.server_hdd_load, obj, obj.sd_load); $scope.history = {}; tidyData($scope.sensor_temperature); tidyData($scope.sensor_humidity); tidyData($scope.server_cpu_load); tidyData($scope.server_cpu_wait); tidyData($scope.server_temperature); tidyData($scope.server_mem_load); tidyData($scope.server_hdd_load); $scope.sensor_temperature_graph = updateMinuteGraph($scope.sensor_temperature_graph, '#sensor-temperature-graph', $scope.sensor_temperature, "Temperature", "°C"); $scope.sensor_humidity_graph = updateMinuteGraph($scope.sensor_humidity_graph, '#sensor-humidity-graph', $scope.sensor_humidity, "Humidity", "%"); $scope.server_cpu_load_graph = updateMinuteGraph($scope.server_cpu_load_graph, '#server-cpu_load-graph', $scope.server_cpu_load, "CPU Load", "%"); $scope.server_cpu_wait_graph = updateMinuteGraph($scope.server_cpu_wait_graph, '#server-cpu_wait-graph', $scope.server_cpu_wait, "CPU Wait", "%"); $scope.server_temperature_graph = updateMinuteGraph($scope.server_temperature_graph, '#server-temperature-graph', $scope.server_temperature, "Temperature", "°C"); $scope.server_mem_load_graph = updateMinuteGraph($scope.server_mem_load_graph, '#server-mem_load-graph', $scope.server_mem_load, "Memory Usage", "%"); $scope.server_hdd_load_graph = updateMinuteGraph($scope.server_hdd_load_graph, '#server-hdd_load-graph', $scope.server_hdd_load, "Storage Usage", "%"); } else { $scope.env = null; } if (data.message.length) { toast(data.message); } $scope.loading = false; }); }; getEnv(); $scope.env_api_call = $interval(getEnv, 5000); var getSnapshotImage = function() { apiSvc.queue("getSnapshotImage", {}, function(data) { logger("HomeCtrl::handleGetSnapshotImage()", "dbg"); logger(data, "dbg"); if (data.success) { $scope.camshot = data.camshot; } else { $scope.camshot = null; } if (data.message.length) { toast(data.message); } $scope.loading = false; }); }; getSnapshotImage(); $scope.snapshot_image_api_call = $interval(getSnapshotImage, 10000); var getApiData = function(o) { var d = new Duration(); apiSvc.queue(o.api, function() { return { today : moment().format("MMDD") }; }, function(data) { logger(o.api + "(): Data transfer: " + d.prettyEnd()); logger(data, "dbg"); if (data.success) { o.success(data); } else { } if (data.message.length) { toast(data.message); } $scope.loading = false; processApiCalls(); if (o.requeue) { logger("Call to '" + o.api + "' being requeued", "dbg") $timeout(function() { $scope.api_calls.push(o); }, Math.max(millisecondsToMidnight(), 5 * 60 * 1000)); } else { logger("Call to '" + o.api + "' singleshot - no requeue", "dbg") } }); }; var processApiCalls = function(ms) { logger("processApiCalls(): called", "dbg"); data = $scope.api_calls.shift(); if (data) { getApiData(data); } else { logger("API queue complete"); var stm = millisecondsToMidnight(); logger("Milliseconds of sleep: " + stm, "dbg"); $scope.history_api_call = $timeout(processApiCalls, Math.max(millisecondsToMidnight() + 60 * 1000, 5 * 60 * 1000)); } }; $scope.api_calls.push({ api : "schedule/getTemperature", requeue : true, success : function(data) { $scope.schedule_temperature_graph = createDayGraph('#schedule-temperature-graph', data.data, "Temperature", "°C", data.xlabels); } }); $scope.api_calls.push({ api : "schedule/getHumidity", requeue : true, success : function(data) { $scope.schedule_humidity_graph = createDayGraph('#schedule-humidity-graph', data.data, "Humidity", "%", data.xlabels); } }); $scope.api_calls.push({ api : "schedule/getSun", requeue : true, success : function(data) { angular.forEach(data.data, function(item, index) { angular.forEach(item.data, function(item, index) { ts = moment(item.t); ts.local(); h = parseFloat(ts.format("H")) + (parseFloat(ts.format("m")) / 60.0); item.t = ts.format(); item.y = h; }); }); $scope.schedule_sun_graph = createDayGraph('#schedule-sun-graph', data.data, "Sun rise and set", "", data.xlabels, true); } }); $scope.api_calls.push({ api : "schedule/getDaylight", requeue : true, success : function(data) { $scope.schedule_daylight_graph = createDayGraph('#schedule-daylight-graph', data.data, "Daylight hours", "", data.xlabels); } }); $scope.api_calls.push({ api : "history/getServerCpuLoad", success : function(data) { $scope.history.server_cpu_load = data.history; } }); $scope.api_calls.push({ api : "history/getServerCpuWait", success : function(data) { $scope.history.server_cpu_wait = data.history; } }); $scope.api_calls.push({ api : "history/getServerTemperature", success : function(data) { $scope.history.server_temperature = data.history; } }); $scope.api_calls.push({ api : "history/getServerMemoryLoad", success : function(data) { $scope.history.server_mem_load = data.history; } }); $scope.api_calls.push({ api : "history/getServerHddLoad", success : function(data) { $scope.history.server_hdd_load = data.history; } }); $scope.api_calls.push({ api : "history/getSensorTemperature", success : function(data) { $scope.history.sensor_temperature = data.history; } }); $scope.api_calls.push({ api : "history/getSensorHumidity", success : function(data) { $scope.history.sensor_humidity = data.history; } }); $scope.history_api_call = $timeout(processApiCalls, 100);} ]); \ No newline at end of file diff --git a/js/app.nopack.js b/js/app.nopack.js index 80b4981..e909359 100644 --- a/js/app.nopack.js +++ b/js/app.nopack.js @@ -96,10 +96,13 @@ colorLuminance = function(hex, lum) { }; logger = function(l, err) { + if (typeof l == "object") + return logObj(l, err); + if (!err) err = "inf"; - //msg = moment().format("YYYY-MM-DD HH:mm:ss") + "| " + l; + // msg = moment().format("YYYY-MM-DD HH:mm:ss") + "| " + l; msg = moment().format("HH:mm:ss") + "| " + l; if (err == "dbg") { console.debug(msg); @@ -678,7 +681,7 @@ app.service('apiSvc', [ "$http", "$timeout", "$interval", function($http, $timeo } logger("apiSvc.call('" + api + "')", "dbg"); - logObj(logtxdata, "dbg"); + logger(logtxdata, "dbg"); // Send it all over to the server $http({ @@ -705,7 +708,7 @@ app.service('apiSvc', [ "$http", "$timeout", "$interval", function($http, $timeo ldata.success = false; ldata.status = "error"; ldata.message = ""; - logObj(ldata, "wrn"); + logger(ldata, "wrn"); } if (typeof notify == "function") { @@ -732,7 +735,7 @@ app.service('apiSvc', [ "$http", "$timeout", "$interval", function($http, $timeo ldata.success = false; ldata.status = "error"; ldata.message = ""; - // logObj(ldata, "wrn"); + // logger(ldata, "wrn"); logger("apiSvc.call(): calling notifier", "dbg"); notify(ldata); @@ -839,7 +842,7 @@ app.controller('HomeCtrl', [ "$scope", "$timeout", "$interval", "apiSvc", functi var getEnv = function() { apiSvc.call("getEnv", {}, function(data) { logger("HomeCtrl::handleGetEnv()", "dbg"); - logObj(data, "dbg"); + logger(data, "dbg"); if (data.success) { // Save the env data first so it can be used everywhere else $scope.env = data.env; @@ -903,7 +906,7 @@ app.controller('HomeCtrl', [ "$scope", "$timeout", "$interval", "apiSvc", functi var getSnapshotImage = function() { apiSvc.queue("getSnapshotImage", {}, function(data) { logger("HomeCtrl::handleGetSnapshotImage()", "dbg"); - logObj(data, "dbg"); + logger(data, "dbg"); if (data.success) { $scope.camshot = data.camshot; } else { @@ -930,7 +933,7 @@ app.controller('HomeCtrl', [ "$scope", "$timeout", "$interval", "apiSvc", functi }; }, function(data) { logger(o.api + "(): Data transfer: " + d.prettyEnd()); - logObj(data, "dbg"); + logger(data, "dbg"); if (data.success) { o.success(data); } else { diff --git a/js/app.packed.js b/js/app.packed.js index 39458eb..87952cb 100644 --- a/js/app.packed.js +++ b/js/app.packed.js @@ -1 +1 @@ -eval(function(p,a,c,k,e,d){e=function(c){return(c=¢æ?n:Á ¢É(¢æ-n.«+1).¢Ý(z)+n};£È=£(¢°){¢°=¢°*Å;¤ £¦=°.ê(¢°/Å);¤ £ã=¢°%Å;¦ ¢¨(""+£¦,2)+":"+¢¨(""+£ã,2)};£­=£(·){¤ £â=/^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i;·=·.ò(£â,£(m,r,g,b){¦ r+r+g+g+b+b});¤ ¢±=/^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\-]{2})$/i.¤Ô(·);¦ ¢±?{r:¢Ù(¢±[1],¢²),g:¢Ù(¢±[2],¢²),b:¢Ù(¢±[3],¢²)}:Ö};¤¦=£(§){§=é §!=="Ë"?£ÿ.¤Ò(§):§;¤Ñ{§=£ÿ.¤Ð(§)}¤Ï(e){¦ ¼}¥(é §==="¤Í"&&§!==Ö){¦ µ}¦ ¼};¤Ã=£(·,¢Ö){·=Ã(·).ò(/[^0-¤Ì-f]/¤Ë,"");¥(·.«<6){·=·[0]+·[0]+·[1]+·[1]+·[2]+·[2]}¢Ö=¢Ö||0;¤ Ì="#",c,i;¢Ç(i=0;i<3;i++){c=¢Ù(·.£ú(i*2,2),¢²);c=°.¢¤(°.¤È(°.£¨(0,c+(c*¢Ö)),¤Æ)).¤Å(¢²);Ì+=("¤Ù"+c).£ú(c.«)}¦ Ì};ª=£(l,²){¥(!²)²="¢Õ";Î=¢¯().ë("¢û:¢§:£Ë")+"| "+l;¥(²=="®"){Ê.£ù(Î)}¥(²=="¢Õ"){Ê.££(Î)}¥(²=="¢Á"){Ê.£õ(Î)}¥(²=="²"){Ê.¢Æ(Î)}};û=£(Î,²){¥(!²)²="¢Õ";¥(²=="®"){Ê.£ù(Î)}¥(²=="¢Õ"){Ê.££(Î)}¥(²=="¢Á"){Ê.£õ(Î)}¥(²=="²"){Ê.¢Æ(Î)}};£ ¤Ú(¢³,¢à,¢é,¢á){¢³=(¢³+\'\').ò(/[^0-9+\\¤è.]/g,\'\');¤ n=!£¹(+¢³)?0:+¢³,ð=!£¹(+¢à)?0:°.¤ñ(¢à),£²=(é ¢á===\'õ\')?\',\':¢á,£®=(é ¢é===\'õ\')?\'.\':¢é,s=\'\',£³=£(n,ð){¤ k=°.¤í(¤ì,ð);¦\'\'+°.¢¤(n*k)/k};s=(ð?£³(n,ð):\'\'+°.¢¤(n)).¢ç(\'.\');¥(s[0].«>3){s[0]=s[0].ò(/\\d(?=(?:\\d{3})+(?!\\+))/g,£²)}¥((s[1]||\'\').«<ð){s[1]=s[1]||\'\';s[1]+=Á ¢É(ð-s[1].«+1).¢Ý(\'0\')}¦ s.¢Ý(£®)}¢É.¤é.ã=£(){¦ Â[°.¢¤((°.ã()*(Â.«-1)))]};£ ¤ç(£»){¤ ¢Þ=[\'A\',\'B\',\'C\',\'E\',\'F\',\'H\',\'J\',\'K\',\'L\',\'M\',\'N\',\'P\',\'R\',\'T\',\'W\',\'Y\',\'Z\'];¤ ¢ß=[\'a\',\'b\',\'d\',\'e\',\'g\',\'h\',\'k\',\'n\',\'p\',\'q\',\'r\',\'s\',\'t\',\'x\',\'y\',\'z\'];¤ ¢â=[\'2\',\'3\',\'4\',\'5\',\'6\',\'7\',\'8\',\'9\'];¤ ¢ä=[\'=\',\'-\',\'.\',\'_\',\'@\'];¤ ¢å=[].¢¶(¢Þ).¢¶(¢ß).¢¶(¢â);¤ £Ï=[].¢¶(¢ä).¢¶(¢å);¦ £».ò(/[¤æ]/g,£(c){¦(c===\'u\'?¢Þ.ã():(c===\'l\'?¢ß.ã():(c===\'n\'?¢â.ã():(c===\'s\'?¢ä.ã():(c===\'a\'?¢å.ã():£Ï.ã())))))})}¤ ¢ë={×:"¤á+/=",¤à:£(¹){¤ ¾="";¤ ï,ä,ß,ô,ñ,Ô,Õ;¤ i=0;¹=¢ë.£¶(¹);¢Å(i<¹.«){ï=¹.Ý(i++);ä=¹.Ý(i++);ß=¹.Ý(i++);ô=ï>>2;ñ=((ï&3)<<4)|(ä>>4);Ô=((ä&¢ô)<<2)|(ß>>6);Õ=ß&î;¥(£À(ä)){Ô=Õ=¢Ô}¸ ¥(£À(ß)){Õ=¢Ô}¾=¾+Â.×.å(ô)+Â.×.å(ñ)+Â.×.å(Ô)+Â.×.å(Õ)}¦ ¾},¤ß:£(¹){¤ ¾="";¤ ï,ä,ß;¤ ô,ñ,Ô,Õ;¤ i=0;¹=¹.ò(/[^A-¤Þ-¤Ý-9\\/\\=\\r]/g,"");¢Å(i<¹.«){ô=Â.×.¢º(¹.å(i++));ñ=Â.×.¢º(¹.å(i++));Ô=Â.×.¢º(¹.å(i++));Õ=Â.×.¢º(¹.å(i++));ï=(ô<<2)|(ñ>>4);ä=((ñ&¢ô)<<4)|(Ô>>2);ß=((Ô&3)<<6)|Õ;¾=¾+Ã.Æ(ï);¥(Ô!=¢Ô){¾=¾+Ã.Æ(ä)}¥(Õ!=¢Ô){¾=¾+Ã.Æ(ß)}}¾=¢ë.£û(¾);¦ ¾},£¶:£(Ë){Ë=Ë.ò(/\\n\\n/g,"\\|");¤ »="";¢Ç(¤ n=0;n<Ë.«;n++){¤ c=Ë.Ý(n);¥(c<¢¿){»+=Ã.Æ(c)}¸ ¥((c>¤À)&&(c<¤»)){»+=Ã.Æ((c>>6)|¤º);»+=Ã.Æ((c&î)|¢¿)}¸{»+=Ã.Æ((c>>¤¨)|¤¡);»+=Ã.Æ(((c>>6)&î)|¢¿);»+=Ã.Æ((c&î)|¢¿)}}¦ »},£û:£(»){¤ Ë="";¤ i=0;¤ c=¤¹=¢½=0;¢Å(i<».«){c=».Ý(i);¥(c<¢¿){Ë+=Ã.Æ(c);i++}¸ ¥((c>¤¶)&&(c<¤¡)){¢½=».Ý(i+1);Ë+=Ã.Æ(((c&£Á)<<6)|(¢½&î));i+=2}¸{¢½=».Ý(i+1);£ñ=».Ý(i+2);Ë+=Ã.Æ(((c&¢ô)<<¤¨)|((¢½&î)<<6)|(£ñ&î));i+=3}}¦ Ë}};¤ ¢»=Ö;£ ¢Ê(¢µ){$("#¢Î").£Õ(¢µ);¥(!$("#¢Î").¤²("¢Ï")){$("#¢Î").¤±("¢Ï")}¥(¢»===Ö){¢»=¤°(£(){¥(¢»){$("#¢Î").¤ó("¢Ï");¢»=Ö}},¤õ)}};$(¥Ê).¥á(£(){$("#£æ-¢¼").¥à();$("#£æ-¥ß").¢Ï(Ù);ª("¥Ý ¥Ü")});¤ Ó=è.¥Û("¥Ú",[\'¥Ù\']);Ó.¢ø(["$¢ü","$¢ú",£($¢ü,$¢ú){$¢ü.¥Ö(µ);$¢ú.¢ù(\'/\',{¢Ð:\'/¢Ò/¥Õ.¢·\',â:\'¢¦\'}).¢ù(\'/¤¢\',{¢Ð:\'/¢Ò/¤¢.¢·\',â:\'£è\'}).¢ù(\'/¢ø\',{¢Ð:\'/¢Ò/¢ø.¢·\',â:\'£ï\'}).¥Ó({¢Ð:\'/¢Ò/¥Ð.¢·\'})}]);¥Ï £þ{¥Î(){Â.£º=Á Ð().£ò()};£¸(){¦ Á Ð().£ò()-Â.£º};£Î(){¤ ¶="";¢ö ¢ó=1/(Å*Å*Ù);¢ö ¢ò=1/(Å*Ù);¢ö ¢ñ=1/(Ù);¤ Ï=Â.£¸();¤ h=°.ê(Ï*¢ó);Ï-=h/¢ó;¤ m=°.ê(Ï*¢ò);Ï-=m/¢ò;¤ s=°.ê(Ï*¢ñ);Ï-=s/¢ñ;¶+=(h>0)?(h+"h"):("");¶+=((¶.«>0)?(" "):(""))+((m>0||¶.«)?(m+"m"):(""));¶+=((¶.«>0)?(" "):(""))+((s>0||¶.«)?(s+"s"):(""));¶+=((¶.«>0)?(" "):(""))+Ï+"Ï";¦ ¶}};¤ £ø=£(È,Ø,¯){¦ ¢þ(È,Ø,¯,Á Ð())};¤ ¢þ=£(È,Ø,¯,£´){¢ð=¼;¥(¯==õ){¦ ¼}è.ì(È,£(§,Ç){¥(§.Ñ==Ø.Ñ){¢ð=µ;§.¢.º({t:£´,y:¯});§.¢.¥×(£(a,b){¥(a.tb.t){¦ 1}¦ 0})}});¥(!¢ð){Ì=£­(Ø.¥ã);È.º({Ñ:Ø.Ñ,±:Ø.±,¤ô:"£¼("+Ì.r+", "+Ì.g+", "+Ì.b+", 0.2)",¥û:"£¼("+Ì.r+", "+Ì.g+", "+Ì.b+", 1)",¥ù:1,¢ï:¼,¢:[{t:Á Ð(),y:¯}]})}¦ µ};¤ ¢´=£(÷,È,Ä,ö,ú,¢Û){¤ ¢Ü=$(÷);¤ ¢À=Á £Ý(¢Ü,{¢Ø:\'¤¥\',¢ï:¼,¢:{¢®:È,£°:ú},£ý:{£ü:µ,£ö:2,£×:{¢Ú:µ},Ä:{¢Ú:µ,£±:£¬,¢µ:Ä},£©:{£Ô:[{¢î:{¥ø:((¢Û)?(1):(õ)),¢í:£(¯,Ç,¢Ã){¦ ¢Û?(£È(¯)):(¯+ö)}}}],¤«:[{¢Ø:\'¢×\',¢î:{¢í:£(¯,Ç,¢Ã){d=Á Ð(¯);¥(d.¢ÿ()==1||(d.¢ÿ()==£Á&&d.¥÷()==¥ö)){¦ ¯}¦ õ},¥õ:\'£°\'},¢×:{£Â:\'£·\',£Ã:{£·:\'¥ô ¥ó\'}},}]},£Å:{£Æ:{Ä:£(À,¢){¦ ¢¯(À[0].±).ë("£Ç D")},±:£(À,¢){¤ ±=¢.¢®[À.¢ê].±||\'\';¥(±){±+=\': \'}¥(¢Û){h=À.¯;m=(À.¯-°.ê(À.¯))*Å;£á=¢¨(""+°.ê(h),2,"0");¢§=¢¨(""+°.ê(m),2,"0");±+=£á+":"+¢§}¸{±+=(°.¢¤(À.¯*¢­)/¢­)+ö}¦ ±}}}}});¦ ¢À};¤ £Ø=£(÷,È,Ä,ö){¤ ¢Ü=$(÷);¤ ¢À=Á £Ý(¢Ü,{¢Ø:\'¤¥\',¢ï:¼,¢:{¢®:È,},£ý:{£ü:µ,£ö:2,£×:{¢Ú:µ},Ä:{¢Ú:µ,£±:£¬,¢µ:Ä},£©:{£Ô:[{¢î:{¢í:£(¯,Ç,¢Ã){¦ ¯+ö}}}],¤«:[{¢Ø:\'¢×\',¥ï:\'¥î\',¢×:{£Â:\'£Ä\',£Ã:{£Ä:"¢û:¢§"}},}]},£Å:{£Æ:{Ä:£(À,¢){±=¢.¢®[À[0].¢ê].¢[À[0].Ç].t;¦ ¢¯(±).ë("£Ç ¥ì, ¢û:¢§:£Ë")},±:£(À,¢){¤ ±=¢.¢®[À.¢ê].±||\'\';¥(±){±+=\': \'}±+=(°.¢¤(À.¯*¢­)/¢­)+ö;¦ ±}}}}});¦ ¢À};Ó.£µ(\'¢«\',[\'$¢«\',£($¢«){¦ £(¡,¢ª,¢Ä){¡.$¥è(£(¡){¦ ¡.$¥ç(¢Ä.¢«)},£(¯){¢ª.£Õ(¯);$¢«(¢ª.¥É())(¡)})}}]);Ó.£µ(\'£ª\',[£(){¦{¥°:\'A\',¥È:£(¡,¢ª,¢Ä){¢ª.¥­(\'¥¬\',£(){¡.$¥«(¢Ä.£ª)})}}}]);Ó.¥©(\'©\',["$¢ý","$Ú","$í",£($¢ý,$Ú,$í){©=Â;©.¢÷=[];©.¢©=£(){´=©.¢÷.£¡();¥(´){ª("©.¢©(): ¤© ¢¢ §","®");©.¢ì=µ;©.´(´.­,´.¢,£(¢){´.Û(¢);$Ú(©.¢©,¥§)},´.¥¦)}¸{ª("©.¢©(): ¥¥ ¥¤ ¥¢","®");©.¢ì=¼}};©.¢õ=£(){¥(!©.¢ì){ª("©.¢õ(): ¤ö ¢¢ ¥¡","®");©.¢©()}};$Ú(©.¢õ,Ù);©.¢¢=£(­,¢,Û,Ò){©.¢÷.º({­:­,¢:¢,Û:Û,Ò:Ò})};©.´=£(­,¢,Û,Ò){¢=(é ¢=="£")?¢():¢;Ò=(Ò==õ)?([]):(¢É.¤ý(Ò)?Ò:[Ò]);¢ã={};¢è={};¢Ç(¤ ø ¤û ¢){¢ã[ø]=¢[ø];¢è[ø]=(Ò.¢º(ø)==-1)?(¢[ø]):("********")}ª("©.´(\'"+­+"\')","®");û(¢è,"®");$¢ý({¤ø:"¤÷",¥®:\'/­/\'+­+".¢·",¢:$.¥£(¢ã),¥½:{\'¥Ç-¥Æ\':\'¥Å/x-¥Ä-¥Ã-¥Â\'}}).¢Â(£(¢){ª("©.´(): ³","®");½={};¥(¤¦(¢.¢)){½=¢.¢}¸{ª("©.´(): ¥À ¥¿","¢Á");½.Ê=¢.¢.£ß().¢ç(/\\r\\n|\\r|\\n/);½.³=¼;½.ù="¢Æ";½.à="";û(½,"¢Á")}¥(é Û=="£"){ª("©.´(): £Ù £ä","®");Û(½)}},£(¢){½={};¥(¢.ù==-1){ª("©.´(): ¥¾ ¥¼","²")}¸{ª("©.´(): £å £ð £Ú ù ¥± "+¢.ù,"²");ª("©.´(): £å £ð £Ú ù ¢µ \'"+¢.¥»+"\'","²")}¥(é Û=="£"){¥(¢.¢==Ö){¢.¢=""}£à=(¢.¢+"").£ß();½.Ê=(£à.«)?(¢.¢ç(/\\r\\n|\\|\\/)):([]);½.³=¼;½.ù="¢Æ";½.à="";ª("©.´(): £Ù £ä","®");Û(½)}})}}]);Ó.â(\'£è\',["$¡",£($¡){$¡.£é=£é;$¡.£ê=£ê;$¡.£ë=£ë;$¡.£ì=£ì}]);Ó.â(\'¥´\',["$¡",£($¡){$¡.Ä="¥³ ¥²"}]);Ó.â(\'£ï\',["$¡",£($¡){$¡.Ä="¥ñ"}]);Ó.â(\'¤¬\',["$¡",£($¡){$¡.¥µ=Ð.¢Ë()}]);Ó.â(\'¢¦\',["$¡","$Ú","$í","©",£($¡,$Ú,$í,©){$¡.Ä="¥¶ ¥·";$¡.¢¼=µ;$¡.¿=[];$¡.Ü=[];$¡.á=[];$¡.þ=[];$¡.ó=[];$¡.¢¥=[];$¡.¢£=[];$¡.ý=[];$¡.¨={};ª("¥¸ ¢¦");$¡.¥¹=£(£Þ){£Þ.¥º();¦ ¼};¤ Í=£(¨,¢¾,¬,£÷){¥(¨){¥(r=£Û(¨,¬.Ñ)){ª("¤© "+r.«+" ¥Á ¢Ã ¥¯ \'"+¬.Ñ+"\'","®");è.ì(r,£(§,Ç){¢þ(¢¾,¬,§.y,Á Ð(§.t))})}}£ø(¢¾,¬,£÷)};¤ Þ=£(¢¾){¢È=Á Ð();¢È.¤ù(¢È.¢ÿ()-1);è.ì(¢¾,£(§,Ç){¢Å(§.¤ú,§.¢.«>0&&§.¢[0].t<=¢È){§.¢.£¡()}})};¤ ç=£(g,÷,£Ê,Ä,£Ö){¶=g;¥(g){g.¤ü()}¸{¶=£Ø(÷,£Ê,Ä,£Ö)}¦ ¶};¤ £«=£(){Ê.¤þ();ª("¤ÿ ££ ¥¨")};$¡.¥ª=$í(£«,5*Å*Ù);¤ ¢Ì=£(){©.´("¢Ì",{},£(¢){ª("¢¦::¥ä()","®");û(¢,"®");¥(¢.³){$¡.¢¡=¢.¢¡;¤ ¬={};£Ñ.£Ð(¬,$¡.¢¡.¥æ);Í($¡.¨.Ü,$¡.Ü,¬,¬.ÿ);Í($¡.¨.á,$¡.á,¬,¬.¢Í);è.ì($¡.¢¡.¥é,£(§,Ç){Í($¡.¨.Ü,$¡.Ü,§,§.ÿ);Í($¡.¨.á,$¡.á,§,§.¢Í)});¤ ¬={};£Ñ.£Ð(¬,$¡.¢¡.¥ê);Í($¡.¨.þ,$¡.þ,¬,¬.£¾);Í($¡.¨.ó,$¡.ó,¬,¬.£ô);Í($¡.¨.¢¥,$¡.¢¥,¬,¬.ÿ);Í($¡.¨.¢£,$¡.¢£,¬,¬.¤§);Í($¡.¨.ý,$¡.ý,¬,¬.¥ë);$¡.¨={};Þ($¡.Ü);Þ($¡.á);Þ($¡.þ);Þ($¡.ó);Þ($¡.¢¥);Þ($¡.¢£);Þ($¡.ý);$¡.£Í=ç($¡.£Í,\'#Ø-ÿ-É\',$¡.Ü,"£§","\\£¢\\£¥");$¡.£Ì=ç($¡.£Ì,\'#Ø-¢Í-É\',$¡.á,"£î","%");$¡.£É=ç($¡.£É,\'#¢¬-£¾-É\',$¡.þ,"£Ò ¥í","%");$¡.£¿=ç($¡.£¿,\'#¢¬-£ô-É\',$¡.ó,"£Ò ¥å","%");$¡.£ó=ç($¡.£ó,\'#¢¬-ÿ-É\',$¡.¢¥,"£§","\\£¢\\£¥");$¡.¤¤=ç($¡.¤¤,\'#¢¬-¤§-É\',$¡.¢£,"¥ð £¯","%");$¡.£í=ç($¡.£í,\'#¢¬-¥ò-É\',$¡.ý,"¥ú £¯","%")}¸{$¡.¢¡=Ö}¥(¢.à.«){¢Ê(¢.à)}$¡.¢¼=¼})};¢Ì();$¡.¥â=$í(¢Ì,¥Ì);¤ ¢Ñ=£(){©.¢¢("¢Ñ",{},£(¢){ª("¢¦::¥Í()","®");û(¢,"®");¥(¢.³){$¡.£¤=¢.£¤}¸{$¡.£¤=Ö}¥(¢.à.«){¢Ê(¢.à)}$¡.¢¼=¼})};¢Ñ();$¡.¥Ñ=$í(¢Ñ,¥Ò);¤ ¤£=£(o){¤ d=Á £þ();©.¢¢(o.­,£(){¦{¥Ô:¢¯().ë("¥Ë")}},£(¢){ª(o.­+"(): ¥Ø ¥Þ: "+d.£Î());û(¢,"®");¥(¢.³){o.³(¢)}¸{}¥(¢.à.«){¢Ê(¢.à)}$¡.¢¼=¼;¢¹();¥(o.ü){ª("£Ü ¤ª \'"+o.­+"\' ¤¯ ¤³","®")$Ú(£(){$¡.¿.º(o)},°.£¨(¢Ó(),5*Å*Ù))}¸{ª("£Ü ¤ª \'"+o.­+"\' ¤´ - ¤µ ü","®")}})};¤ ¢¹=£(Ï){ª("¢¹(): ¤®","®");¢=$¡.¿.£¡();¥(¢){¤£(¢)}¸{ª("¤¸ ¢¢ ¤¼");¤ £½=¢Ó();ª("¤½ ¤¾ ¤¿: "+£½,"®");$¡.£ç=$Ú(¢¹,°.£¨(¢Ó()+Å*Ù,5*Å*Ù))}};$¡.¿.º({­:"æ/¤·",ü:µ,³:£(¢){$¡.¤­=¢´(\'#æ-ÿ-É\',¢.¢,"£§","\\£¢\\£¥",¢.ú)}});$¡.¿.º({­:"æ/¤Â",ü:µ,³:£(¢){$¡.¤Û=¢´(\'#æ-¢Í-É\',¢.¢,"£î","%",¢.ú)}});$¡.¿.º({­:"æ/¤Á",ü:µ,³:£(¢){è.ì(¢.¢,£(§,Ç){è.ì(§.¢,£(§,Ç){¢¸=¢¯(§.t);¢¸.¤â();h=£Ó(¢¸.ë("H"))+(£Ó(¢¸.ë("m"))/Å.0);§.t=¢¸.ë();§.y=h})});$¡.¤ã=¢´(\'#æ-¤ä-É\',¢.¢,"¤å ¤Ü ¤ê ¤ë","",¢.ú,µ)}});$¡.¿.º({­:"æ/¤î",ü:µ,³:£(¢){$¡.¤ï=¢´(\'#æ-¤ð-É\',¢.¢,"¤ò £¦","",¢.ú)}});$¡.¿.º({­:"¨/¤Î",³:£(¢){$¡.¨.þ=¢.¨}});$¡.¿.º({­:"¨/¤Ä",³:£(¢){$¡.¨.ó=¢.¨}});$¡.¿.º({­:"¨/¤Ç",³:£(¢){$¡.¨.¢¥=¢.¨}});$¡.¿.º({­:"¨/¤É",³:£(¢){$¡.¨.¢£=¢.¨}});$¡.¿.º({­:"¨/¤Ê",³:£(¢){$¡.¨.ý=¢.¨}});$¡.¿.º({­:"¨/¤Ó",³:£(¢){$¡.¨.Ü=¢.¨}});$¡.¿.º({­:"¨/¤Õ",³:£(¢){$¡.¨.á=¢.¨}});$¡.£ç=$Ú(¢¹,¢­)}]);',95,472,'scope|data|function|var|if|return|item|history|apiSvc|logger|length|obj|api|dbg|value|Math|label|err|success|call|true|ret|hex|else|input|push|utftext|false|ldata|output|api_calls|tooltipItem|new|this|String|title|60|fromCharCode|index|arr|graph|console|string|rgb|processLoad|msg|ms|Date|name|excludelog|app|enc3|enc4|null|_keyStr|sensor|1000|timeout|notify|sensor_temperature|charCodeAt|tidyData|chr3|message|sensor_humidity|controller|random|chr2|charAt|schedule|updateMinuteGraph|angular|typeof|floor|format|forEach|interval|63|chr1|prec|enc2|replace|server_cpu_wait|enc1|undefined|ind|id|attrname|status|xlabels|logObj|requeue|server_hdd_load|server_cpu_load|temperature|env|queue|server_mem_load|round|server_temperature|HomeCtrl|mm|lpad|_queueTick|element|compile|server|100|datasets|moment|num|result|16|number|createDayGraph|text|concat|php|ts|processApiCalls|indexOf|toastTimeout|loading|c2|dst|128|myChart|wrn|then|values|attrs|while|error|for|remove|Array|toast|now|getEnv|humidity|snackbar|show|templateUrl|getSnapshotImage|pages|millisecondsToMidnight|64|inf|lum|time|type|parseInt|display|yhours|ctx|join|uc|lc|decimals|thousands_sep|nc|txdata|sc|an|width|split|logtxdata|dec_point|datasetIndex|Base64|queue_processing|callback|ticks|fill|found|ms2s|ms2m|ms2h|15|_queueCheck|const|_queue|config|when|routeProvider|HH|locationProvider|http|addSensorReadingWithDate|getDate|shift|xc2|log|camshot|xb0C|hours|Temperature|max|scales|imageonload|clearLog|18|hexToRgb|dec|Usage|labels|fontSize|sep|toFixedFix|dte|directive|_utf8_encode|day|end|isFinite|start|key|rgba|stm|cpu_load|server_cpu_wait_graph|isNaN|31|unit|displayFormats|minute|tooltips|callbacks|MMMM|hours2Hm|server_cpu_load_graph|src|ss|sensor_humidity_graph|sensor_temperature_graph|prettyEnd|ny|assign|Object|CPU|parseFloat|yAxes|html|units|legend|createMinuteGraph|calling|with|objectDataByName|Call|Chart|ev|trim|datastr|hh|shorthandRegex|minutes|notifier|HTTP|page|history_api_call|AboutCtrl|app_id|build_date|api_build_date|app_version|server_hdd_load_graph|Humidity|ConfigCtrl|failed|c3|getTime|server_temperature_graph|cpu_wait|warn|aspectRatio|val|addSensorReading|debug|substr|_utf8_decode|responsive|options|Duration|JSON|224|about|getApiData|server_mem_load_graph|line|isJson|mem_load|12|Processing|to|xAxes|FooterCtrl|schedule_temperature_graph|called|being|setTimeout|addClass|hasClass|requeued|singleshot|no|191|getTemperature|API|c1|192|2048|complete|Milliseconds|of|sleep|127|getSun|getHumidity|colorLuminance|getServerCpuWait|toString|255|getServerTemperature|min|getServerMemoryLoad|getServerHddLoad|gi|9a|object|getServerCpuLoad|catch|parse|try|stringify|getSensorTemperature|exec|getSensorHumidity|24|setHours|points|00|number_format|schedule_humidity_graph|rise|z0|Za|decode|encode|ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789|local|schedule_sun_graph|sun|Sun|xlunas|genKey|BEe|prototype|and|set|10|pow|getDaylight|schedule_daylight_graph|daylight|abs|Daylight|removeClass|backgroundColor|2990|Starting|POST|method|setDate|date|in|update|isArray|clear|Console|processor|empty|param|is|Queue|exludelog|200|cleared|service|console_clear_call|apply|load|bind|url|into|restrict|code|soon|Coming|ComingSoonCtrl|nowDate|Home|Control|Started|preventRefresh|preventDefault|statusText|Internet|headers|No|response|malformed|historic|urlencoded|form|www|application|Type|Content|link|contents|document|MMDD|5000|handleGetSnapshotImage|constructor|class|404|snapshot_image_api_call|10000|otherwise|today|home|html5Mode|sort|Data|ngRoute|myApp|module|Loaded|Application|transfer|loaded|hide|ready|env_api_call|colour|handleGetEnv|Wait|demand|eval|watch|sensors|pi|sd_load|Do|Load|linear|distribution|Memory|Cofiguration|hdd_load|DD|MMM|source|11|getMonth|stepSize|borderWidth|Storage|borderColor|Found'.split('|'))) +eval(function(p,a,c,k,e,d){e=function(c){return(c=¢å?n:Á ¢È(¢å-n.«+1).¢Ü(z)+n};£Ø=£(¢¯){¢¯=¢¯*Å;¤ ¢þ=±.î(¢¯/Å);¤ £ï=¢¯%Å;¦ ¢¦(""+¢þ,2)+":"+¢¦(""+£ï,2)};£»=£(·){¤ £î=/^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i;·=·.ë(£î,£(m,r,g,b){¦ r+r+g+g+b+b});¤ ¢°=/^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\-]{2})$/i.¤Ô(·);¦ ¢°?{r:¢Ø(¢°[1],¢±),g:¢Ø(¢°[2],¢±),b:¢Ø(¢°[3],¢±)}:Ö};£ú=£(§){§=å §!=="Ë"?£ã.¤Ò(§):§;¤Ñ{§=£ã.¤Ð(§)}¤Ï(e){¦ ¼}¥(å §==="¤¦"&&§!==Ö){¦ µ}¦ ¼};¤Í=£(·,¢Õ){·=Ã(·).ë(/[^0-¤Ã-f]/¤Ì,"");¥(·.«<6){·=·[0]+·[0]+·[1]+·[1]+·[2]+·[2]}¢Õ=¢Õ||0;¤ Ì="#",c,i;¢Æ(i=0;i<3;i++){c=¢Ø(·.£ý(i*2,2),¢±);c=±.ÿ(±.¤É(±.£¢(0,c+(c*¢Õ)),¤Ç)).¤Æ(¢±);Ì+=("¤Ä"+c).£ý(c.«)}¦ Ì};ª=£(l,°){¥(å l=="¤¦")¦ ¤¥(l,°);¥(!°)°="¢Ô";Î=¢®().ï("¢ú:¢§:£¬")+"| "+l;¥(°=="¯"){Ê.¤¢(Î)}¥(°=="¢Ô"){Ê.¢ý(Î)}¥(°=="¢À"){Ê.£þ(Î)}¥(°=="°"){Ê.¢Å(Î)}};¤¥=£(Î,°){¥(!°)°="¢Ô";¥(°=="¯"){Ê.¤¢(Î)}¥(°=="¢Ô"){Ê.¢ý(Î)}¥(°=="¢À"){Ê.£þ(Î)}¥(°=="°"){Ê.¢Å(Î)}};£ ¤Î(¢²,¢ß,¢è,¢à){¢²=(¢²+\'\').ë(/[^0-9+\\¤Ú.]/g,\'\');¤ n=!¤«(+¢²)?0:+¢²,ì=!¤«(+¢ß)?0:±.¤ñ(¢ß),£¹=(å ¢à===\'ö\')?\',\':¢à,£¨=(å ¢è===\'ö\')?\'.\':¢è,s=\'\',£¸=£(n,ì){¤ k=±.¤í(¤ì,ì);¦\'\'+±.ÿ(n*k)/k};s=(ì?£¸(n,ì):\'\'+±.ÿ(n)).¢æ(\'.\');¥(s[0].«>3){s[0]=s[0].ë(/\\d(?=(?:\\d{3})+(?!\\+))/g,£¹)}¥((s[1]||\'\').«<ì){s[1]=s[1]||\'\';s[1]+=Á ¢È(ì-s[1].«+1).¢Ü(\'0\')}¦ s.¢Ü(£¨)}¢È.¤é.ã=£(){¦ Â[±.ÿ((±.ã()*(Â.«-1)))]};£ ¤è(£·){¤ ¢Ý=[\'A\',\'B\',\'C\',\'E\',\'F\',\'H\',\'J\',\'K\',\'L\',\'M\',\'N\',\'P\',\'R\',\'T\',\'W\',\'Y\',\'Z\'];¤ ¢Þ=[\'a\',\'b\',\'d\',\'e\',\'g\',\'h\',\'k\',\'n\',\'p\',\'q\',\'r\',\'s\',\'t\',\'x\',\'y\',\'z\'];¤ ¢á=[\'2\',\'3\',\'4\',\'5\',\'6\',\'7\',\'8\',\'9\'];¤ ¢ã=[\'=\',\'-\',\'.\',\'_\',\'@\'];¤ ¢ä=[].¢µ(¢Ý).¢µ(¢Þ).¢µ(¢á);¤ £¿=[].¢µ(¢ã).¢µ(¢ä);¦ £·.ë(/[¤Ü]/g,£(c){¦(c===\'u\'?¢Ý.ã():(c===\'l\'?¢Þ.ã():(c===\'n\'?¢á.ã():(c===\'s\'?¢ã.ã():(c===\'a\'?¢ä.ã():£¿.ã())))))})}¤ ¢ê={×:"¤à+/=",¤ß:£(¹){¤ ¾="";¤ ð,ä,ß,ú,ê,Û,Õ;¤ i=0;¹=¢ê.£©(¹);¢Ä(i<¹.«){ð=¹.Þ(i++);ä=¹.Þ(i++);ß=¹.Þ(i++);ú=ð>>2;ê=((ð&3)<<4)|(ä>>4);Û=((ä&¢ó)<<2)|(ß>>6);Õ=ß&í;¥(£Ö(ä)){Û=Õ=¢Ó}¸ ¥(£Ö(ß)){Õ=¢Ó}¾=¾+Â.×.ç(ú)+Â.×.ç(ê)+Â.×.ç(Û)+Â.×.ç(Õ)}¦ ¾},¤Þ:£(¹){¤ ¾="";¤ ð,ä,ß;¤ ú,ê,Û,Õ;¤ i=0;¹=¹.ë(/[^A-¤Ý-¤Û-9\\/\\=\\r]/g,"");¢Ä(i<¹.«){ú=Â.×.¢¹(¹.ç(i++));ê=Â.×.¢¹(¹.ç(i++));Û=Â.×.¢¹(¹.ç(i++));Õ=Â.×.¢¹(¹.ç(i++));ð=(ú<<2)|(ê>>4);ä=((ê&¢ó)<<4)|(Û>>2);ß=((Û&3)<<6)|Õ;¾=¾+Ã.Æ(ð);¥(Û!=¢Ó){¾=¾+Ã.Æ(ä)}¥(Õ!=¢Ó){¾=¾+Ã.Æ(ß)}}¾=¢ê.¤©(¾);¦ ¾},£©:£(Ë){Ë=Ë.ë(/\\n\\n/g,"\\|");¤ »="";¢Æ(¤ n=0;n<Ë.«;n++){¤ c=Ë.Þ(n);¥(c<¢¾){»+=Ã.Æ(c)}¸ ¥((c>¤±)&&(c<¤µ)){»+=Ã.Æ((c>>6)|¤¶);»+=Ã.Æ((c&í)|¢¾)}¸{»+=Ã.Æ((c>>£â)|£ü);»+=Ã.Æ(((c>>6)&í)|¢¾);»+=Ã.Æ((c&í)|¢¾)}}¦ »},¤©:£(»){¤ Ë="";¤ i=0;¤ c=¤º=¢¼=0;¢Ä(i<».«){c=».Þ(i);¥(c<¢¾){Ë+=Ã.Æ(c);i++}¸ ¥((c>¤½)&&(c<£ü)){¢¼=».Þ(i+1);Ë+=Ã.Æ(((c&£×)<<6)|(¢¼&í));i+=2}¸{¢¼=».Þ(i+1);£é=».Þ(i+2);Ë+=Ã.Æ(((c&¢ó)<<£â)|((¢¼&í)<<6)|(£é&í));i+=3}}¦ Ë}};¤ ¢º=Ö;£ ¢É(¢´){$("#¢Í").£µ(¢´);¥(!$("#¢Í").¤®("¢Î")){$("#¢Í").¤¯("¢Î")}¥(¢º===Ö){¢º=¤°(£(){¥(¢º){$("#¢Í").¤ô("¢Î");¢º=Ö}},¥É)}};$(¥à).¥ß(£(){$("#£ò-¢»").¥Þ();$("#£ò-¥Ý").¢Î(Ù);ª("¥Û ¥Ú")});¤ Ó=é.¥Ù("¥Ø",[\'¥×\']);Ó.¢÷(["$¢û","$¢ù",£($¢û,$¢ù){$¢û.¥Ê(µ);$¢ù.¢ø(\'/\',{¢Ï:\'/¢Ñ/¥Ó.¢¶\',â:\'¢©\'}).¢ø(\'/¤¬\',{¢Ï:\'/¢Ñ/¤¬.¢¶\',â:\'£ô\'}).¢ø(\'/¢÷\',{¢Ï:\'/¢Ñ/¢÷.¢¶\',â:\'£ù\'}).¥Ñ({¢Ï:\'/¢Ñ/¥Î.¢¶\'})}]);¥Í ¤ª{¥Ì(){Â.£ß=Á Ð().¤§()};£Þ(){¦ Á Ð().¤§()-Â.£ß};£¯(){¤ ¶="";¢õ ¢ò=1/(Å*Å*Ù);¢õ ¢ñ=1/(Å*Ù);¢õ ¢ð=1/(Ù);¤ Ï=Â.£Þ();¤ h=±.î(Ï*¢ò);Ï-=h/¢ò;¤ m=±.î(Ï*¢ñ);Ï-=m/¢ñ;¤ s=±.î(Ï*¢ð);Ï-=s/¢ð;¶+=(h>0)?(h+"h"):("");¶+=((¶.«>0)?(" "):(""))+((m>0||¶.«)?(m+"m"):(""));¶+=((¶.«>0)?(" "):(""))+((s>0||¶.«)?(s+"s"):(""));¶+=((¶.«>0)?(" "):(""))+Ï+"Ï";¦ ¶}};¤ ¤¤=£(È,Ø,®){¦ £¡(È,Ø,®,Á Ð())};¤ £¡=£(È,Ø,®,£½){¢ï=¼;¥(®==ö){¦ ¼}é.ò(È,£(§,Ç){¥(§.Ñ==Ø.Ñ){¢ï=µ;§.¢.º({t:£½,y:®});§.¢.¥â(£(a,b){¥(a.tb.t){¦ 1}¦ 0})}});¥(!¢ï){Ì=£»(Ø.¥ð);È.º({Ñ:Ø.Ñ,²:Ø.²,¤ó:"£³("+Ì.r+", "+Ì.g+", "+Ì.b+", 0.2)",¥ú:"£³("+Ì.r+", "+Ì.g+", "+Ì.b+", 1)",¥ø:1,¢î:¼,¢:[{t:Á Ð(),y:®}]})}¦ µ};¤ ¢³=£(ô,È,Ä,ó,ü,¢Û){¤ ¢Ú=$(ô);¤ ¢¿=Á £Å(¢Ú,{¢×:\'£Ç\',¢î:¼,¢:{¢­:È,£û:ü},£Ê:{£Ë:µ,£Ì:2,£Í:{¢Ù:µ},Ä:{¢Ù:µ,£Á:£Î,¢´:Ä},£Ð:{£Ñ:[{¢í:{¥÷:((¢Û)?(1):(ö)),¢ì:£(®,Ç,¢Â){¦ ¢Û?(£Ø(®)):(®+ó)}}}],£Ô:[{¢×:\'¢Ö\',¢í:{¢ì:£(®,Ç,¢Â){d=Á Ð(®);¥(d.£¥()==1||(d.£¥()==£×&&d.¥ö()==¥õ)){¦ ®}¦ ö},¥ô:\'£û\'},¢Ö:{£Ù:\'£ª\',£Ú:{£ª:\'¥ó ¥ò\'}},}]},£Ü:{£Ï:{Ä:£(À,¢){¦ ¢®(À[0].²).ï("£Ý D")},²:£(À,¢){¤ ²=¢.¢­[À.¢é].²||\'\';¥(²){²+=\': \'}¥(¢Û){h=À.®;m=(À.®-±.î(À.®))*Å;£Ä=¢¦(""+±.î(h),2,"0");¢§=¢¦(""+±.î(m),2,"0");²+=£Ä+":"+¢§}¸{²+=(±.ÿ(À.®*¢¬)/¢¬)+ó}¦ ²}}}}});¦ ¢¿};¤ ¤¨=£(ô,È,Ä,ó){¤ ¢Ú=$(ô);¤ ¢¿=Á £Å(¢Ú,{¢×:\'£Ç\',¢î:¼,¢:{¢­:È,},£Ê:{£Ë:µ,£Ì:2,£Í:{¢Ù:µ},Ä:{¢Ù:µ,£Á:£Î,¢´:Ä},£Ð:{£Ñ:[{¢í:{¢ì:£(®,Ç,¢Â){¦ ®+ó}}}],£Ô:[{¢×:\'¢Ö\',¥î:\'¥í\',¢Ö:{£Ù:\'£Û\',£Ú:{£Û:"¢ú:¢§"}},}]},£Ü:{£Ï:{Ä:£(À,¢){²=¢.¢­[À[0].¢é].¢[À[0].Ç].t;¦ ¢®(²).ï("£Ý ¥ë, ¢ú:¢§:£¬")},²:£(À,¢){¤ ²=¢.¢­[À.¢é].²||\'\';¥(²){²+=\': \'}²+=(±.ÿ(À.®*¢¬)/¢¬)+ó;¦ ²}}}}});¦ ¢¿};Ó.£¾(\'¢ª\',[\'$¢ª\',£($¢ª){¦ £(¡,¢«,¢Ã){¡.$¥ç(£(¡){¦ ¡.$¥æ(¢Ã.¢ª)},£(®){¢«.£µ(®);$¢ª(¢«.¥È())(¡)})}}]);Ó.£¾(\'£º\',[£(){¦{¥¯:\'A\',¥Ç:£(¡,¢«,¢Ã){¢«.¥¬(\'¥«\',£(){¡.$¥ª(¢Ã.£º)})}}}]);Ó.¥¨(\'©\',["$¢ç","$Ô","$ñ",£($¢ç,$Ô,$ñ){©=Â;©.¢ö=[];©.¢¥=£(){´=©.¢ö.¢ÿ();¥(´){ª("©.¢¥(): £á þ §","¯");©.¢ë=µ;©.´(´.­,´.¢,£(¢){´.Ú(¢);$Ô(©.¢¥,¥¦)},´.¥¥)}¸{ª("©.¢¥(): ¥¤ ¥£ ¥¡","¯");©.¢ë=¼}};©.¢ô=£(){¥(!©.¢ë){ª("©.¢ô(): ¤õ þ ¤ÿ","¯");©.¢¥()}};$Ô(©.¢ô,Ù);©.þ=£(­,¢,Ú,Ò){©.¢ö.º({­:­,¢:¢,Ú:Ú,Ò:Ò})};©.´=£(­,¢,Ú,Ò){¢=(å ¢=="£")?¢():¢;Ò=(Ò==ö)?([]):(¢È.¤ü(Ò)?Ò:[Ò]);¢â={};¢ü={};¢Æ(¤ û ¤ú ¢){¢â[û]=¢[û];¢ü[û]=(Ò.¢¹(û)==-1)?(¢[û]):("********")}ª("©.´(\'"+­+"\')","¯");ª(¢ü,"¯");$¢ç({¤÷:"¤ö",¥­:\'/­/\'+­+".¢¶",¢:$.¥¢(¢â),¥¼:{\'¥Æ-¥Å\':\'¥Ä/x-¥Ã-¥Â-¥Á\'}}).¢Á(£(¢){ª("©.´(): ³","¯");½={};¥(£ú(¢.¢)){½=¢.¢}¸{ª("©.´(): ¥¿ ¥¾","¢À");½.Ê=¢.¢.£à().¢æ(/\\r\\n|\\r|\\n/);½.³=¼;½.õ="¢Å";½.à="";ª(½,"¢À")}¥(å Ú=="£"){ª("©.´(): £ð £ñ","¯");Ú(½)}},£(¢){½={};¥(¢.õ==-1){ª("©.´(): ¥½ ¥»","°")}¸{ª("©.´(): £å £æ £ç õ ¥° "+¢.õ,"°");ª("©.´(): £å £æ £ç õ ¢´ \'"+¢.¥º+"\'","°")}¥(å Ú=="£"){¥(¢.¢==Ö){¢.¢=""}£ì=(¢.¢+"").£à();½.Ê=(£ì.«)?(¢.¢æ(/\\r\\n|\\|\\/)):([]);½.³=¼;½.õ="¢Å";½.à="";ª("©.´(): £ð £ñ","¯");Ú(½)}})}}]);Ó.â(\'£ô\',["$¡",£($¡){$¡.£õ=£õ;$¡.£ö=£ö;$¡.£÷=£÷;$¡.£ø=£ø}]);Ó.â(\'¥³\',["$¡",£($¡){$¡.Ä="¥² ¥±"}]);Ó.â(\'£ù\',["$¡",£($¡){$¡.Ä="¥û"}]);Ó.â(\'¤Á\',["$¡",£($¡){$¡.¥´=Ð.¢Ê()}]);Ó.â(\'¢©\',["$¡","$Ô","$ñ","©",£($¡,$Ô,$ñ,©){$¡.Ä="¥µ ¥¶";$¡.¢»=µ;$¡.¿=[];$¡.Ü=[];$¡.á=[];$¡.ý=[];$¡.¢¡=[];$¡.¢¢=[];$¡.¢¤=[];$¡.÷=[];$¡.¨={};ª("¥· ¢©");$¡.¥¸=£(£ë){£ë.¥¹();¦ ¼};¤ Í=£(¨,¢½,¬,¤£){¥(¨){¥(r=£è(¨,¬.Ñ)){ª("£á "+r.«+" ¥À ¢Â ¥® \'"+¬.Ñ+"\'","¯");é.ò(r,£(§,Ç){£¡(¢½,¬,§.y,Á Ð(§.t))})}}¤¤(¢½,¬,¤£)};¤ Ý=£(¢½){¢Ç=Á Ð();¢Ç.¤ø(¢Ç.£¥()-1);é.ò(¢½,£(§,Ç){¢Ä(§.¤ù,§.¢.«>0&&§.¢[0].t<=¢Ç){§.¢.¢ÿ()}})};¤ æ=£(g,ô,£ÿ,Ä,¤¡){¶=g;¥(g){g.¤û()}¸{¶=¤¨(ô,£ÿ,Ä,¤¡)}¦ ¶};¤ £¼=£(){Ê.¤ý();ª("¤þ ¢ý ¥§")};$¡.¥©=$ñ(£¼,5*Å*Ù);¤ ¢Ë=£(){©.´("¢Ë",{},£(¢){ª("¢©::¥ã()","¯");ª(¢,"¯");¥(¢.³){$¡.¢£=¢.¢£;¤ ¬={};£±.£°(¬,$¡.¢£.¥å);Í($¡.¨.Ü,$¡.Ü,¬,¬.ù);Í($¡.¨.á,$¡.á,¬,¬.¢Ì);é.ò($¡.¢£.¥è,£(§,Ç){Í($¡.¨.Ü,$¡.Ü,§,§.ù);Í($¡.¨.á,$¡.á,§,§.¢Ì)});¤ ¬={};£±.£°(¬,$¡.¢£.¥é);Í($¡.¨.ý,$¡.ý,¬,¬.£À);Í($¡.¨.¢¡,$¡.¢¡,¬,¬.£Ó);Í($¡.¨.¢¢,$¡.¢¢,¬,¬.ù);Í($¡.¨.¢¤,$¡.¢¤,¬,¬.£Æ);Í($¡.¨.÷,$¡.÷,¬,¬.¥ê);$¡.¨={};Ý($¡.Ü);Ý($¡.á);Ý($¡.ý);Ý($¡.¢¡);Ý($¡.¢¢);Ý($¡.¢¤);Ý($¡.÷);$¡.£®=æ($¡.£®,\'#Ø-ù-É\',$¡.Ü,"££","\\£¤\\£§");$¡.£­=æ($¡.£­,\'#Ø-¢Ì-É\',$¡.á,"£Â","%");$¡.£«=æ($¡.£«,\'#¢¨-£À-É\',$¡.ý,"£Ò ¥ì","%");$¡.£Õ=æ($¡.£Õ,\'#¢¨-£Ó-É\',$¡.¢¡,"£Ò ¥ä","%");$¡.£É=æ($¡.£É,\'#¢¨-ù-É\',$¡.¢¢,"££","\\£¤\\£§");$¡.£È=æ($¡.£È,\'#¢¨-£Æ-É\',$¡.¢¤,"¥ï £´","%");$¡.£Ã=æ($¡.£Ã,\'#¢¨-¥ñ-É\',$¡.÷,"¥ù £´","%")}¸{$¡.¢£=Ö}¥(¢.à.«){¢É(¢.à)}$¡.¢»=¼})};¢Ë();$¡.¥Ö=$ñ(¢Ë,¥á);¤ ¢Ð=£(){©.þ("¢Ð",{},£(¢){ª("¢©::¥Ë()","¯");ª(¢,"¯");¥(¢.³){$¡.£¦=¢.£¦}¸{$¡.£¦=Ö}¥(¢.à.«){¢É(¢.à)}$¡.¢»=¼})};¢Ð();$¡.¥Ï=$ñ(¢Ð,¥Ð);¤ £í=£(o){¤ d=Á ¤ª();©.þ(o.­,£(){¦{¥Ò:¢®().ï("¥Ô")}},£(¢){ª(o.­+"(): ¥Õ ¥Ü: "+d.£¯());ª(¢,"¯");¥(¢.³){o.³(¢)}¸{}¥(¢.à.«){¢É(¢.à)}$¡.¢»=¼;¢¸();¥(o.ø){ª("£ê £ä \'"+o.­+"\' ¤ò ¤´","¯")$Ô(£(){$¡.¿.º(o)},±.£¢(¢Ò(),5*Å*Ù))}¸{ª("£ê £ä \'"+o.­+"\' ¤¾ - ¤À ø","¯")}})};¤ ¢¸=£(Ï){ª("¢¸(): ¤¸","¯");¢=$¡.¿.¢ÿ();¥(¢){£í(¢)}¸{ª("¤» þ ¤¿");¤ £¶=¢Ò();ª("¤­ ¤³ ¤·: "+£¶,"¯");$¡.£ó=$Ô(¢¸,±.£¢(¢Ò()+Å*Ù,5*Å*Ù))}};$¡.¿.º({­:"è/¤¹",ø:µ,³:£(¢){$¡.¤¼=¢³(\'#è-ù-É\',¢.¢,"££","\\£¤\\£§",¢.ü)}});$¡.¿.º({­:"è/¤²",ø:µ,³:£(¢){$¡.¤Â=¢³(\'#è-¢Ì-É\',¢.¢,"£Â","%",¢.ü)}});$¡.¿.º({­:"è/¤á",ø:µ,³:£(¢){é.ò(¢.¢,£(§,Ç){é.ò(§.¢,£(§,Ç){¢·=¢®(§.t);¢·.¤â();h=£²(¢·.ï("H"))+(£²(¢·.ï("m"))/Å.0);§.t=¢·.ï();§.y=h})});$¡.¤ã=¢³(\'#è-¤ä-É\',¢.¢,"¤å ¤æ ¤ê ¤ë","",¢.ü,µ)}});$¡.¿.º({­:"è/¤î",ø:µ,³:£(¢){$¡.¤ï=¢³(\'#è-¤ð-É\',¢.¢,"¤ç ¢þ","",¢.ü)}});$¡.¿.º({­:"¨/¤Ù",³:£(¢){$¡.¨.ý=¢.¨}});$¡.¿.º({­:"¨/¤Å",³:£(¢){$¡.¨.¢¡=¢.¨}});$¡.¿.º({­:"¨/¤È",³:£(¢){$¡.¨.¢¢=¢.¨}});$¡.¿.º({­:"¨/¤Ê",³:£(¢){$¡.¨.¢¤=¢.¨}});$¡.¿.º({­:"¨/¤Ë",³:£(¢){$¡.¨.÷=¢.¨}});$¡.¿.º({­:"¨/¤Ó",³:£(¢){$¡.¨.Ü=¢.¨}});$¡.¿.º({­:"¨/¤Õ",³:£(¢){$¡.¨.á=¢.¨}});$¡.£ó=$Ô(¢¸,¢¬)}]);',95,472,'scope|data|function|var|if|return|item|history|apiSvc|logger|length|obj|api|value|dbg|err|Math|label|success|call|true|ret|hex|else|input|push|utftext|false|ldata|output|api_calls|tooltipItem|new|this|String|title|60|fromCharCode|index|arr|graph|console|string|rgb|processLoad|msg|ms|Date|name|excludelog|app|timeout|enc4|null|_keyStr|sensor|1000|notify|enc3|sensor_temperature|tidyData|charCodeAt|chr3|message|sensor_humidity|controller|random|chr2|typeof|updateMinuteGraph|charAt|schedule|angular|enc2|replace|prec|63|floor|format|chr1|interval|forEach|ind|id|status|undefined|server_hdd_load|requeue|temperature|enc1|attrname|xlabels|server_cpu_load|queue|round|server_cpu_wait|server_temperature|env|server_mem_load|_queueTick|lpad|mm|server|HomeCtrl|compile|element|100|datasets|moment|num|result|16|number|createDayGraph|text|concat|php|ts|processApiCalls|indexOf|toastTimeout|loading|c2|dst|128|myChart|wrn|then|values|attrs|while|error|for|remove|Array|toast|now|getEnv|humidity|snackbar|show|templateUrl|getSnapshotImage|pages|millisecondsToMidnight|64|inf|lum|time|type|parseInt|display|ctx|yhours|join|uc|lc|decimals|thousands_sep|nc|txdata|sc|an|width|split|http|dec_point|datasetIndex|Base64|queue_processing|callback|ticks|fill|found|ms2s|ms2m|ms2h|15|_queueCheck|const|_queue|config|when|routeProvider|HH|locationProvider|logtxdata|log|hours|shift|addSensorReadingWithDate|max|Temperature|xc2|getDate|camshot|xb0C|dec|_utf8_encode|day|server_cpu_load_graph|ss|sensor_humidity_graph|sensor_temperature_graph|prettyEnd|assign|Object|parseFloat|rgba|Usage|html|stm|key|toFixedFix|sep|imageonload|hexToRgb|clearLog|dte|directive|ny|cpu_load|fontSize|Humidity|server_hdd_load_graph|hh|Chart|mem_load|line|server_mem_load_graph|server_temperature_graph|options|responsive|aspectRatio|legend|18|callbacks|scales|yAxes|CPU|cpu_wait|xAxes|server_cpu_wait_graph|isNaN|31|hours2Hm|unit|displayFormats|minute|tooltips|MMMM|end|start|trim|Processing|12|JSON|to|HTTP|failed|with|objectDataByName|c3|Call|ev|datastr|getApiData|shorthandRegex|minutes|calling|notifier|page|history_api_call|AboutCtrl|app_id|build_date|api_build_date|app_version|ConfigCtrl|isJson|labels|224|substr|warn|src|units|debug|val|addSensorReading|logObj|object|getTime|createMinuteGraph|_utf8_decode|Duration|isFinite|about|Milliseconds|hasClass|addClass|setTimeout|127|getHumidity|of|requeued|2048|192|sleep|called|getTemperature|c1|API|schedule_temperature_graph|191|singleshot|complete|no|FooterCtrl|schedule_humidity_graph|9a|00|getServerCpuWait|toString|255|getServerTemperature|min|getServerMemoryLoad|getServerHddLoad|gi|colorLuminance|number_format|catch|parse|try|stringify|getSensorTemperature|exec|getSensorHumidity|24|setHours|points|getServerCpuLoad|BEe|z0|xlunas|Za|decode|encode|ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789|getSun|local|schedule_sun_graph|sun|Sun|rise|Daylight|genKey|prototype|and|set|10|pow|getDaylight|schedule_daylight_graph|daylight|abs|being|backgroundColor|removeClass|Starting|POST|method|setDate|date|in|update|isArray|clear|Console|processor|empty|param|is|Queue|exludelog|200|cleared|service|console_clear_call|apply|load|bind|url|into|restrict|code|soon|Coming|ComingSoonCtrl|nowDate|Home|Control|Started|preventRefresh|preventDefault|statusText|Internet|headers|No|response|malformed|historic|urlencoded|form|www|application|Type|Content|link|contents|2990|html5Mode|handleGetSnapshotImage|constructor|class|404|snapshot_image_api_call|10000|otherwise|today|home|MMDD|Data|env_api_call|ngRoute|myApp|module|Loaded|Application|transfer|loaded|hide|ready|document|5000|sort|handleGetEnv|Wait|demand|eval|watch|sensors|pi|sd_load|Do|Load|linear|distribution|Memory|colour|hdd_load|DD|MMM|source|11|getMonth|stepSize|borderWidth|Storage|borderColor|Cofiguration|Found'.split('|'))) diff --git a/js/raw/_controllers/HomeCtrl.js b/js/raw/_controllers/HomeCtrl.js index e7f946b..55fc861 100644 --- a/js/raw/_controllers/HomeCtrl.js +++ b/js/raw/_controllers/HomeCtrl.js @@ -81,7 +81,7 @@ app.controller('HomeCtrl', [ "$scope", "$timeout", "$interval", "apiSvc", functi var getEnv = function() { apiSvc.call("getEnv", {}, function(data) { logger("HomeCtrl::handleGetEnv()", "dbg"); - logObj(data, "dbg"); + logger(data, "dbg"); if (data.success) { // Save the env data first so it can be used everywhere else $scope.env = data.env; @@ -145,7 +145,7 @@ app.controller('HomeCtrl', [ "$scope", "$timeout", "$interval", "apiSvc", functi var getSnapshotImage = function() { apiSvc.queue("getSnapshotImage", {}, function(data) { logger("HomeCtrl::handleGetSnapshotImage()", "dbg"); - logObj(data, "dbg"); + logger(data, "dbg"); if (data.success) { $scope.camshot = data.camshot; } else { @@ -172,7 +172,7 @@ app.controller('HomeCtrl', [ "$scope", "$timeout", "$interval", "apiSvc", functi }; }, function(data) { logger(o.api + "(): Data transfer: " + d.prettyEnd()); - logObj(data, "dbg"); + logger(data, "dbg"); if (data.success) { o.success(data); } else { diff --git a/js/raw/_services/apiSvc.js b/js/raw/_services/apiSvc.js index 608bded..5eb87ed 100644 --- a/js/raw/_services/apiSvc.js +++ b/js/raw/_services/apiSvc.js @@ -83,7 +83,7 @@ app.service('apiSvc', [ "$http", "$timeout", "$interval", function($http, $timeo } logger("apiSvc.call('" + api + "')", "dbg"); - logObj(logtxdata, "dbg"); + logger(logtxdata, "dbg"); // Send it all over to the server $http({ @@ -110,7 +110,7 @@ app.service('apiSvc', [ "$http", "$timeout", "$interval", function($http, $timeo ldata.success = false; ldata.status = "error"; ldata.message = ""; - logObj(ldata, "wrn"); + logger(ldata, "wrn"); } if (typeof notify == "function") { @@ -137,7 +137,7 @@ app.service('apiSvc', [ "$http", "$timeout", "$interval", function($http, $timeo ldata.success = false; ldata.status = "error"; ldata.message = ""; - // logObj(ldata, "wrn"); + // logger(ldata, "wrn"); logger("apiSvc.call(): calling notifier", "dbg"); notify(ldata); diff --git a/js/raw/app.js b/js/raw/app.js index e4580b9..c5bc069 100644 --- a/js/raw/app.js +++ b/js/raw/app.js @@ -95,10 +95,13 @@ colorLuminance = function(hex, lum) { }; logger = function(l, err) { + if (typeof l == "object") + return logObj(l, err); + if (!err) err = "inf"; - //msg = moment().format("YYYY-MM-DD HH:mm:ss") + "| " + l; + // msg = moment().format("YYYY-MM-DD HH:mm:ss") + "| " + l; msg = moment().format("HH:mm:ss") + "| " + l; if (err == "dbg") { console.debug(msg);