thingspeak/public/assets/application.js

6 lines
190 KiB
JavaScript
Raw Normal View History

2014-05-09 20:07:51 +02:00
function reloadCharts(){return-1===navigator.userAgent.toLowerCase().indexOf("firefox")?!1:($('.ui-widget-content [aria-expanded="false"]').find("iframe").each(function(){var t=$(this).attr("src");-1!==t.indexOf("charts")&&($(this).hide(),$(this).attr("src",t),$(this).show())}),void 0)}function openDialogCenter(t){t.dialog("open");var e=getDimensions(t.parent());t.dialog({position:[e[0],e[1]]})}function getDimensions(t){var e=new Array(2);return e[0]=$(window).width()/2-t.width()/2,e[1]=$(window).height()/2-t.height()/2,e}function updateChart(t,e,i,n,r,s){var i=i,n=n,o=$("#iframe"+t).attr("default_src");o||(o=$("#iframe"+t).attr("src")),src=o.split("?")[0],("bar"===$("#type_"+t).val()||"column"===$("#type_"+t).val())&&0==$("#timescale_"+t).val().length&&0==$("#average_"+t).val().length&&0==$("#median_"+t).val().length&&0==$("#sum_"+t).val().length&&$("#timescale_"+t).val(30);var a=[];$(".chart_options"+t).each(function(){var t=$(this).val(),e=$(this).attr("id"),i=e.split("_")[0];t.length>0&&a.push([i,t])});for(var l="";a.length>0;){var h=a.pop();"width"==h[0]&&(i=parseInt(h[1])),"height"==h[0]&&(n=parseInt(h[1])),("type"!=h[0]||"line"!=h[1])&&(l+="&"+h[0]+"="+encodeURIComponent(h[1]))}l.length>0&&(src+="?"+l.substring(1)),e&&t>0&&s?$.update("/channels/"+r+"/charts/"+t,{newOptions:{options:l}}):e&&t>0&&$.update("/channels/"+r+"/charts/"+t,{options:l}),$("#embed"+t).val('<iframe width="'+i+'" height="'+n+'" style="border: 1px solid #cccccc;" src="'+src+'"></iframe>'),$("#iframe"+t).attr("src",src),$("#iframe"+t).attr("width",i),$("#iframe"+t).attr("height",n)}function updateSelectValues(){selectedValue=$(this).val(),$(".mutuallyexclusive"+index).each(function(){$(this).val("")}),$(this).val(selectedValue)}function setupChartForm(t){return function(e,i){i.length>0&&$("#"+i.split("=")[0]+"_"+t).val(decodeURIComponent(i.split("=")[1]))}}function setupColumns(t,e){$(sortColumnSetup(t,e)),$(".column").disableSelection()}function createWindowsWithData(t,e,i,n){for(var r in t){for(var s in t[r])var o=s;if(t[r].chart_window&&(a=t[r].chart_window),t[r].plugin_window&&(a=t[r].plugin_window),t[r].portlet_window&&(a=t[r].portlet_window),"undefined"==a)var a=t[r].portlet_window?t[r].portlet_window:t[r].chart_window;colId=a.col,title=a.title;var l=a.html;if(t[r].chart_window){var h=a.id;$("body").append("<div id='chartConfig"+h+"'></div>")}var c=addWindow(n,colId,a.id,o,title,l);c.each(decoratePortlet(e)),c.find(".ui-toggle").click(uiToggleClick),c.find(".ui-view").click(uiViewClick(i)),c.find(".ui-edit").click(uiEditClick(i)),c.find(".ui-close").click(uiCloseClick(i))}}function addWindow(t,e,i,n,r,s){if($("#"+t+"_dialog"+e).append('<div class="portlet ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" id="portlet_'+i+'"><div class="portlet-header wtype wtype-'+n+' ui-widget-header ui-corner-all">'+r+'</div><div class="portlet-content">'+s+"</div>"),$("#portlet_"+i).length>1)throw"Portlet count doesn't match what's expected";return $("#portlet_"+i)}function sortColumnSetup(t,e){$(".column").sortable({opacity:.6,helper:function(){return $("<div class='ui-widget-header'>Drop to re-position</div>")},connectWith:".column",update:updatePortletPositions(t,e)})}function getPortletArray(t){var e=new Array,n=t.split("&");for(i in n)val=n[i].split("=")[1],e.push(val);return e}function uiToggleClick(){$(this).toggleClass("ui-icon-minusthick").toggleClass("ui-icon-plusthick"),$(this).parents(".portlet:first").find(".portlet-content").toggle()}!function(t,e){t.rails!==e&&t.error("jquery-ujs has already been loaded!");var i,n=t(document);t.rails=i={linkClickSelector:"a[data-confirm], a[data-method], a[data-remote], a[data-disable-with]",buttonClickSelector:"button[data-remote]",inputChangeSelector:"select[data-remote], input[data-remote], textarea[data-remote]",formSubmitSelector:"form",formInputClickSelector:"form input[type=submit], form input[type=image], form button[type=submit], form button:not([type])",disableSelector:"input[data-disable-with], button[data-disable-with], textarea[data-disable-with]",enableSelector:"input[data-disab
},createElement:function(t){var e=new this.Element;return e.init(this,t),e},draw:function(){},buildText:function(t){for(var e=t.element,n=this,r=n.forExport,s=p(t.textStr,"").toString().replace(/<(b|strong)>/g,'<span style="font-weight:bold">').replace(/<(i|em)>/g,'<span style="font-style:italic">').replace(/<a/g,"<span").replace(/<\/(b|strong|i|em|a)>/g,"</span>").split(/<br.*?>/g),o=e.childNodes,a=/style="([^"]+)"/,l=/href="(http[^"]+)"/,h=d(e,"x"),c=t.styles,u=t.textWidth,g=c&&c.lineHeight,m=o.length;m--;)e.removeChild(o[m]);u&&!t.added&&this.box.appendChild(e),""===s[s.length-1]&&s.pop(),je(s,function(s,o){var p,m=0,s=s.replace(/<span/g,"|||<span").replace(/<\/span>/g,"</span>|||");p=s.split("|||"),je(p,function(s){if(""!==s||1===p.length){var y,v={},x=oe.createElementNS(Pe,"tspan");if(a.test(s)&&(y=s.match(a)[1].replace(/(;| |^)color([ :])/,"$1fill$2"),d(x,"style",y)),l.test(s)&&!r&&(d(x,"onclick",'location.href="'+s.match(l)[1]+'"'),f(x,{cursor:"pointer"})),s=(s.replace(/<(.|\n)*?>/g,"")||" ").replace(/&lt;/g,"<").replace(/&gt;/g,">")," "!==s&&(x.appendChild(oe.createTextNode(s)),m?v.dx=0:v.x=h,d(x,v),!m&&o&&(!Ae&&r&&f(x,{display:"block"}),d(x,"dy",g||n.fontMetrics(/px$/.test(x.style.fontSize)?x.style.fontSize:c.fontSize).h,Se&&x.offsetHeight)),e.appendChild(x),m++,u))for(var b,w,s=s.replace(/([^\^])-/g,"$1- ").split(" "),v=s.length>1&&"nowrap"!==c.whiteSpace,k=t._clipHeight,S=[],T=i(g||16),C=1;v&&(s.length||S.length);)delete t.bBox,b=t.getBBox(),w=b.width,!Ae&&n.forExport&&(w=n.measureSpanWidth(x.firstChild.data,t.styles)),b=w>u,b&&1!==s.length?(x.removeChild(x.firstChild),S.unshift(s.pop())):(s=S,S=[],s.length&&(C++,k&&C*T>k?(s=["..."],t.attr("title",t.textStr)):(x=oe.createElementNS(Pe,"tspan"),d(x,{dy:T,x:h}),y&&d(x,"style",y),e.appendChild(x),w>u&&(u=w)))),s.length&&x.appendChild(oe.createTextNode(s.join(" ").replace(/- /g,"-")))}})})},button:function(i,n,r,s,o,a,l,h,c){var d,u,p,f,g,m,y=this.label(i,n,r,c,null,null,null,null,"button"),v=0,i={x1:0,y1:0,x2:0,y2:1},o=e({"stroke-width":1,stroke:"#CCCCCC",fill:{linearGradient:i,stops:[[0,"#FEFEFE"],[1,"#F6F6F6"]]},r:2,padding:5,style:{color:"black"}},o);return p=o.style,delete o.style,a=e(o,{stroke:"#68A",fill:{linearGradient:i,stops:[[0,"#FFF"],[1,"#ACF"]]}},a),f=a.style,delete a.style,l=e(o,{stroke:"#68A",fill:{linearGradient:i,stops:[[0,"#9BD"],[1,"#CDF"]]}},l),g=l.style,delete l.style,h=e(o,{style:{color:"#CCC"}},h),m=h.style,delete h.style,Ze(y.element,we?"mouseover":"mouseenter",function(){3!==v&&y.attr(a).css(f)}),Ze(y.element,we?"mouseout":"mouseleave",function(){3!==v&&(d=[o,a,l][v],u=[p,f,g][v],y.attr(d).css(u))}),y.setState=function(t){(y.state=v=t)?2===t?y.attr(l).css(g):3===t&&y.attr(h).css(m):y.attr(o).css(p)},y.on("click",function(){3!==v&&s.call(y)}).attr(o).css(t({cursor:"default"},p))},crispLine:function(t,e){return t[1]===t[4]&&(t[1]=t[4]=he(t[1])-e%2/2),t[2]===t[5]&&(t[2]=t[5]=he(t[2])+e%2/2),t},path:function(e){var i={fill:Be};return s(e)?i.d=e:r(e)&&t(i,e),this.createElement("path").attr(i)},circle:function(t,e,i){return t=r(t)?t:{x:t,y:e,r:i},this.createElement("circle").attr(t)},arc:function(t,e,i,n,s,o){return r(t)&&(e=t.y,i=t.r,n=t.innerR,s=t.start,o=t.end,t=t.x),t=this.symbol("arc",t||0,e||0,i||0,i||0,{innerR:n||0,start:s||0,end:o||0}),t.r=i,t},rect:function(t,e,i,n,s,o){return s=r(t)?t.r:s,s=this.createElement("rect").attr({rx:s,ry:s,fill:Be}),s.attr(r(t)?t:s.crisp(o,t,e,ue(i,0),ue(n,0)))},setSize:function(t,e,i){var n=this.alignedObjects,r=n.length;for(this.width=t,this.height=e,this.boxWrapper[p(i,!0)?"animate":"attr"]({width:t,height:e});r--;)n[r].align()},g:function(t){var e=this.createElement("g");return c(t)?e.attr({"class":"highcharts-"+t}):e},image:function(e,i,n,r,s){var o={preserveAspectRatio:Be};return arguments.length>1&&t(o,{x:i,y:n,width:r,height:s}),o=this.createElement("image").attr(o),o.element.setAttributeNS?o.element.setAttributeNS("http://www.w3.org/1999/xlink","href",e):o.element.setAttribute("hc-svg-href",e),o},symbol:function(e,i,n,r,s,o){var a,l,h,c=this.symbols[e],c=c&&c(he(i),he(n),r,s,o),d=/^url\((.*?)\)$/;re
}),i.setAxisTranslation(!0),i.beforeSetTickPositions&&i.beforeSetTickPositions(),i.postProcessTickInterval&&(i.tickInterval=i.postProcessTickInterval(i.tickInterval)),i.pointRange&&(i.tickInterval=ue(i.pointRange,i.tickInterval)),!g&&i.tickInterval<m&&(i.tickInterval=m),o||s||g||(i.tickInterval=k(i.tickInterval,null,w(i.tickInterval),r)),i.minorTickInterval="auto"===r.minorTickInterval&&i.tickInterval?i.tickInterval/5:r.minorTickInterval,i.tickPositions=t=r.tickPositions?[].concat(r.tickPositions):d&&d.apply(i,[i.min,i.max]),t||(!i.ordinalPositions&&(i.max-i.min)/i.tickInterval>ue(2*i.len,200)&&M(19,!0),t=o?i.getTimeTicks(i.normalizeTimeTickInterval(i.tickInterval,r.units),i.min,i.max,r.startOfWeek,i.ordinalPositions,i.closestPointRange,!0):s?i.getLogTickPositions(i.tickInterval,i.min,i.max):i.getLinearTickPositions(i.tickInterval,i.min,i.max),e&&t.splice(1,t.length-2),i.tickPositions=t),h||(s=t[0],o=t[t.length-1],h=i.minPointOffset||0,r.startOnTick?i.min=s:i.min-h>s&&t.shift(),r.endOnTick?i.max=o:i.max+h<o&&t.pop(),1===t.length&&(i.min-=.001,i.max+=.001))},setMaxTicks:function(){var t=this.chart,e=t.maxTicks||{},i=this.tickPositions,n=this._maxTicksKey=[this.coll,this.pos,this.len].join("-");!this.isLinked&&!this.isDatetimeAxis&&i&&i.length>(e[n]||0)&&this.options.alignTicks!==!1&&(e[n]=i.length),t.maxTicks=e},adjustTickAmount:function(){var t=this._maxTicksKey,e=this.tickPositions,i=this.chart.maxTicks;if(i&&i[t]&&!this.isDatetimeAxis&&!this.categories&&!this.isLinked&&this.options.alignTicks!==!1&&this.min!==_){var n=this.tickAmount,r=e.length;if(this.tickAmount=t=i[t],t>r){for(;e.length<t;)e.push(I(e[e.length-1]+this.tickInterval));this.transA*=(r-1)/(t-1),this.max=e[e.length-1]}c(n)&&t!==n&&(this.isDirty=!0)}},setScale:function(){var t,e,i,n,r=this.stacks;if(this.oldMin=this.min,this.oldMax=this.max,this.oldAxisLength=this.len,this.setAxisSize(),n=this.len!==this.oldAxisLength,je(this.series,function(t){(t.isDirtyData||t.isDirty||t.xAxis.isDirty)&&(i=!0)}),n||i||this.isLinked||this.forceRedraw||this.userMin!==this.oldUserMin||this.userMax!==this.oldUserMax){if(!this.isXAxis)for(t in r)for(e in r[t])r[t][e].total=null,r[t][e].cum=0;this.forceRedraw=!1,this.getSeriesExtremes(),this.setTickPositions(),this.oldUserMin=this.userMin,this.oldUserMax=this.userMax,this.isDirty||(this.isDirty=n||this.min!==this.oldMin||this.max!==this.oldMax)}else if(!this.isXAxis){this.oldStacks&&(r=this.stacks=this.oldStacks);for(t in r)for(e in r[t])r[t][e].cum=r[t][e].total}this.setMaxTicks()},setExtremes:function(e,i,n,r,s){var o=this,a=o.chart,n=p(n,!0),s=t(s,{min:e,max:i});Qe(o,"setExtremes",s,function(){o.userMin=e,o.userMax=i,o.eventArgs=s,o.isDirtyExtremes=!0,n&&a.redraw(r)})},zoom:function(t,e){return this.allowZoomOutside||(c(this.dataMin)&&t<=this.dataMin&&(t=_),c(this.dataMax)&&e>=this.dataMax&&(e=_)),this.displayBtn=t!==_||e!==_,this.setExtremes(t,e,!1,_,{trigger:"zoom"}),!0},setAxisSize:function(){var t,e,i=this.chart,n=this.options,r=n.offsetLeft||0,s=n.offsetRight||0,o=this.horiz;this.left=e=p(n.left,i.plotLeft+r),this.top=t=p(n.top,i.plotTop),this.width=r=p(n.width,i.plotWidth-r+s),this.height=n=p(n.height,i.plotHeight),this.bottom=i.chartHeight-n-t,this.right=i.chartWidth-r-e,this.len=ue(o?r:n,0),this.pos=o?e:t},getExtremes:function(){var t=this.isLog;return{min:t?I(l(this.min)):this.min,max:t?I(l(this.max)):this.max,dataMin:this.dataMin,dataMax:this.dataMax,userMin:this.userMin,userMax:this.userMax}},getThreshold:function(t){var e=this.isLog,i=e?l(this.min):this.min,e=e?l(this.max):this.max;return i>t||null===t?t=i:t>e&&(t=e),this.translate(t,0,1,0,1)},autoLabelAlign:function(t){return t=(p(t,0)-90*this.side+720)%360,t>15&&165>t?"right":t>195&&345>t?"left":"center"},getOffset:function(){var t,e,i,n,r,s,o,a=this,l=a.chart,h=l.renderer,d=a.options,u=a.tickPositions,f=a.ticks,g=a.horiz,m=a.side,y=l.inverted?[1,0,3,2][m]:m,v=0,x=0,b=d.title,w=d.labels,k=0,S=l.axisOffset,T=l.clipOffset,C=[-1,1,1,-1][m],P=1,A=p(w.maxStaggerLines,5);if(a.hasData=t=a.hasVisibleSeries||c(a.min)&&c(a.max)&&!!u,a.showAxis=l=t||p(d.showEmpty,!0),a.s
return"horizontal"===o.layout&&(a/=2),l&&(a=pe(a,l)),g.length=0,t>a&&!o.useHTML?(this.clipHeight=e=a-20-this.titleHeight-this.padding,this.currentPage=p(this.currentPage,1),this.fullHeight=t,je(m,function(t,n){var r=t._legendItemPos[1],s=he(t.legendItem.bBox.height),o=g.length;(!o||r-g[o-1]>e)&&g.push(i||r),n===m.length-1&&r+s-g[o-1]>e&&g.push(r),r!==i&&(i=r)}),h||(h=n.clipRect=s.clipRect(0,this.padding,9999,0),n.contentGroup.clip(h)),h.attr({height:e}),f||(this.nav=f=s.g().attr({zIndex:1}).add(this.group),this.up=s.symbol("triangle",0,0,u,u).on("click",function(){n.scroll(-1,d)}).add(f),this.pager=s.text("",15,10).css(c.style).add(f),this.down=s.symbol("triangle-down",0,0,u,u).on("click",function(){n.scroll(1,d)}).add(f)),n.scroll(0),t=a):f&&(h.attr({height:r.chartHeight}),f.hide(),this.scrollGroup.attr({translateY:1}),this.clipHeight=0),t},scroll:function(t,e){var i=this.pages,n=i.length,r=this.currentPage+t,s=this.clipHeight,o=this.options.navigation,a=o.activeColor,o=o.inactiveColor,l=this.pager,h=this.padding;r>n&&(r=n),r>0&&(e!==_&&D(e,this.chart),this.nav.attr({translateX:h,translateY:s+this.padding+7+this.titleHeight,visibility:"visible"}),this.up.attr({fill:1===r?o:a}).css({cursor:1===r?"default":"pointer"}),l.attr({text:r+"/"+n}),this.down.attr({x:18+this.pager.getBBox().width,fill:r===n?o:a}).css({cursor:r===n?"default":"pointer"}),i=-i[r-1]+this.initialItemY,this.scrollGroup.animate({translateY:i}),this.currentPage=r,this.positionCheckboxes(i))}},li=Highcharts.LegendSymbolMixin={drawRectangle:function(t,e){var i=t.options.symbolHeight||12;e.legendSymbol=this.chart.renderer.rect(0,t.baseline-5-i/2,t.symbolWidth,i,p(t.options.symbolRadius,2)).attr({zIndex:3}).add(e.legendGroup)},drawLineMarker:function(t){var e,i=this.options,n=i.marker;e=t.symbolWidth;var r,s=this.chart.renderer,o=this.legendGroup,t=t.baseline-he(.3*s.fontMetrics(t.options.itemStyle.fontSize).b);i.lineWidth&&(r={"stroke-width":i.lineWidth},i.dashStyle&&(r.dashstyle=i.dashStyle),this.legendLine=s.path(["M",0,t,"L",e,t]).attr(r).add(o)),n&&n.enabled&&(i=n.radius,this.legendSymbol=e=s.symbol(this.symbol,e/2-i,t-i,2*i,2*i).add(o),e.isMarker=!0)}},/Trident\/7\.0/.test(xe)&&x(fi.prototype,"positionItem",function(t,e){var i=this,n=function(){e._legendItemPos&&t.call(i,e)};i.chart.renderer.forExport?n():setTimeout(n)}),N.prototype={init:function(t,i){var n,r=t.series;t.series=null,n=e($,t),n.series=t.series=r,this.userOptions=t,r=n.chart,this.margin=this.splashArray("margin",r),this.spacing=this.splashArray("spacing",r);var s=r.events;this.bounds={h:{},v:{}},this.callback=i,this.isResizing=0,this.options=n,this.axes=[],this.series=[],this.hasCartesianSeries=r.showAxes;var o,a=this;if(a.index=Re.length,Re.push(a),r.reflow!==!1&&Ze(a,"load",function(){a.initReflow()}),s)for(o in s)Ze(a,o,s[o]);a.xAxis=[],a.yAxis=[],a.animation=Me?!1:p(r.animation,!0),a.pointCount=0,a.counters=new S,a.firstRender()},initSeries:function(t){var e=this.options.chart;return(e=He[t.type||e.type||e.defaultSeriesType])||M(17,!0),e=new e,e.init(this,t),e},isInsidePlot:function(t,e,i){var n=i?e:t,t=i?t:e;return n>=0&&n<=this.plotWidth&&t>=0&&t<=this.plotHeight},adjustTickAmounts:function(){this.options.chart.alignTicks!==!1&&je(this.axes,function(t){t.adjustTickAmount()}),this.maxTicks=null},redraw:function(e){var i,n,r=this.axes,s=this.series,o=this.pointer,a=this.legend,l=this.isDirtyLegend,h=this.isDirtyBox,c=s.length,d=c,u=this.renderer,p=u.isHidden(),f=[];for(D(e,this),p&&this.cloneRenderTo(),this.layOutTitles();d--;)if(e=s[d],e.options.stacking&&(i=!0,e.isDirty)){n=!0;break}if(n)for(d=c;d--;)e=s[d],e.options.stacking&&(e.isDirty=!0);je(s,function(t){t.isDirty&&"point"===t.options.legendType&&(l=!0)}),l&&a.options.enabled&&(a.render(),this.isDirtyLegend=!1),i&&this.getStacks(),this.hasCartesianSeries&&(this.isResizing||(this.maxTicks=null,je(r,function(t){t.setScale()})),this.adjustTickAmounts(),this.getMargins(),je(r,function(t){t.isDirty&&(h=!0)}),je(r,function(e){e.isDirtyExtremes&&(e.isDirtyExtremes=!1,f.push(function(){Qe(e,"afterSetExtremes",t(e.eventArgs,e.getExtreme
e.getPointSpline?i.push.apply(i,e.getPointSpline(t,r,s)):(i.push(s?"L":"M"),n&&s&&(o=t[s-1],"right"===n?i.push(o.plotX,l):"center"===n?i.push((o.plotX+a)/2,o.plotY,(o.plotX+a)/2,l):i.push(a,o.plotY)),i.push(r.plotX,r.plotY))}),i},getGraphPath:function(){var t,e=this,i=[],n=[];return je(e.segments,function(r){t=e.getSegmentPath(r),r.length>1?i=i.concat(t):n.push(r[0])}),e.singlePoints=n,e.graphPath=i},drawGraph:function(){var t=this,e=this.options,i=[["graph",e.lineColor||this.color]],n=e.lineWidth,r=e.dashStyle,s="square"!==e.linecap,o=this.getGraphPath(),a=e.negativeColor;a&&i.push(["graphNeg",a]),je(i,function(i,a){var l=i[0],h=t[l];h?(ei(h),h.animate({d:o})):n&&o.length&&(h={stroke:i[1],"stroke-width":n,zIndex:1},r?h.dashstyle=r:s&&(h["stroke-linecap"]=h["stroke-linejoin"]="round"),t[l]=t.chart.renderer.path(o).attr(h).add(t.group).shadow(!a&&e.shadow))})},clipNeg:function(){var t,e=this.options,i=this.chart,n=i.renderer,r=e.negativeColor||e.negativeFillColor,s=this.graph,o=this.area,a=this.posClip,l=this.negClip;t=i.chartWidth;var h=i.chartHeight,c=ue(t,h),d=this.yAxis;r&&(s||o)&&(r=he(d.toPixels(e.threshold||0,!0)),0>r&&(c-=r),e={x:0,y:0,width:c,height:r},c={x:0,y:r,width:c,height:c},i.inverted&&(e.height=c.y=i.plotWidth-r,n.isVML&&(e={x:i.plotWidth-r-i.plotLeft,y:0,width:t,height:h},c={x:r+i.plotLeft-t,y:0,width:i.plotLeft+r,height:t})),d.reversed?(i=c,t=e):(i=e,t=c),a?(a.animate(i),l.animate(t)):(this.posClip=a=n.clipRect(i),this.negClip=l=n.clipRect(t),s&&this.graphNeg&&(s.clip(a),this.graphNeg.clip(l)),o&&(o.clip(a),this.areaNeg.clip(l))))},invertGroups:function(){function t(){var t={width:e.yAxis.len,height:e.xAxis.len};je(["group","markerGroup"],function(i){e[i]&&e[i].attr(t).invert()})}var e=this,i=e.chart;e.xAxis&&(Ze(i,"resize",t),Ze(e,"destroy",function(){Ke(i,"resize",t)}),t(),e.invertGroups=t)},plotGroup:function(t,e,i,n,r){var s=this[t],o=!s;return o&&(this[t]=s=this.chart.renderer.g(e).attr({visibility:i,zIndex:n||.1}).add(r)),s[o?"attr":"animate"](this.getPlotBox()),s},getPlotBox:function(){return{translateX:this.xAxis?this.xAxis.left:this.chart.plotLeft,translateY:this.yAxis?this.yAxis.top:this.chart.plotTop,scaleX:1,scaleY:1}},render:function(){var t,e=this.chart,i=this.options,n=i.animation&&!!this.animate&&e.renderer.isSVG,r=this.visible?"visible":"hidden",s=i.zIndex,o=this.hasRendered,a=e.seriesGroup;t=this.plotGroup("group","series",r,s,a),this.markerGroup=this.plotGroup("markerGroup","markers",r,s,a),n&&this.animate(!0),this.getAttribs(),t.inverted=this.isCartesian?e.inverted:!1,this.drawGraph&&(this.drawGraph(),this.clipNeg()),this.drawDataLabels&&this.drawDataLabels(),this.visible&&this.drawPoints(),this.options.enableMouseTracking!==!1&&this.drawTracker(),e.inverted&&this.invertGroups(),i.clip!==!1&&!this.sharedClipKey&&!o&&t.clip(e.clipRect),n?this.animate():o||this.afterAnimate(),this.isDirty=this.isDirtyData=!1,this.hasRendered=!0},redraw:function(){var t=this.chart,e=this.isDirtyData,i=this.group,n=this.xAxis,r=this.yAxis;i&&(t.inverted&&i.attr({width:t.plotWidth,height:t.plotHeight}),i.animate({translateX:p(n&&n.left,t.plotLeft),translateY:p(r&&r.top,t.plotTop)})),this.translate(),this.setTooltipPoints(!0),this.render(),e&&Qe(this,"updatedData")},setState:function(t){var e=this.options,i=this.graph,n=this.graphNeg,r=e.states,e=e.lineWidth,t=t||"";this.state!==t&&(this.state=t,r[t]&&r[t].enabled===!1||(t&&(e=r[t].lineWidth||e+1),i&&!i.dashstyle&&(t={"stroke-width":e},i.attr(t),n&&n.attr(t))))},setVisible:function(t,e){var i,n=this,r=n.chart,s=n.legendItem,o=r.options.chart.ignoreHiddenSeries,a=n.visible;i=(n.visible=t=n.userOptions.visible=t===_?!a:t)?"show":"hide",je(["group","dataLabelsGroup","markerGroup","tracker"],function(t){n[t]&&n[t][i]()}),r.hoverSeries===n&&n.onMouseOut(),s&&r.legend.colorizeItem(n,t),n.isDirty=!0,n.options.stacking&&je(r.series,function(t){t.options.stacking&&t.visible&&(t.isDirty=!0)}),je(n.linkedSeries,function(e){e.setVisible(t,!1)}),o&&(r.isDirtyBox=!0),e!==!1&&r.redraw(),Qe(n,i)},show:function(){this.setVisible(!0)},hide:function(){this.setVisible(!1)},s
$.update("/channels/"+t+"/windows/"+e+"/hide",function(){i.hide("drop",function(){i.remove()})})}};!function(t){function e(){var e=i(this);return isNaN(e.datetime)||t(this).text(n(e.datetime)),this}function i(e){if(e=t(e),!e.data("timeago")){e.data("timeago",{datetime:s.datetime(e)});var i=t.trim(e.text());i.length>0&&e.attr("title",i)}return e.data("timeago")}function n(t){return s.inWords(r(t))}function r(t){return(new Date).getTime()-t.getTime()}t.timeago=function(e){return e instanceof Date?n(e):"string"==typeof e?n(t.timeago.parse(e)):n(t.timeago.datetime(e))};var s=t.timeago;t.extend(t.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,strings:{prefixAgo:null,prefixFromNow:null,suffixAgo:"ago",suffixFromNow:"from now",seconds:"less than a minute",minute:"about a minute",minutes:"%d minutes",hour:"about an hour",hours:"about %d hours",day:"a day",days:"%d days",month:"about a month",months:"%d months",year:"about a year",years:"%d years",numbers:[]}},inWords:function(e){function i(i,r){var s=t.isFunction(i)?i(r,e):i,o=n.numbers&&n.numbers[r]||r;return s.replace(/%d/i,o)}var n=this.settings.strings,r=n.prefixAgo,s=n.suffixAgo;this.settings.allowFuture&&(0>e&&(r=n.prefixFromNow,s=n.suffixFromNow),e=Math.abs(e));var o=e/1e3,a=o/60,l=a/60,h=l/24,c=h/365,d=45>o&&i(n.seconds,Math.round(o))||90>o&&i(n.minute,1)||45>a&&i(n.minutes,Math.round(a))||90>a&&i(n.hour,1)||24>l&&i(n.hours,Math.round(l))||48>l&&i(n.day,1)||30>h&&i(n.days,Math.floor(h))||60>h&&i(n.month,1)||365>h&&i(n.months,Math.floor(h/30))||2>c&&i(n.year,1)||i(n.years,Math.floor(c));return t.trim([r,d,s].join(" "))},parse:function(e){var i=t.trim(e);return i=i.replace(/\.\d\d\d+/,""),i=i.replace(/-/,"/").replace(/-/,"/"),i=i.replace(/T/," ").replace(/Z/," UTC"),i=i.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"),new Date(i)},datetime:function(e){var i="time"===t(e).get(0).tagName.toLowerCase(),n=i?t(e).attr("datetime"):t(e).attr("title");return s.parse(n)}}),t.fn.timeago=function(){var t=this;t.each(e);var i=s.settings;return i.refreshMillis>0&&setInterval(function(){t.each(e)},i.refreshMillis),t},document.createElement("abbr"),document.createElement("time")}(jQuery),function(t){function e(t,e){return e.measureText(t).width}function i(t,e){return e.text(t),e.width()}var n,r,s,o=!1;t.fn.shorten=function(){var o={},a=arguments,l=a.callee;if(a.length)if(a[0].constructor==Object)o=a[0];else{if("options"==a[0])return t(this).eq(0).data("shorten-options");o={width:parseInt(a[0]),tail:a[1]}}this.css("visibility","hidden");var h=t.extend({},l.defaults,o);return this.each(function(){var a,c=t(this),d=c.text(),u=d.length,p=t("<span/>").html(h.tail).text(),f={shortened:!1,textOverflow:!1};if(a="none"!=c.css("float")?h.width||c.width():h.width||c.parent().width(),0>a)return!0;if(c.data("shorten-options",h),this.style.display="inline-block",this.style.whiteSpace="nowrap",n){var g=t(this),m=document.createElement("canvas");ctx=m.getContext("2d"),g.html(m),ctx.font=g.css("font-style")+" "+g.css("font-variant")+" "+g.css("font-weight")+" "+Math.ceil(parseFloat(g.css("font-size")))+"px "+g.css("font-family"),r=ctx,s=e}else g=t('<table style="padding:0; margin:0; border:none; font:inherit;width:auto;zoom:1;position:absolute;"><tr style="padding:0; margin:0; border:none; font:inherit;"><td style="padding:0; margin:0; border:none; font:inherit;white-space:nowrap;"></td></tr></table>'),$td=t("td",g),t(this).html(g),r=$td,s=i;if(g=s.call(this,d,r),a>g)return c.text(d),this.style.visibility="visible",c.data("shorten-info",f),!0;if(h.tooltip&&this.setAttribute("title",d),l._native&&!o.width&&(m=t("<span>"+h.tail+"</span>").text(),1==m.length&&8230==m.charCodeAt(0)))return c.text(d),this.style.overflow="hidden",this.style[l._native]="ellipsis",this.style.visibility="visible",f.shortened=!0,f.textOverflow="ellipsis",c.data("shorten-info",f),!0;p=s.call(this,p,r),a-=p,p=1.15*a,g-p>0&&(p=d.substring(0,Math.ceil(u*(p/g))),s.call(this,p,r)>a&&(d=p,u=d.length));do u--,d=d.substring(0,u);while(s.call(this,d,r)>=a);return c.html(t.trim(t("<span/>").text(d).html())+h.tail),this.style.visibility="visibl