|
|
|
function bool(t){return 1===t||"1"===t||t===!0||"true"===t}!function(){"use strict";function t(){var t;for(p=!0,t=0;t<f.length;t+=1)f[t]();f=[]}function e(){var e;for(m=!0,p||t(),e=0;e<d.length;e+=1)d[e]();d=[]}function n(t,e){var n;for(n=e.length-1;n>=0;n-=1)t(e[n])}function r(t){return t.replace(/-\w/g,function(t){return t.charAt(1).toUpperCase()})}function i(t,e){return t.currentStyle?t.currentStyle[r(e)]:x.getComputedStyle?x.getComputedStyle(t,null).getPropertyValue(e):null}function a(t,e){return encodeURIComponent(t).replace(/%20/g,"+")+"="+encodeURIComponent(e).replace(/%20/g,"+")}function s(t,e,n){try{t.style[r(e)]=n}catch(i){}}function o(t){t.style.display="","none"===i(t,"display")&&(t.style.display="block")}function u(t){var e,r,i,s="";if(t.constructor===Object){for(e in t)if(t.hasOwnProperty(e))if(t[e].constructor===Array)for(r=0;r<t[e].length;r+=1)s+="&"+a(e,t[e][r]);else s+="&"+a(e,t[e])}else n(function(t){if("FORM"===t.nodeName)for(r=0;r<t.elements.length;r+=1)if(e=t.elements[r],!e.disabled)switch(e.type){case"button":case"image":case"file":case"submit":case"reset":break;case"select-one":e.length>0&&(s+="&"+a(e.name,e.value));break;case"select-multiple":for(i=0;i<e.length;i+=1)e[i].selected&&(s+="&"+a(e.name,e[i].value));break;case"checkbox":case"radio":e.checked&&(s+="&"+a(e.name,e.value));break;default:s+="&"+a(e.name,e.value)}},t);return s.length>0?s.substring(1):""}function c(t,e,r){var i,a,s,o=!1;return t&&(i=t.split(/\s+/),n(function(t){for(s=0;s<i.length;s+=1)if(a=new RegExp("\\b"+i[s]+"\\b","g"),"remove"===e)t.className=t.className.replace(a,"");else if("toggle"===e)t.className=t.className.match(a)?t.className.replace(a,""):t.className+" "+i[s];else if("has"===e&&t.className.match(a)){o=!0;break}},r)),o}function l(t,e,r){var i,a;t&&n(function(n){for(i=g.createElement("div"),i.innerHTML=t;null!==(a=i.lastChild);)try{"before"===e?n.parentNode.insertBefore(a,n):"after"===e?n.parentNode.insertBefore(a,n.nextSibling):"append"===e?n.appendChild(a):"prepend"===e&&n.insertBefore(a,n.firstChild)}catch(r){break}},r)}function h(t){var e,a,y,b=[],w=!1;if(t)if(t.nodeType&&1===t.nodeType)b=[t];else if("object"==typeof t)w="number"!=typeof t.length,b=t;else if("string"==typeof t)for(g.querySelectorAll||(g.querySelectorAll=function(t){var e,n,r,a=g.getElementsByTagName("head")[0],s=[];if(e=g.createElement("STYLE"),e.type="text/css",e.styleSheet){for(e.styleSheet.cssText=t+" {a:b}",a.appendChild(e),n=g.getElementsByTagName("*"),r=0;r<n.length;r+=1)"b"===i(n[r],"a")&&s.push(n[r]);a.removeChild(e)}return s}),a=g.querySelectorAll(t),y=0;y<a.length;y+=1)b[y]=a[y];return e=w?{}:b,e.ready=function(t){if(t){if(p)return t(),e;f.push(t)}},e.loaded=function(t){if(t){if(m)return t(),e;d.push(t)}},e.each=function(t){return"function"==typeof t&&n(function(e){return t.apply(e,arguments)},b),e},e.first=function(){return h(b.shift())},e.last=function(){return h(b.pop())},e.odd=function(){var t,e=[];for(t=0;t<b.length;t+=2)e.push(b[t]);return h(e)},e.even=function(){var t,e=[];for(t=1;t<b.length;t+=2)e.push(b[t]);return h(e)},e.hide=function(){return n(function(t){t.style.display="none"},b),e},e.show=function(){return n(function(t){o(t)},b),e},e.toggle=function(t){return"undefined"!=typeof t?t?e.show():e.hide():n(function(t){"none"===i(t,"display")?o(t):t.style.display="none"},b),e},e.remove=function(){return n(function(t){try{t.parentNode.removeChild(t)}catch(e){}},b),h()},e.css=function(t,a){if(t){if(a||""===a)return n(function(e){s(e,t,a)},b),e;if(b[0]){if(b[0].style[r(t)])return b[0].style[r(t)];if(i(b[0],t))return i(b[0],t)}}},e.getClass=function(){return b[0]&&b[0].className.length>0?b[0].className.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"").replace(/\s+/," "):void 0},e.setClass=function(t){return(t||""===t)&&n(function(e){e.className=t},b),e},e.addClass=function(t){return t&&n(function(e){e.className+=" "+t},b),e},e.removeClass=function(t){return c(t,"remove",b),e},e.toggleClass=function(t){return c(t,"toggle",b),e},e.hasClass=function(t){return c(t,"has",b)},e.html=function(t){return t||""===t?(n(function(e){e.innerHTM
|
|
|
|
var r,i,s=this.svg.elem("g").addClass(t.classNames.gridGroup),o=this.svg.elem("g"),u=this.svg.elem("g").addClass(t.classNames.labelGroup),c=n.createChartRect(this.svg,t,a.padding);r=void 0===t.axisX.type?new n.StepAxis(n.Axis.units.x,e,c,n.extend({},t.axisX,{ticks:e.raw.labels,stretch:t.fullWidth})):t.axisX.type.call(n,n.Axis.units.x,e,c,t.axisX),i=void 0===t.axisY.type?new n.AutoScaleAxis(n.Axis.units.y,e,c,n.extend({},t.axisY,{high:n.isNum(t.high)?t.high:t.axisY.high,low:n.isNum(t.low)?t.low:t.axisY.low})):t.axisY.type.call(n,n.Axis.units.y,e,c,t.axisY),r.createGridAndLabels(s,u,this.supportsForeignObject,t,this.eventEmitter),i.createGridAndLabels(s,u,this.supportsForeignObject,t,this.eventEmitter),e.raw.series.forEach(function(a,s){var u=o.elem("g");u.attr({"ct:series-name":a.name,"ct:meta":n.serialize(a.meta)}),u.addClass([t.classNames.series,a.className||t.classNames.series+"-"+n.alphaNumerate(s)].join(" "));var l=[],h=[];e.normalized[s].forEach(function(t,o){var u={x:c.x1+r.projectValue(t,o,e.normalized[s]),y:c.y1-i.projectValue(t,o,e.normalized[s])};l.push(u.x,u.y),h.push({value:t,valueIndex:o,meta:n.getMetaData(a,o)})}.bind(this));var f={lineSmooth:n.getSeriesOption(a,t,"lineSmooth"),showPoint:n.getSeriesOption(a,t,"showPoint"),showLine:n.getSeriesOption(a,t,"showLine"),showArea:n.getSeriesOption(a,t,"showArea"),areaBase:n.getSeriesOption(a,t,"areaBase")},d="function"==typeof f.lineSmooth?f.lineSmooth:f.lineSmooth?n.Interpolation.cardinal():n.Interpolation.none(),p=d(l,h);if(f.showPoint&&p.pathElements.forEach(function(e){var o=u.elem("line",{x1:e.x,y1:e.y,x2:e.x+.01,y2:e.y},t.classNames.point).attr({"ct:value":[e.data.value.x,e.data.value.y].filter(n.isNum).join(","),"ct:meta":e.data.meta});this.eventEmitter.emit("draw",{type:"point",value:e.data.value,index:e.data.valueIndex,meta:e.data.meta,series:a,seriesIndex:s,axisX:r,axisY:i,group:u,element:o,x:e.x,y:e.y})}.bind(this)),f.showLine){var m=u.elem("path",{d:p.stringify()},t.classNames.line,!0);this.eventEmitter.emit("draw",{type:"line",values:e.normalized[s],path:p.clone(),chartRect:c,index:s,series:a,seriesIndex:s,axisX:r,axisY:i,group:u,element:m})}if(f.showArea&&i.range){var v=Math.max(Math.min(f.areaBase,i.range.max),i.range.min),g=c.y1-i.projectValue(v);p.splitByCommand("M").filter(function(t){return t.pathElements.length>1}).map(function(t){var e=t.pathElements[0],n=t.pathElements[t.pathElements.length-1];return t.clone(!0).position(0).remove(1).move(e.x,g).line(e.x,e.y).position(t.pathElements.length+1).line(n.x,g)}).forEach(function(n){var o=u.elem("path",{d:n.stringify()},t.classNames.area,!0);this.eventEmitter.emit("draw",{type:"area",values:e.normalized[s],path:n.clone(),series:a,seriesIndex:s,axisX:r,axisY:i,chartRect:c,index:s,group:u,element:o})}.bind(this))}}.bind(this)),this.eventEmitter.emit("created",{bounds:i.bounds,chartRect:c,axisX:r,axisY:i,svg:this.svg,options:t})}function i(t,e,r,i){n.Line["super"].constructor.call(this,t,e,a,n.extend({},a,r),i)}var a={axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:n.noop,type:void 0},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:n.noop,type:void 0,scaleMinSpace:20,onlyInteger:!1},width:void 0,height:void 0,showLine:!0,showPoint:!0,showArea:!1,areaBase:0,lineSmooth:!0,low:void 0,high:void 0,chartPadding:{top:15,right:15,bottom:5,left:10},fullWidth:!1,reverseData:!1,classNames:{chart:"ct-chart-line",label:"ct-label",labelGroup:"ct-labels",series:"ct-series",line:"ct-line",point:"ct-point",area:"ct-area",grid:"ct-grid",gridGroup:"ct-grids",vertical:"ct-vertical",horizontal:"ct-horizontal",start:"ct-start",end:"ct-end"}};n.Line=n.Base.extend({constructor:i,createChart:r})}(window,document,t),function(t,e,n){"use strict";function r(t){this.data=n.normalizeData(this.data);var e,r={raw:this.data,normalized:t.distributeSeries?n.getDataArray(this.data,t.reverseData,t.horizontalBars?"x":"y").map(function(t){return[t]}):n.getDataArray(this.data,t.reverseData,t.horizontalBars?"x":"y")};this.svg=n.createS
|
|
|
|
},plugins:d})}function e(e,r){if(u=!1,200!=r)return void(0!=r&&alert("Request failed."));var i=JSON.parse(e);return i.success?(c&&(h=setTimeout(n,l)),void t(i)):void alert("Sampling failed.")}function n(){if(u)return!1;u=!0;var t="/api/{fmt}.json?n={n}&fs={fs}".format({fmt:i,n:$("#count").val(),fs:$("#freq").val()});return $().get(t,e,!0,!0),!0}var r,i,a,s,o={},u=!1,c=!1,l=1,h=-1;return o.init=function(t){i=t,$("#load").on("click",n),$("#count,#freq").on("keyup",function(t){13==t.which&&n()}),$("#chart").on("contextmenu",function(t){return r&&r(),r=null,a=null,s=null,t.preventDefault(),!1}),$("input[type=number]").on("mousewheel",function(t){var e=+$(this).val(),n=+($(this).attr("step")||1);t.wheelDelta>0?e+=n:e-=n,$(this).val(e)}),$("#ar-btn").on("click",function(){l=1e3*+$("#ar-time").val(),c=!c,c?n():clearTimeout(h),$("#ar-btn").toggleClass("btn-blue").toggleClass("btn-red").val(c?"Stop":"Auto")})},o}(),page_status=function(){function t(t,n){if(200!=n)console.error("Update failed.");else try{var r=JSON.parse(t);$(".sta-only").toggle(r.sta),$(".ap-only").toggle(r.ap),$("#uptime").html(r.uptime),$("#heap").html(r.heap+" bytes"),$("#wmode").html(r.wifiMode),r.sta&&($("#staSSID").html(r.sta.SSID),$("#staRSSIperc").html(r.sta.RSSIperc),$("#staRSSI").html(r.sta.RSSI),$("#staMAC").html(r.sta.MAC)),r.ap&&($("#apSSID").html(r.ap.SSID),$("#apHidden").html(r.ap.hidden?"Yes":"No"),$("#apAuth").html(r.ap.auth),$(".ap-auth-only").toggle("Open"!=r.ap.auth),$("#apPwd").html(r.ap.pwd),$("#apChan").html(r.ap.chan),$("#apMAC").html(r.ap.MAC))}catch(i){console.error(i)}setTimeout(e,1e4)}function e(){$().get("/api/status.json",t,!0,!0)}var n={};return n.init=function(){e(),setTimeout(e,1e4)},n}();
|