From ced440f886cead1ae33eb1021c34131c20221dfd Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 29 Nov 2010 15:17:39 +0000 Subject: [PATCH] applications: remove luci-app-livestats --- applications/luci-livestats/Makefile | 4 - .../resources/livestats/ExCanvas.js | 19 - .../resources/livestats/GraphRPC.js | 204 - .../resources/livestats/JsonRpc.js | 220 - .../luci-static/resources/livestats/Legend.js | 228 - .../resources/livestats/MochiKit.js | 4800 ----------------- .../resources/livestats/PlotKit.js | 2177 -------- .../luasrc/controller/livestats.lua | 31 - .../luasrc/view/livestats/loadavg.htm | 33 - .../luasrc/view/livestats/traffic.htm | 66 - .../luasrc/view/livestats/wireless.htm | 43 - contrib/package/luci/Makefile | 3 - 12 files changed, 7828 deletions(-) delete mode 100644 applications/luci-livestats/Makefile delete mode 100644 applications/luci-livestats/htdocs/luci-static/resources/livestats/ExCanvas.js delete mode 100644 applications/luci-livestats/htdocs/luci-static/resources/livestats/GraphRPC.js delete mode 100644 applications/luci-livestats/htdocs/luci-static/resources/livestats/JsonRpc.js delete mode 100644 applications/luci-livestats/htdocs/luci-static/resources/livestats/Legend.js delete mode 100644 applications/luci-livestats/htdocs/luci-static/resources/livestats/MochiKit.js delete mode 100644 applications/luci-livestats/htdocs/luci-static/resources/livestats/PlotKit.js delete mode 100644 applications/luci-livestats/luasrc/controller/livestats.lua delete mode 100644 applications/luci-livestats/luasrc/view/livestats/loadavg.htm delete mode 100644 applications/luci-livestats/luasrc/view/livestats/traffic.htm delete mode 100644 applications/luci-livestats/luasrc/view/livestats/wireless.htm diff --git a/applications/luci-livestats/Makefile b/applications/luci-livestats/Makefile deleted file mode 100644 index 9ee051cd7..000000000 --- a/applications/luci-livestats/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -PO = livestats - -include ../../build/config.mk -include ../../build/module.mk diff --git a/applications/luci-livestats/htdocs/luci-static/resources/livestats/ExCanvas.js b/applications/luci-livestats/htdocs/luci-static/resources/livestats/ExCanvas.js deleted file mode 100644 index 9d71658ad..000000000 --- a/applications/luci-livestats/htdocs/luci-static/resources/livestats/ExCanvas.js +++ /dev/null @@ -1,19 +0,0 @@ -if(!window.CanvasRenderingContext2D){(function(){var I=Math,i=I.round,L=I.sin,M=I.cos,m=10,A=m/2,Q={init:function(a){var b=a||document;if(/MSIE/.test(navigator.userAgent)&&!window.opera){var c=this;b.attachEvent("onreadystatechange",function(){c.r(b)})}},r:function(a){if(a.readyState=="complete"){if(!a.namespaces["s"]){a.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml")}var b=a.createStyleSheet();b.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}g_vml_\\:*{behavior:url(#default#VML)}"; -var c=a.getElementsByTagName("canvas");for(var d=0;d"){var d="/"+a.tagName,e;while((e=a.nextSibling)&&e.tagName!=d){e.removeNode()}if(e){e.removeNode()}}a.parentNode.replaceChild(c,a);return c},initElement:function(a){a=this.q(a);a.getContext=function(){if(this.l){return this.l}return this.l=new K(this)};a.attachEvent("onpropertychange",V);a.attachEvent("onresize", -W);var b=a.attributes;if(b.width&&b.width.specified){a.style.width=b.width.nodeValue+"px"}else{a.width=a.clientWidth}if(b.height&&b.height.specified){a.style.height=b.height.nodeValue+"px"}else{a.height=a.clientHeight}return a}};function V(a){var b=a.srcElement;switch(a.propertyName){case "width":b.style.width=b.attributes.width.nodeValue+"px";b.getContext().clearRect();break;case "height":b.style.height=b.attributes.height.nodeValue+"px";b.getContext().clearRect();break}}function W(a){var b=a.srcElement; -if(b.firstChild){b.firstChild.style.width=b.clientWidth+"px";b.firstChild.style.height=b.clientHeight+"px"}}Q.init();var R=[];for(var E=0;E<16;E++){for(var F=0;F<16;F++){R[E*16+F]=E.toString(16)+F.toString(16)}}function J(){return[[1,0,0],[0,1,0],[0,0,1]]}function G(a,b){var c=J();for(var d=0;d<3;d++){for(var e=0;e<3;e++){var g=0;for(var h=0;h<3;h++){g+=a[d][h]*b[h][e]}c[d][e]=g}}return c}function N(a,b){b.fillStyle=a.fillStyle;b.lineCap=a.lineCap;b.lineJoin=a.lineJoin;b.lineWidth=a.lineWidth;b.miterLimit= -a.miterLimit;b.shadowBlur=a.shadowBlur;b.shadowColor=a.shadowColor;b.shadowOffsetX=a.shadowOffsetX;b.shadowOffsetY=a.shadowOffsetY;b.strokeStyle=a.strokeStyle;b.d=a.d;b.e=a.e}function O(a){var b,c=1;a=String(a);if(a.substring(0,3)=="rgb"){var d=a.indexOf("(",3),e=a.indexOf(")",d+1),g=a.substring(d+1,e).split(",");b="#";for(var h=0;h<3;h++){b+=R[Number(g[h])]}if(g.length==4&&a.substr(3,1)=="a"){c=g[3]}}else{b=a}return[b,c]}function S(a){switch(a){case "butt":return"flat";case "round":return"round"; -case "square":default:return"square"}}function K(a){this.a=J();this.m=[];this.k=[];this.c=[];this.strokeStyle="#000";this.fillStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=m*1;this.globalAlpha=1;this.canvas=a;var b=a.ownerDocument.createElement("div");b.style.width=a.clientWidth+"px";b.style.height=a.clientHeight+"px";b.style.overflow="hidden";b.style.position="absolute";a.appendChild(b);this.j=b;this.d=1;this.e=1}var j=K.prototype;j.clearRect=function(){this.j.innerHTML= -"";this.c=[]};j.beginPath=function(){this.c=[]};j.moveTo=function(a,b){this.c.push({type:"moveTo",x:a,y:b});this.f=a;this.g=b};j.lineTo=function(a,b){this.c.push({type:"lineTo",x:a,y:b});this.f=a;this.g=b};j.bezierCurveTo=function(a,b,c,d,e,g){this.c.push({type:"bezierCurveTo",cp1x:a,cp1y:b,cp2x:c,cp2y:d,x:e,y:g});this.f=e;this.g=g};j.quadraticCurveTo=function(a,b,c,d){var e=this.f+0.6666666666666666*(a-this.f),g=this.g+0.6666666666666666*(b-this.g),h=e+(c-this.f)/3,l=g+(d-this.g)/3;this.bezierCurveTo(e, -g,h,l,c,d)};j.arc=function(a,b,c,d,e,g){c*=m;var h=g?"at":"wa",l=a+M(d)*c-A,n=b+L(d)*c-A,o=a+M(e)*c-A,f=b+L(e)*c-A;if(l==o&&!g){l+=0.125}this.c.push({type:h,x:a,y:b,radius:c,xStart:l,yStart:n,xEnd:o,yEnd:f})};j.rect=function(a,b,c,d){this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+c,b+d);this.lineTo(a,b+d);this.closePath()};j.strokeRect=function(a,b,c,d){this.beginPath();this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+c,b+d);this.lineTo(a,b+d);this.closePath();this.stroke()};j.fillRect=function(a, -b,c,d){this.beginPath();this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+c,b+d);this.lineTo(a,b+d);this.closePath();this.fill()};j.createLinearGradient=function(a,b,c,d){var e=new H("gradient");return e};j.createRadialGradient=function(a,b,c,d,e,g){var h=new H("gradientradial");h.n=c;h.o=g;h.i.x=a;h.i.y=b;return h};j.drawImage=function(a,b){var c,d,e,g,h,l,n,o,f=a.runtimeStyle.width,k=a.runtimeStyle.height;a.runtimeStyle.width="auto";a.runtimeStyle.height="auto";var q=a.width,r=a.height;a.runtimeStyle.width= -f;a.runtimeStyle.height=k;if(arguments.length==3){c=arguments[1];d=arguments[2];h=(l=0);n=(e=q);o=(g=r)}else if(arguments.length==5){c=arguments[1];d=arguments[2];e=arguments[3];g=arguments[4];h=(l=0);n=q;o=r}else if(arguments.length==9){h=arguments[1];l=arguments[2];n=arguments[3];o=arguments[4];c=arguments[5];d=arguments[6];e=arguments[7];g=arguments[8]}else{throw"Invalid number of arguments";}var s=this.b(c,d),t=[],v=10,w=10;t.push(" ','","");this.j.insertAdjacentHTML("BeforeEnd",t.join(""))};j.stroke=function(a){var b=[],c=O(a?this.fillStyle:this.strokeStyle),d=c[0],e=c[1]*this.globalAlpha,g=10,h=10;b.push("n.x){n.x=k.x}if(l.y== -null||k.yn.y){n.y=k.y}}}b.push(' ">');if(typeof this.fillStyle=="object"){var v={x:"50%",y:"50%"},w=n.x-l.x,x=n.y-l.y,p=w>x?w:x;v.x=i(this.fillStyle.i.x/w*100+50)+"%";v.y=i(this.fillStyle.i.y/x*100+50)+"%";var y=[];if(this.fillStyle.p=="gradientradial"){var z=this.fillStyle.n/p*100,B=this.fillStyle.o/p*100-z}else{var z=0,B=100}var C={offset:null,color:null},D={offset:null,color:null};this.fillStyle.h.sort(function(T,U){return T.offset-U.offset});for(var o=0;oC.offset||C.offset==null){C.offset=u.offset;C.color=u.color}if(u.offset')}else if(a){b.push('')}else{b.push("')}b.push("");this.j.insertAdjacentHTML("beforeEnd",b.join(""));this.c=[]};j.fill=function(){this.stroke(true)};j.closePath=function(){this.c.push({type:"close"})};j.b=function(a,b){return{x:m*(a*this.a[0][0]+b*this.a[1][0]+this.a[2][0])-A,y:m*(a*this.a[0][1]+b*this.a[1][1]+this.a[2][1])-A}};j.save=function(){var a={};N(this,a); -this.k.push(a);this.m.push(this.a);this.a=G(J(),this.a)};j.restore=function(){N(this.k.pop(),this);this.a=this.m.pop()};j.translate=function(a,b){var c=[[1,0,0],[0,1,0],[a,b,1]];this.a=G(c,this.a)};j.rotate=function(a){var b=M(a),c=L(a),d=[[b,c,0],[-c,b,0],[0,0,1]];this.a=G(d,this.a)};j.scale=function(a,b){this.d*=a;this.e*=b;var c=[[a,0,0],[0,b,0],[0,0,1]];this.a=G(c,this.a)};j.clip=function(){};j.arcTo=function(){};j.createPattern=function(){return new P};function H(a){this.p=a;this.n=0;this.o= -0;this.h=[];this.i={x:0,y:0}}H.prototype.addColorStop=function(a,b){b=O(b);this.h.push({offset:1-a,color:b})};function P(){}G_vmlCanvasManager=Q;CanvasRenderingContext2D=K;CanvasGradient=H;CanvasPattern=P})()}; diff --git a/applications/luci-livestats/htdocs/luci-static/resources/livestats/GraphRPC.js b/applications/luci-livestats/htdocs/luci-static/resources/livestats/GraphRPC.js deleted file mode 100644 index 712d8b1f7..000000000 --- a/applications/luci-livestats/htdocs/luci-static/resources/livestats/GraphRPC.js +++ /dev/null @@ -1,204 +0,0 @@ -function Graph(container, id, options, transform, legend) { - if( !options ) options = { }; - - this.id = id; - this.cols = 100; - this.type = "line"; - this.options = options; - this.transform = transform; - this.dataset = {}; - this.legend = legend; - this.lastvalue = {}; - - var name = (options.instanceNames && options.instanceNames[id]) - ? options.instanceNames[id] : id; - var graph = document.createElement('div'); - var label = document.createElement('h2'); - label.innerHTML = options.title - ? options.title.replace("%s", name) : name; - - container.appendChild( label ); - container.appendChild( graph ); - - this.canvas = document.createElement('canvas'); - graph.appendChild( this.canvas ); - - this.canvas.id = id; - this.canvas.width = ( options.width || graph.offsetWidth - 20 ); - this.canvas.height = ( options.height || 300 ); -} - -Graph.prototype.addDataset = function(name, ds) { - if( !this.layout ) { - this.layout = new PlotKit.Layout( this.type, this.options ); - } - - if( !ds ) { - ds = new Array(); - for( var i = 0; i < this.cols; i++ ) - ds[i] = new Array( i, 0 ); - } - - this.dataset[name] = ds; - this.layout.addDataset(name, ds); -} - -Graph.prototype.updateDataset = function(name, value) { - if( this.dataset[name] ) { - var ds = this.dataset[name]; - - for( var i = 1; i < this.cols; i++ ) - ds[i-1][1] = ds[i][1]; - - value = Math.abs( parseFloat(value) || 0 ); - - if( this.transform ) { - var orgvalue = value; - value = (this.lastvalue[name]) ? this.transform(value, this.lastvalue[name]) : 0; - this.lastvalue[name] = orgvalue; - } - - ds[this.cols-1][1] = value; - this.layout.addDataset(name, ds); - } -} - -Graph.prototype.draw = function( options ) { - if( this.layout ) { - this.plotter = new PlotKit.CanvasRenderer( - this.canvas, this.layout, this.options || options || {} - ); - - this.layout.evaluate(); - this.plotter.render(); - - legend_opt = { - "legendStyle": 'li' - }; - - legend = new LegendRenderer(this.legend, this.layout, legend_opt); - legend.render(); - } -} - -Graph.prototype.redraw = function() { - if( this.layout && this.plotter ) { - this.layout.evaluate(); - this.plotter.clear(); - this.plotter.render(); - } -} - - -function GraphRPC(container, uri, action, interval, datasources, options, transform, legend) { - this.ds = datasources; - this.uri = uri - this.action = action; - this.options = options || { }; - this.container = container; - this.transform = transform; - this.proxy = new MochiKit.JsonRpc.JsonRpcProxy(uri, [action]); - this.graphs = new Object(); - this.legend = legend; - - this.requestData(); - - if( interval ) { - var self = this; - window.setInterval(function(){self.requestData()}, interval); - } -} - -GraphRPC.prototype.requestData = function() { - var r = this.proxy[this.action](); var self = this; - r.addCallback(function(r){ self.dispatchResponse(r) }); - r.addErrback(function(e){ throw('Error: ' + e) }); -} - -GraphRPC.prototype.dispatchResponse = function(response) { - var instances; - if( this.options.instances ) { - instances = this.options.instances; - } - else { - instances = new Array(); - for( var instance in response ) { - instances[instances.length] = instance; - } - } - - for( var j = 0; j < instances.length; j++ ) { - var instance = instances[j]; - - if( this.options.separateDS ) { - for( var i = 0; i < this.ds.length; i += 2 ) { - var name = this.ds[i+1] || this.ds[i]; - var gid = instance + '-' + name; - var otle = this.options.title || instance; - - if( !this.graphs[gid] ) { - this.options.title = otle.replace('%s', instance) + ': ' + name; - this.graphs[gid] = new Graph( - this.container, gid, this.options, this.transform, this.legend - ); - - this.graphs[gid].addDataset(name); - this.graphs[gid].draw(); - this.options.title = otle; - } - else - { - var datum = null; - if (typeof (this.ds[i]) == "function") { - datum = this.ds[i]( - instance ? response[instance] : response - ); - } else { - datum = instance - ? response[instance][this.ds[i]] - : response[this.ds[i]] - } - this.graphs[gid].updateDataset( - name, datum - ); - this.graphs[gid].redraw(); - } - } - } - else { - var gid = instance || 'livegraph'; - if( !this.graphs[gid] ) { - this.graphs[gid] = new Graph( - this.container, gid, this.options, this.transform, this.legend - ); - - for( var i = 0; i < this.ds.length; i += 2 ) { - var name = this.ds[i+1] || this.ds[i]; - this.graphs[gid].addDataset(name); - } - - this.graphs[gid].draw(); - } - else { - for( var i = 0; i < this.ds.length; i += 2 ) { - var name = this.ds[i+1] || this.ds[i]; - var datum = null; - if (typeof (this.ds[i]) == "function") { - datum = this.ds[i]( - instance ? response[instance] : response - ); - } else { - datum = instance - ? response[instance][this.ds[i]] - : response[this.ds[i]] - } - this.graphs[gid].updateDataset( - name, datum - ); - } - - this.graphs[gid].redraw(); - } - } - } -} diff --git a/applications/luci-livestats/htdocs/luci-static/resources/livestats/JsonRpc.js b/applications/luci-livestats/htdocs/luci-static/resources/livestats/JsonRpc.js deleted file mode 100644 index f1723ec1c..000000000 --- a/applications/luci-livestats/htdocs/luci-static/resources/livestats/JsonRpc.js +++ /dev/null @@ -1,220 +0,0 @@ -/* MochiKit.JsonRpc */ - -if (typeof(dojo) != 'undefined') { - dojo.provide("MochiKit.JsonRpc"); - dojo.require("MochiKit.Base"); - dojo.require("MochiKit.DOM"); - dojo.require("MochiKit.Async"); -} - -if (typeof(JSAN) != 'undefined') { - JSAN.use("MochiKit.Base", []); - JSAN.use("MochiKit.DOM", []); - JSAN.use("MochiKit.Async", []); -} - -try { - if (typeof(MochiKit.Base) == 'undefined' || - typeof(MochiKit.DOM) == 'undefined' || - typeof(MochiKit.Async) == 'undefined') { - throw ""; - } -} catch (e) { - throw "MochiKit.JsonRpc depends on MochiKit.Base, MochiKit.DOM and MochiKit.Async"; -} - -if (typeof(MochiKit.JsonRpc) == 'undefined') { - MochiKit.JsonRpc = {}; -} - -MochiKit.JsonRpc.NAME = "MochiKit.JsonRpc"; -MochiKit.JsonRpc.VERSION = "0.90"; - -MochiKit.JsonRpc.__repr__ = function () { - return "[" + this.NAME + " " + this.VERSION + "]"; -} - -MochiKit.JsonRpc.toString = function () { - return this.__repr__(); -} - -MochiKit.JsonRpc.JsonRpcError = function (message) { - this.message = message; - this.name = 'JsonRpcError'; -} - -MochiKit.JsonRpc.JsonRpcError.prototype = new Error(); -MochiKit.JsonRpc.JsonRpcError.prototype.repr = function () { - return 'JsonRpcError(' + this.message + ')'; -} - -MochiKit.JsonRpc.JsonRpcError.prototype.toString = function () { - return this.repr(); -} - -MochiKit.JsonRpc.jsonObject = function (o) { - var attrs=[]; - for(attr in o){ - if(typeof o[attr] != "function"){ - attrs.push('"' + attr + '": ' + json(o[attr])); - } - } - return "{" + attrs.join(", ") + "}"; -} - -MochiKit.JsonRpc.isObject = function (o) { - return true; -} - -MochiKit.JsonRpc.jsonArray = function (o) { - return "[" + MochiKit.Base.map(json, o).join(", ") + "]"; -} - -var MB = MochiKit.Base - -MochiKit.JsonRpc.jsonRegistry = new MochiKit.Base.AdapterRegistry(); -MochiKit.JsonRpc.jsonRegistry.register('arrayLike',MB.isArrayLike,MochiKit.JsonRpc.jsonArray); -MochiKit.JsonRpc.jsonRegistry.register("string", MB.typeMatcher("string"), MB.reprString); -MochiKit.JsonRpc.jsonRegistry.register("numbers", MB.typeMatcher("number", "boolean"), MB.reprNumber); -MochiKit.JsonRpc.jsonRegistry.register("undefined", MB.isUndefined, MB.reprUndefined); -MochiKit.JsonRpc.jsonRegistry.register("null", MB.isNull, MB.reprNull); -MochiKit.JsonRpc.jsonRegistry.register("objectLike", MochiKit.JsonRpc.isObject, MochiKit.JsonRpc.jsonObject); - -MochiKit.JsonRpc.json = function (o) { - try { - if (typeof(o.__json__) == 'function') { - return o.__json__(); - } else if (typeof(o.json) == 'function' && o.json != arguments.callee) { - return o.json(); - } - return jsonRegistry.match(o); - } catch (e) { - if (typeof(o.NAME) == 'string' && ( - o.toString == Function.prototype.toString || - o.toString == Object.prototype.toString - )) { - return o.NAME; - } - return o; - } - -} - - -MochiKit.JsonRpc.JsonRpcCall = function (method,params) { - this.method = method; - this.params = params; - this.id = '0'; -} - -MochiKit.JsonRpc.JsonRpcProxy = function (url,methNames) { - MochiKit.Base.bindMethods(this); - this.url = url; - if (methNames) { - MochiKit.Base.map(this._proxyMethod,methNames); - } -} - -update(MochiKit.JsonRpc.JsonRpcProxy.prototype, { - 'call': function () { - var arglist = MochiKit.Base.map(null,arguments) - var methname = arglist.shift() - log(arglist); - var callobj = new MochiKit.JsonRpc.JsonRpcCall(methname,arglist); - var callstr = json(callobj); - var req = MochiKit.Async.getXMLHttpRequest(); - req.open("POST",this.url,true); - req.setRequestHeader("Content-Type","text/plain"); - req.setRequestHeader("Content-Length",callstr.length); - var d = MochiKit.Async.sendXMLHttpRequest(req,callstr); - d.addCallback(MochiKit.Async.evalJSONRequest); - d.addCallback(this._extractResult); - - return d - }, - 'addSingleMethod': function (methName) { - if (methName) { - this._proxyMethod(methName); - } - }, - 'addMethods': function (methNames) { - if (methNames) { - MochiKit.Base.map(this._proxyMethod,methNames); - } - }, - '_extractResult': function (resp) { - if (!resp.error){ - return resp.result; - } else { - throw new MochiKit.JsonRpc.JsonRpcError(resp.error); - } - }, - '_proxyMethod': function (methname) { - this[methname] = MochiKit.Base.partial(this.call,methname); - } -}); - -MochiKit.JsonRpc.DomObjectFromJson = function (){ - var retval = false; - if (arguments.length == 1) { - var arg = arguments[0]; - if (typeof(arg) == 'string'){ - retval = MochiKit.DOM.SPAN(null,arg); - } else { - var objrepr = arguments[0]; - var elem = document.createElement(objrepr[0]); - var attrs = objrepr[1]; - if (attrs) { - MochiKit.DOM.updateNodeAttributes(elem, attrs); - } - if (objrepr.length >= 3){ - var extraobj = objrepr[2] - for (var i=0;i - For use under the BSD license. - -*/ - -try { - if (typeof(MochiKit.Base) == 'undefined' || - typeof(MochiKit.DOM) == 'undefined' || - typeof(MochiKit.Color) == 'undefined' || - typeof(MochiKit.Format) == 'undefined' || - typeof(PlotKit.Layout) == 'undefined' || - typeof(PlotKit.Base) == 'undefined') - { - throw ""; - } -} -catch (e) { - throw "PlotKit depends on MochiKit.{Base,Color,DOM,Format}" -} - -if (typeof(PlotKit.LegendRenderer) == 'undefined') { - PlotKit.LegendRenderer = {}; -} - -PlotKit.LegendRenderer = function(element, layout, options) { - if (arguments.length > 0) - this.__init__(element, layout, options); -}; - - -PlotKit.LegendRenderer.NAME = "PlotKit.LegendRenderer"; -PlotKit.LegendRenderer.VERSION = PlotKit.VERSION; - -PlotKit.LegendRenderer.__repr__ = function() { - return "[" + this.NAME + " " + this.VERSION + "]"; -}; - -PlotKit.LegendRenderer.toString = function() { - return this.__repr__(); -} - -PlotKit.LegendRenderer.prototype.__init__ = function(element, layout, -options) { - var isNil = MochiKit.Base.isUndefinedOrNull; - var Color = MochiKit.Color.Color; - - this.options = { - "colorScheme": PlotKit.Base.palette(PlotKit.Base.baseColors() -[0]), - "legendStyle": "table", - "tableColumns": 1 - }; - MochiKit.Base.update(this.options, options ? options : {}); - - this.layout = layout; - this.element = MochiKit.DOM.getElement(element); - // --- check whether everything is ok before we return - - if (isNil(this.element)) - throw "CRILegend() - passed legend is not found"; -}; - -PlotKit.LegendRenderer.prototype.render = function() { - var colorScheme = this.options.colorScheme; - var setNames = PlotKit.Base.keys(this.layout.datasets); - - MochiKit.DOM.updateNodeAttributes(this.element, - {"style": - {"margin":"0" - ,"padding":"0" - } - }); - - - var ul = null; - if (this.options.legendStyle == "table") - ul = this._renderListTable(colorScheme, setNames); - else - ul = this._renderList(colorScheme, setNames); - MochiKit.DOM.appendChildNodes(this.element, ul); - -}; - -PlotKit.LegendRenderer.prototype._renderList = function(colorScheme, -setNames) { - var ul = document.createElement("ul"); - ul.style.listStyle="none"; - ul.style.margin="0"; - ul.style.padding="0"; - - var colorCount = colorScheme.length; - var setCount = setNames.length; - - for (var i = 0; i < setCount; i++) { - var setName = setNames[i]; - var color = colorScheme[i%colorCount]; - var le = this._renderElement(setName, color.toRGBString()); - ul.appendChild(le); - } - - return ul; -}; - -PlotKit.LegendRenderer.prototype._renderElement = function(title, -color) { - var le = MochiKit.DOM.createDOM("li"); - le.style.listStyle="none"; - le.style.margin="0 0 5px 0"; - le.style.padding="0"; - - var box = MochiKit.DOM.createDOM("div"); - box.style.backgroundColor=color; - box.style.width="2em"; - box.style.height=".9em"; - box.style.border="1px solid black"; - box.style.margin="0 5px 0 0"; - box.style.padding="0"; - box.style.float="left"; - box.style.cssFloat="left"; - box.style.clear="left"; - box.style.cssClear="left"; - - var span = MochiKit.DOM.createDOM("span"); - MochiKit.DOM.appendChildNodes(span, -document.createTextNode(title)); - - MochiKit.DOM.appendChildNodes(le, box, span); - - return le; -}; - -PlotKit.LegendRenderer.prototype._renderListTable = -function(colorScheme, setNames) { - var tabhead = THEAD(null); - var tabfoot = TFOOT(null); - - var tabbody = partial(TBODY, null); - var i = 0; - var colorcount = colorScheme.length; - var tabrow; - var columns = this.options.tableColumns; - for (var label in setNames) - { - var legendcolor = colorScheme[i%colorcount]; - var legendbox = DIV({'class': 'legendbox', 'className': -'legendbox'}); - legendbox.style.width = "10px"; - legendbox.style.height = "10px"; - legendbox.style.backgroundColor = legendcolor.toHexString(); - legendbox.style.borderWidth = "1px"; - legendbox.style.borderStyle = "solid"; - legendbox.style.borderColor = "#000000"; - var boxcell = TD(null, legendbox); - - var labelcell = TD({'class': 'legendlabel', 'className': -'legendlabel'}, setNames[i]); - labelcell.style.font = 'normal 10pt arial'; - - if (!(i % columns)) - { - tabrow = partial(TR, null); - } - tabrow = partial(tabrow, boxcell, labelcell); - if (i % columns) - { - tabrow = tabrow(null); - tabbody = partial(tabbody, tabrow); - } - i++; - } - if ((setNames % columns)) - { - tabrow = tabrow(TD(null), TD(null)); - tabbody = partial(tabbody, tabrow); - } - tabbody = tabbody(null); - - tab = TABLE({'class': 'legendcontainer', 'className': -'legendcontainer'}, tabhead, tabfoot, tabbody); - tab.style.marginTop = '1em'; - tab.style.marginLeft = '1.5em'; - tab.style.marginBottom = '1em'; - tab.style.borderWidth = '1px'; - tab.style.borderStyle = 'solid'; - tab.style.borderColor = '#000000'; - - return tab; -}; - -// Namespace Iniitialisation - -PlotKit.Legend = {} -PlotKit.Legend.LegendRenderer = PlotKit.LegendRenderer; - - -PlotKit.Legend.EXPORT = [ - "LegendRenderer" -]; - -PlotKit.Legend.EXPORT_OK = [ - "LegendRenderer" -]; - -PlotKit.Legend.__new__ = function() { - var m = MochiKit.Base; - - m.nameFunctions(this); - - this.EXPORT_TAGS = { - ":common": this.EXPORT, - ":all": m.concat(this.EXPORT, this.EXPORT_OK) - }; -}; - -PlotKit.Legend.__new__(); -MochiKit.Base._exportSymbols(this, PlotKit.Legend); \ No newline at end of file diff --git a/applications/luci-livestats/htdocs/luci-static/resources/livestats/MochiKit.js b/applications/luci-livestats/htdocs/luci-static/resources/livestats/MochiKit.js deleted file mode 100644 index c023c1e8e..000000000 --- a/applications/luci-livestats/htdocs/luci-static/resources/livestats/MochiKit.js +++ /dev/null @@ -1,4800 +0,0 @@ -/*** - - MochiKit.MochiKit 1.3.1 : PACKED VERSION - - THIS FILE IS AUTOMATICALLY GENERATED. If creating patches, please - diff against the source tree, not this file. - - See for documentation, downloads, license, etc. - - (c) 2005 Bob Ippolito. All rights Reserved. - -***/ - -if(typeof (dojo)!="undefined"){ -dojo.provide("MochiKit.Base"); -} -if(typeof (MochiKit)=="undefined"){ -MochiKit={}; -} -if(typeof (MochiKit.Base)=="undefined"){ -MochiKit.Base={}; -} -MochiKit.Base.VERSION="1.3.1"; -MochiKit.Base.NAME="MochiKit.Base"; -MochiKit.Base.update=function(_1,_2){ -if(_1===null){ -_1={}; -} -for(var i=1;i=0;i--){ -_12.unshift(o[i]); -} -}else{ -res.push(o); -} -} -return res; -},extend:function(_13,obj,_15){ -if(!_15){ -_15=0; -} -if(obj){ -var l=obj.length; -if(typeof (l)!="number"){ -if(typeof (MochiKit.Iter)!="undefined"){ -obj=MochiKit.Iter.list(obj); -l=obj.length; -}else{ -throw new TypeError("Argument not an array-like and MochiKit.Iter not present"); -} -} -if(!_13){ -_13=[]; -} -for(var i=_15;i>b; -},zrshift:function(a,b){ -return a>>>b; -},eq:function(a,b){ -return a==b; -},ne:function(a,b){ -return a!=b; -},gt:function(a,b){ -return a>b; -},ge:function(a,b){ -return a>=b; -},lt:function(a,b){ -return al){ -_41=l; -} -} -_40=[]; -for(i=0;i<_41;i++){ -var _42=[]; -for(var j=1;j0){ -_57=m.concat(me.im_preargs,_57); -} -var _52=me.im_self; -if(!_52){ -_52=this; -} -return me.im_func.apply(_52,_57); -}; -_56.im_self=_55; -_56.im_func=_53; -_56.im_preargs=_54; -return _56; -},bindMethods:function(_58){ -var _59=MochiKit.Base.bind; -for(var k in _58){ -var _60=_58[k]; -if(typeof (_60)=="function"){ -_58[k]=_59(_60,_58); -} -} -},registerComparator:function(_61,_62,_63,_64){ -MochiKit.Base.comparatorRegistry.register(_61,_62,_63,_64); -},_primitives:{"boolean":true,"string":true,"number":true},compare:function(a,b){ -if(a==b){ -return 0; -} -var _65=(typeof (a)=="undefined"||a===null); -var _66=(typeof (b)=="undefined"||b===null); -if(_65&&_66){ -return 0; -}else{ -if(_65){ -return -1; -}else{ -if(_66){ -return 1; -} -} -} -var m=MochiKit.Base; -var _67=m._primitives; -if(!(typeof (a) in _67&&typeof (b) in _67)){ -try{ -return m.comparatorRegistry.match(a,b); -} -catch(e){ -if(e!=m.NotFound){ -throw e; -} -} -} -if(ab){ -return 1; -} -} -var _68=m.repr; -throw new TypeError(_68(a)+" and "+_68(b)+" can not be compared"); -},compareDateLike:function(a,b){ -return MochiKit.Base.compare(a.getTime(),b.getTime()); -},compareArrayLike:function(a,b){ -var _69=MochiKit.Base.compare; -var _70=a.length; -var _71=0; -if(_70>b.length){ -_71=1; -_70=b.length; -}else{ -if(_700))){ -var kv=MochiKit.DOM.formContents(_113); -_113=kv[0]; -_114=kv[1]; -}else{ -if(arguments.length==1){ -var o=_113; -_113=[]; -_114=[]; -for(var k in o){ -var v=o[k]; -if(typeof (v)!="function"){ -_113.push(k); -_114.push(v); -} -} -} -} -var rval=[]; -var len=Math.min(_113.length,_114.length); -var _118=MochiKit.Base.urlEncode; -for(var i=0;i=stop){ -throw self.StopIteration; -} -_147+=step; -return rval; -}}; -},imap:function(fun,p,q){ -var m=MochiKit.Base; -var self=MochiKit.Iter; -var _151=m.map(self.iter,m.extend(null,arguments,1)); -var map=m.map; -var next=self.next; -return {repr:function(){ -return "imap(...)"; -},toString:m.forwardCall("repr"),next:function(){ -return fun.apply(this,map(next,_151)); -}}; -},applymap:function(fun,seq,self){ -seq=MochiKit.Iter.iter(seq); -var m=MochiKit.Base; -return {repr:function(){ -return "applymap(...)"; -},toString:m.forwardCall("repr"),next:function(){ -return fun.apply(self,seq.next()); -}}; -},chain:function(p,q){ -var self=MochiKit.Iter; -var m=MochiKit.Base; -if(arguments.length==1){ -return self.iter(arguments[0]); -} -var _153=m.map(self.iter,arguments); -return {repr:function(){ -return "chain(...)"; -},toString:m.forwardCall("repr"),next:function(){ -while(_153.length>1){ -try{ -return _153[0].next(); -} -catch(e){ -if(e!=self.StopIteration){ -throw e; -} -_153.shift(); -} -} -if(_153.length==1){ -var arg=_153.shift(); -this.next=m.bind("next",arg); -return this.next(); -} -throw self.StopIteration; -}}; -},takewhile:function(pred,seq){ -var self=MochiKit.Iter; -seq=self.iter(seq); -return {repr:function(){ -return "takewhile(...)"; -},toString:MochiKit.Base.forwardCall("repr"),next:function(){ -var rval=seq.next(); -if(!pred(rval)){ -this.next=function(){ -throw self.StopIteration; -}; -this.next(); -} -return rval; -}}; -},dropwhile:function(pred,seq){ -seq=MochiKit.Iter.iter(seq); -var m=MochiKit.Base; -var bind=m.bind; -return {"repr":function(){ -return "dropwhile(...)"; -},"toString":m.forwardCall("repr"),"next":function(){ -while(true){ -var rval=seq.next(); -if(!pred(rval)){ -break; -} -} -this.next=bind("next",seq); -return rval; -}}; -},_tee:function(_155,sync,_157){ -sync.pos[_155]=-1; -var m=MochiKit.Base; -var _158=m.listMin; -return {repr:function(){ -return "tee("+_155+", ...)"; -},toString:m.forwardCall("repr"),next:function(){ -var rval; -var i=sync.pos[_155]; -if(i==sync.max){ -rval=_157.next(); -sync.deque.push(rval); -sync.max+=1; -sync.pos[_155]+=1; -}else{ -rval=sync.deque[i-sync.min]; -sync.pos[_155]+=1; -if(i==sync.min&&_158(sync.pos)!=sync.min){ -sync.min+=1; -sync.deque.shift(); -} -} -return rval; -}}; -},tee:function(_159,n){ -var rval=[]; -var sync={"pos":[],"deque":[],"max":-1,"min":-1}; -if(arguments.length==1){ -n=2; -} -var self=MochiKit.Iter; -_159=self.iter(_159); -var _tee=self._tee; -for(var i=0;i0&&_165>=stop)||(step<0&&_165<=stop)){ -throw MochiKit.Iter.StopIteration; -} -var rval=_165; -_165+=step; -return rval; -},repr:function(){ -return "range("+[_165,stop,step].join(", ")+")"; -},toString:MochiKit.Base.forwardCall("repr")}; -},sum:function(_166,_167){ -var x=_167||0; -var self=MochiKit.Iter; -_166=self.iter(_166); -try{ -while(true){ -x+=_166.next(); -} -} -catch(e){ -if(e!=self.StopIteration){ -throw e; -} -} -return x; -},exhaust:function(_168){ -var self=MochiKit.Iter; -_168=self.iter(_168); -try{ -while(true){ -_168.next(); -} -} -catch(e){ -if(e!=self.StopIteration){ -throw e; -} -} -},forEach:function(_169,func,self){ -var m=MochiKit.Base; -if(arguments.length>2){ -func=m.bind(func,self); -} -if(m.isArrayLike(_169)){ -try{ -for(var i=0;i<_169.length;i++){ -func(_169[i]); -} -} -catch(e){ -if(e!=MochiKit.Iter.StopIteration){ -throw e; -} -} -}else{ -self=MochiKit.Iter; -self.exhaust(self.imap(func,_169)); -} -},every:function(_171,func){ -var self=MochiKit.Iter; -try{ -self.ifilterfalse(func,_171).next(); -return false; -} -catch(e){ -if(e!=self.StopIteration){ -throw e; -} -return true; -} -},sorted:function(_172,cmp){ -var rval=MochiKit.Iter.list(_172); -if(arguments.length==1){ -cmp=MochiKit.Base.compare; -} -rval.sort(cmp); -return rval; -},reversed:function(_173){ -var rval=MochiKit.Iter.list(_173); -rval.reverse(); -return rval; -},some:function(_174,func){ -var self=MochiKit.Iter; -try{ -self.ifilter(func,_174).next(); -return true; -} -catch(e){ -if(e!=self.StopIteration){ -throw e; -} -return false; -} -},iextend:function(lst,_175){ -if(MochiKit.Base.isArrayLike(_175)){ -for(var i=0;i<_175.length;i++){ -lst.push(_175[i]); -} -}else{ -var self=MochiKit.Iter; -_175=self.iter(_175); -try{ -while(true){ -lst.push(_175.next()); -} -} -catch(e){ -if(e!=self.StopIteration){ -throw e; -} -} -} -return lst; -},groupby:function(_176,_177){ -var m=MochiKit.Base; -var self=MochiKit.Iter; -if(arguments.length<2){ -_177=m.operator.identity; -} -_176=self.iter(_176); -var pk=undefined; -var k=undefined; -var v; -function fetch(){ -v=_176.next(); -k=_177(v); -} -function eat(){ -var ret=v; -v=undefined; -return ret; -} -var _180=true; -return {repr:function(){ -return "groupby(...)"; -},next:function(){ -while(k==pk){ -fetch(); -if(_180){ -_180=false; -break; -} -} -pk=k; -return [k,{next:function(){ -if(v==undefined){ -fetch(); -} -if(k!=pk){ -throw self.StopIteration; -} -return eat(); -}}]; -}}; -},groupby_as_array:function(_181,_182){ -var m=MochiKit.Base; -var self=MochiKit.Iter; -if(arguments.length<2){ -_182=m.operator.identity; -} -_181=self.iter(_181); -var _183=[]; -var _184=true; -var _185; -while(true){ -try{ -var _186=_181.next(); -var key=_182(_186); -} -catch(e){ -if(e==self.StopIteration){ -break; -} -throw e; -} -if(_184||key!=_185){ -var _187=[]; -_183.push([key,_187]); -} -_187.push(_186); -_184=false; -_185=key; -} -return _183; -},arrayLikeIter:function(_188){ -var i=0; -return {repr:function(){ -return "arrayLikeIter(...)"; -},toString:MochiKit.Base.forwardCall("repr"),next:function(){ -if(i>=_188.length){ -throw MochiKit.Iter.StopIteration; -} -return _188[i++]; -}}; -},hasIterateNext:function(_189){ -return (_189&&typeof (_189.iterateNext)=="function"); -},iterateNextIter:function(_190){ -return {repr:function(){ -return "iterateNextIter(...)"; -},toString:MochiKit.Base.forwardCall("repr"),next:function(){ -var rval=_190.iterateNext(); -if(rval===null||rval===undefined){ -throw MochiKit.Iter.StopIteration; -} -return rval; -}}; -}}); -MochiKit.Iter.EXPORT_OK=["iteratorRegistry","arrayLikeIter","hasIterateNext","iterateNextIter",]; -MochiKit.Iter.EXPORT=["StopIteration","registerIteratorFactory","iter","count","cycle","repeat","next","izip","ifilter","ifilterfalse","islice","imap","applymap","chain","takewhile","dropwhile","tee","list","reduce","range","sum","exhaust","forEach","every","sorted","reversed","some","iextend","groupby","groupby_as_array"]; -MochiKit.Iter.__new__=function(){ -var m=MochiKit.Base; -this.StopIteration=new m.NamedError("StopIteration"); -this.iteratorRegistry=new m.AdapterRegistry(); -this.registerIteratorFactory("arrayLike",m.isArrayLike,this.arrayLikeIter); -this.registerIteratorFactory("iterateNext",this.hasIterateNext,this.iterateNextIter); -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -m.nameFunctions(this); -}; -MochiKit.Iter.__new__(); -if(!MochiKit.__compat__){ -reduce=MochiKit.Iter.reduce; -} -MochiKit.Base._exportSymbols(this,MochiKit.Iter); -if(typeof (dojo)!="undefined"){ -dojo.provide("MochiKit.Logging"); -dojo.require("MochiKit.Base"); -} -if(typeof (JSAN)!="undefined"){ -JSAN.use("MochiKit.Base",[]); -} -try{ -if(typeof (MochiKit.Base)=="undefined"){ -throw ""; -} -} -catch(e){ -throw "MochiKit.Logging depends on MochiKit.Base!"; -} -if(typeof (MochiKit.Logging)=="undefined"){ -MochiKit.Logging={}; -} -MochiKit.Logging.NAME="MochiKit.Logging"; -MochiKit.Logging.VERSION="1.3.1"; -MochiKit.Logging.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -MochiKit.Logging.toString=function(){ -return this.__repr__(); -}; -MochiKit.Logging.EXPORT=["LogLevel","LogMessage","Logger","alertListener","logger","log","logError","logDebug","logFatal","logWarning"]; -MochiKit.Logging.EXPORT_OK=["logLevelAtLeast","isLogMessage","compareLogMessage"]; -MochiKit.Logging.LogMessage=function(num,_192,info){ -this.num=num; -this.level=_192; -this.info=info; -this.timestamp=new Date(); -}; -MochiKit.Logging.LogMessage.prototype={repr:function(){ -var m=MochiKit.Base; -return "LogMessage("+m.map(m.repr,[this.num,this.level,this.info]).join(", ")+")"; -},toString:MochiKit.Base.forwardCall("repr")}; -MochiKit.Base.update(MochiKit.Logging,{logLevelAtLeast:function(_194){ -var self=MochiKit.Logging; -if(typeof (_194)=="string"){ -_194=self.LogLevel[_194]; -} -return function(msg){ -var _196=msg.level; -if(typeof (_196)=="string"){ -_196=self.LogLevel[_196]; -} -return _196>=_194; -}; -},isLogMessage:function(){ -var _197=MochiKit.Logging.LogMessage; -for(var i=0;i=0&&this._messages.length>this.maxSize){ -this._messages.shift(); -} -},getMessages:function(_206){ -var _207=0; -if(!(typeof (_206)=="undefined"||_206===null)){ -_207=Math.max(0,this._messages.length-_206); -} -return this._messages.slice(_207); -},getMessageText:function(_208){ -if(typeof (_208)=="undefined"||_208===null){ -_208=30; -} -var _209=this.getMessages(_208); -if(_209.length){ -var lst=map(function(m){ -return "\n ["+m.num+"] "+m.level+": "+m.info.join(" "); -},_209); -lst.unshift("LAST "+_209.length+" MESSAGES:"); -return lst.join(""); -} -return ""; -},debuggingBookmarklet:function(_210){ -if(typeof (MochiKit.LoggingPane)=="undefined"){ -alert(this.getMessageText()); -}else{ -MochiKit.LoggingPane.createLoggingPane(_210||false); -} -}}; -MochiKit.Logging.__new__=function(){ -this.LogLevel={ERROR:40,FATAL:50,WARNING:30,INFO:20,DEBUG:10}; -var m=MochiKit.Base; -m.registerComparator("LogMessage",this.isLogMessage,this.compareLogMessage); -var _211=m.partial; -var _212=this.Logger; -var _213=_212.prototype.baseLog; -m.update(this.Logger.prototype,{debug:_211(_213,"DEBUG"),log:_211(_213,"INFO"),error:_211(_213,"ERROR"),fatal:_211(_213,"FATAL"),warning:_211(_213,"WARNING")}); -var self=this; -var _214=function(name){ -return function(){ -self.logger[name].apply(self.logger,arguments); -}; -}; -this.log=_214("log"); -this.logError=_214("error"); -this.logDebug=_214("debug"); -this.logFatal=_214("fatal"); -this.logWarning=_214("warning"); -this.logger=new _212(); -this.logger.useNativeConsole=true; -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -m.nameFunctions(this); -}; -if(typeof (printfire)=="undefined"&&typeof (document)!="undefined"&&document.createEvent&&typeof (dispatchEvent)!="undefined"){ -printfire=function(){ -printfire.args=arguments; -var ev=document.createEvent("Events"); -ev.initEvent("printfire",false,true); -dispatchEvent(ev); -}; -} -MochiKit.Logging.__new__(); -MochiKit.Base._exportSymbols(this,MochiKit.Logging); -if(typeof (dojo)!="undefined"){ -dojo.provide("MochiKit.DateTime"); -} -if(typeof (MochiKit)=="undefined"){ -MochiKit={}; -} -if(typeof (MochiKit.DateTime)=="undefined"){ -MochiKit.DateTime={}; -} -MochiKit.DateTime.NAME="MochiKit.DateTime"; -MochiKit.DateTime.VERSION="1.3.1"; -MochiKit.DateTime.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -MochiKit.DateTime.toString=function(){ -return this.__repr__(); -}; -MochiKit.DateTime.isoDate=function(str){ -str=str+""; -if(typeof (str)!="string"||str.length===0){ -return null; -} -var iso=str.split("-"); -if(iso.length===0){ -return null; -} -return new Date(iso[0],iso[1]-1,iso[2]); -}; -MochiKit.DateTime._isoRegexp=/(\d{4,})(?:-(\d{1,2})(?:-(\d{1,2})(?:[T ](\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d+))?)?(?:(Z)|([+-])(\d{1,2})(?::(\d{1,2}))?)?)?)?)?/; -MochiKit.DateTime.isoTimestamp=function(str){ -str=str+""; -if(typeof (str)!="string"||str.length===0){ -return null; -} -var res=str.match(MochiKit.DateTime._isoRegexp); -if(typeof (res)=="undefined"||res===null){ -return null; -} -var year,month,day,hour,min,sec,msec; -year=parseInt(res[1],10); -if(typeof (res[2])=="undefined"||res[2]===""){ -return new Date(year); -} -month=parseInt(res[2],10)-1; -day=parseInt(res[3],10); -if(typeof (res[4])=="undefined"||res[4]===""){ -return new Date(year,month,day); -} -hour=parseInt(res[4],10); -min=parseInt(res[5],10); -sec=(typeof (res[6])!="undefined"&&res[6]!=="")?parseInt(res[6],10):0; -if(typeof (res[7])!="undefined"&&res[7]!==""){ -msec=Math.round(1000*parseFloat("0."+res[7])); -}else{ -msec=0; -} -if((typeof (res[8])=="undefined"||res[8]==="")&&(typeof (res[9])=="undefined"||res[9]==="")){ -return new Date(year,month,day,hour,min,sec,msec); -} -var ofs; -if(typeof (res[9])!="undefined"&&res[9]!==""){ -ofs=parseInt(res[10],10)*3600000; -if(typeof (res[11])!="undefined"&&res[11]!==""){ -ofs+=parseInt(res[11],10)*60000; -} -if(res[9]=="-"){ -ofs=-ofs; -} -}else{ -ofs=0; -} -return new Date(Date.UTC(year,month,day,hour,min,sec,msec)-ofs); -}; -MochiKit.DateTime.toISOTime=function(date,_221){ -if(typeof (date)=="undefined"||date===null){ -return null; -} -var hh=date.getHours(); -var mm=date.getMinutes(); -var ss=date.getSeconds(); -var lst=[((_221&&(hh<10))?"0"+hh:hh),((mm<10)?"0"+mm:mm),((ss<10)?"0"+ss:ss)]; -return lst.join(":"); -}; -MochiKit.DateTime.toISOTimestamp=function(date,_225){ -if(typeof (date)=="undefined"||date===null){ -return null; -} -var sep=_225?"T":" "; -var foot=_225?"Z":""; -if(_225){ -date=new Date(date.getTime()+(date.getTimezoneOffset()*60000)); -} -return MochiKit.DateTime.toISODate(date)+sep+MochiKit.DateTime.toISOTime(date,_225)+foot; -}; -MochiKit.DateTime.toISODate=function(date){ -if(typeof (date)=="undefined"||date===null){ -return null; -} -var _228=MochiKit.DateTime._padTwo; -return [date.getFullYear(),_228(date.getMonth()+1),_228(date.getDate())].join("-"); -}; -MochiKit.DateTime.americanDate=function(d){ -d=d+""; -if(typeof (d)!="string"||d.length===0){ -return null; -} -var a=d.split("/"); -return new Date(a[2],a[0]-1,a[1]); -}; -MochiKit.DateTime._padTwo=function(n){ -return (n>9)?n:"0"+n; -}; -MochiKit.DateTime.toPaddedAmericanDate=function(d){ -if(typeof (d)=="undefined"||d===null){ -return null; -} -var _230=MochiKit.DateTime._padTwo; -return [_230(d.getMonth()+1),_230(d.getDate()),d.getFullYear()].join("/"); -}; -MochiKit.DateTime.toAmericanDate=function(d){ -if(typeof (d)=="undefined"||d===null){ -return null; -} -return [d.getMonth()+1,d.getDate(),d.getFullYear()].join("/"); -}; -MochiKit.DateTime.EXPORT=["isoDate","isoTimestamp","toISOTime","toISOTimestamp","toISODate","americanDate","toPaddedAmericanDate","toAmericanDate"]; -MochiKit.DateTime.EXPORT_OK=[]; -MochiKit.DateTime.EXPORT_TAGS={":common":MochiKit.DateTime.EXPORT,":all":MochiKit.DateTime.EXPORT}; -MochiKit.DateTime.__new__=function(){ -var base=this.NAME+"."; -for(var k in this){ -var o=this[k]; -if(typeof (o)=="function"&&typeof (o.NAME)=="undefined"){ -try{ -o.NAME=base+k; -} -catch(e){ -} -} -} -}; -MochiKit.DateTime.__new__(); -if(typeof (MochiKit.Base)!="undefined"){ -MochiKit.Base._exportSymbols(this,MochiKit.DateTime); -}else{ -(function(_231,_232){ -if((typeof (JSAN)=="undefined"&&typeof (dojo)=="undefined")||(typeof (MochiKit.__compat__)=="boolean"&&MochiKit.__compat__)){ -var all=_232.EXPORT_TAGS[":all"]; -for(var i=0;i_240){ -var i=_246.length-_240; -res=fmt.separator+_246.substring(i,_246.length)+res; -_246=_246.substring(0,i); -} -} -res=_246+res; -if(_238>0){ -while(frac.length<_241){ -frac=frac+"0"; -} -res=res+fmt.decimal+frac; -} -return _242+res+_243; -}; -}; -MochiKit.Format.numberFormatter=function(_248,_249,_250){ -if(typeof (_249)=="undefined"){ -_249=""; -} -var _251=_248.match(/((?:[0#]+,)?[0#]+)(?:\.([0#]+))?(%)?/); -if(!_251){ -throw TypeError("Invalid pattern"); -} -var _252=_248.substr(0,_251.index); -var _253=_248.substr(_251.index+_251[0].length); -if(_252.search(/-/)==-1){ -_252=_252+"-"; -} -var _254=_251[1]; -var frac=(typeof (_251[2])=="string"&&_251[2]!="")?_251[2]:""; -var _255=(typeof (_251[3])=="string"&&_251[3]!=""); -var tmp=_254.split(/,/); -var _257; -if(typeof (_250)=="undefined"){ -_250="default"; -} -if(tmp.length==1){ -_257=null; -}else{ -_257=tmp[1].length; -} -var _258=_254.length-_254.replace(/0/g,"").length; -var _259=frac.length-frac.replace(/0/g,"").length; -var _260=frac.length; -var rval=MochiKit.Format._numberFormatter(_249,_252,_253,_250,_255,_260,_258,_257,_259); -var m=MochiKit.Base; -if(m){ -var fn=arguments.callee; -var args=m.concat(arguments); -rval.repr=function(){ -return [self.NAME,"(",map(m.repr,args).join(", "),")"].join(""); -}; -} -return rval; -}; -MochiKit.Format.formatLocale=function(_262){ -if(typeof (_262)=="undefined"||_262===null){ -_262="default"; -} -if(typeof (_262)=="string"){ -var rval=MochiKit.Format.LOCALE[_262]; -if(typeof (rval)=="string"){ -rval=arguments.callee(rval); -MochiKit.Format.LOCALE[_262]=rval; -} -return rval; -}else{ -return _262; -} -}; -MochiKit.Format.twoDigitAverage=function(_263,_264){ -if(_264){ -var res=_263/_264; -if(!isNaN(res)){ -return MochiKit.Format.twoDigitFloat(_263/_264); -} -} -return "0"; -}; -MochiKit.Format.twoDigitFloat=function(_265){ -var sign=(_265<0?"-":""); -var s=Math.floor(Math.abs(_265)*100).toString(); -if(s=="0"){ -return s; -} -if(s.length<3){ -while(s.charAt(s.length-1)=="0"){ -s=s.substring(0,s.length-1); -} -return sign+"0."+s; -} -var head=sign+s.substring(0,s.length-2); -var tail=s.substring(s.length-2,s.length); -if(tail=="00"){ -return head; -}else{ -if(tail.charAt(1)=="0"){ -return head+"."+tail.charAt(0); -}else{ -return head+"."+tail; -} -} -}; -MochiKit.Format.lstrip=function(str,_270){ -str=str+""; -if(typeof (str)!="string"){ -return null; -} -if(!_270){ -return str.replace(/^\s+/,""); -}else{ -return str.replace(new RegExp("^["+_270+"]+"),""); -} -}; -MochiKit.Format.rstrip=function(str,_271){ -str=str+""; -if(typeof (str)!="string"){ -return null; -} -if(!_271){ -return str.replace(/\s+$/,""); -}else{ -return str.replace(new RegExp("["+_271+"]+$"),""); -} -}; -MochiKit.Format.strip=function(str,_272){ -var self=MochiKit.Format; -return self.rstrip(self.lstrip(str,_272),_272); -}; -MochiKit.Format.truncToFixed=function(_273,_274){ -_273=Math.floor(_273*Math.pow(10,_274)); -var res=(_273*Math.pow(10,-_274)).toFixed(_274); -if(res.charAt(0)=="."){ -res="0"+res; -} -return res; -}; -MochiKit.Format.roundToFixed=function(_275,_276){ -return MochiKit.Format.truncToFixed(_275+0.5*Math.pow(10,-_276),_276); -}; -MochiKit.Format.percentFormat=function(_277){ -return MochiKit.Format.twoDigitFloat(100*_277)+"%"; -}; -MochiKit.Format.EXPORT=["truncToFixed","roundToFixed","numberFormatter","formatLocale","twoDigitAverage","twoDigitFloat","percentFormat","lstrip","rstrip","strip"]; -MochiKit.Format.LOCALE={en_US:{separator:",",decimal:".",percent:"%"},de_DE:{separator:".",decimal:",",percent:"%"},fr_FR:{separator:" ",decimal:",",percent:"%"},"default":"en_US"}; -MochiKit.Format.EXPORT_OK=[]; -MochiKit.Format.EXPORT_TAGS={":all":MochiKit.Format.EXPORT,":common":MochiKit.Format.EXPORT}; -MochiKit.Format.__new__=function(){ -var base=this.NAME+"."; -var k,v,o; -for(k in this.LOCALE){ -o=this.LOCALE[k]; -if(typeof (o)=="object"){ -o.repr=function(){ -return this.NAME; -}; -o.NAME=base+"LOCALE."+k; -} -} -for(k in this){ -o=this[k]; -if(typeof (o)=="function"&&typeof (o.NAME)=="undefined"){ -try{ -o.NAME=base+k; -} -catch(e){ -} -} -} -}; -MochiKit.Format.__new__(); -if(typeof (MochiKit.Base)!="undefined"){ -MochiKit.Base._exportSymbols(this,MochiKit.Format); -}else{ -(function(_278,_279){ -if((typeof (JSAN)=="undefined"&&typeof (dojo)=="undefined")||(typeof (MochiKit.__compat__)=="boolean"&&MochiKit.__compat__)){ -var all=_279.EXPORT_TAGS[":all"]; -for(var i=0;i=0)){ -this._fire(); -} -},_continue:function(res){ -this._resback(res); -this._unpause(); -},_resback:function(res){ -this.fired=((res instanceof Error)?1:0); -this.results[this.fired]=res; -this._fire(); -},_check:function(){ -if(this.fired!=-1){ -if(!this.silentlyCancelled){ -throw new MochiKit.Async.AlreadyCalledError(this); -} -this.silentlyCancelled=false; -return; -} -},callback:function(res){ -this._check(); -if(res instanceof MochiKit.Async.Deferred){ -throw new Error("Deferred instances can only be chained if they are the result of a callback"); -} -this._resback(res); -},errback:function(res){ -this._check(); -var self=MochiKit.Async; -if(res instanceof self.Deferred){ -throw new Error("Deferred instances can only be chained if they are the result of a callback"); -} -if(!(res instanceof Error)){ -res=new self.GenericError(res); -} -this._resback(res); -},addBoth:function(fn){ -if(arguments.length>1){ -fn=MochiKit.Base.partial.apply(null,arguments); -} -return this.addCallbacks(fn,fn); -},addCallback:function(fn){ -if(arguments.length>1){ -fn=MochiKit.Base.partial.apply(null,arguments); -} -return this.addCallbacks(fn,null); -},addErrback:function(fn){ -if(arguments.length>1){ -fn=MochiKit.Base.partial.apply(null,arguments); -} -return this.addCallbacks(null,fn); -},addCallbacks:function(cb,eb){ -if(this.chained){ -throw new Error("Chained Deferreds can not be re-used"); -} -this.chain.push([cb,eb]); -if(this.fired>=0){ -this._fire(); -} -return this; -},_fire:function(){ -var _284=this.chain; -var _285=this.fired; -var res=this.results[_285]; -var self=this; -var cb=null; -while(_284.length>0&&this.paused===0){ -var pair=_284.shift(); -var f=pair[_285]; -if(f===null){ -continue; -} -try{ -res=f(res); -_285=((res instanceof Error)?1:0); -if(res instanceof MochiKit.Async.Deferred){ -cb=function(res){ -self._continue(res); -}; -this._pause(); -} -} -catch(err){ -_285=1; -if(!(err instanceof Error)){ -err=new MochiKit.Async.GenericError(err); -} -res=err; -} -} -this.fired=_285; -this.results[_285]=res; -if(cb&&this.paused){ -res.addBoth(cb); -res.chained=true; -} -}}; -MochiKit.Base.update(MochiKit.Async,{evalJSONRequest:function(){ -return eval("("+arguments[0].responseText+")"); -},succeed:function(_287){ -var d=new MochiKit.Async.Deferred(); -d.callback.apply(d,arguments); -return d; -},fail:function(_288){ -var d=new MochiKit.Async.Deferred(); -d.errback.apply(d,arguments); -return d; -},getXMLHttpRequest:function(){ -var self=arguments.callee; -if(!self.XMLHttpRequest){ -var _289=[function(){ -return new XMLHttpRequest(); -},function(){ -return new ActiveXObject("Msxml2.XMLHTTP"); -},function(){ -return new ActiveXObject("Microsoft.XMLHTTP"); -},function(){ -return new ActiveXObject("Msxml2.XMLHTTP.4.0"); -},function(){ -throw new MochiKit.Async.BrowserComplianceError("Browser does not support XMLHttpRequest"); -}]; -for(var i=0;i<_289.length;i++){ -var func=_289[i]; -try{ -self.XMLHttpRequest=func; -return func(); -} -catch(e){ -} -} -} -return self.XMLHttpRequest(); -},_nothing:function(){ -},_xhr_onreadystatechange:function(d){ -if(this.readyState==4){ -try{ -this.onreadystatechange=null; -} -catch(e){ -try{ -this.onreadystatechange=MochiKit.Async._nothing; -} -catch(e){ -} -} -var _290=null; -try{ -_290=this.status; -if(!_290&&MochiKit.Base.isNotEmpty(this.responseText)){ -_290=304; -} -} -catch(e){ -} -if(_290==200||_290==304){ -d.callback(this); -}else{ -var err=new MochiKit.Async.XMLHttpRequestError(this,"Request failed"); -if(err.number){ -d.errback(err); -}else{ -d.errback(err); -} -} -} -},_xhr_canceller:function(req){ -try{ -req.onreadystatechange=null; -} -catch(e){ -try{ -req.onreadystatechange=MochiKit.Async._nothing; -} -catch(e){ -} -} -req.abort(); -},sendXMLHttpRequest:function(req,_293){ -if(typeof (_293)=="undefined"||_293===null){ -_293=""; -} -var m=MochiKit.Base; -var self=MochiKit.Async; -var d=new self.Deferred(m.partial(self._xhr_canceller,req)); -try{ -req.onreadystatechange=m.bind(self._xhr_onreadystatechange,req,d); -req.send(_293); -} -catch(e){ -try{ -req.onreadystatechange=null; -} -catch(ignore){ -} -d.errback(e); -} -return d; -},doSimpleXMLHttpRequest:function(url){ -var self=MochiKit.Async; -var req=self.getXMLHttpRequest(); -if(arguments.length>1){ -var m=MochiKit.Base; -var qs=m.queryString.apply(null,m.extend(null,arguments,1)); -if(qs){ -url+="?"+qs; -} -} -req.open("GET",url,true); -return self.sendXMLHttpRequest(req); -},loadJSONDoc:function(url){ -var self=MochiKit.Async; -var d=self.doSimpleXMLHttpRequest.apply(self,arguments); -d=d.addCallback(self.evalJSONRequest); -return d; -},wait:function(_296,_297){ -var d=new MochiKit.Async.Deferred(); -var m=MochiKit.Base; -if(typeof (_297)!="undefined"){ -d.addCallback(function(){ -return _297; -}); -} -var _298=setTimeout(m.bind("callback",d),Math.floor(_296*1000)); -d.canceller=function(){ -try{ -clearTimeout(_298); -} -catch(e){ -} -}; -return d; -},callLater:function(_299,func){ -var m=MochiKit.Base; -var _300=m.partial.apply(m,m.extend(null,arguments,1)); -return MochiKit.Async.wait(_299).addCallback(function(res){ -return _300(); -}); -}}); -MochiKit.Async.DeferredLock=function(){ -this.waiting=[]; -this.locked=false; -this.id=this._nextId(); -}; -MochiKit.Async.DeferredLock.prototype={__class__:MochiKit.Async.DeferredLock,acquire:function(){ -d=new MochiKit.Async.Deferred(); -if(this.locked){ -this.waiting.push(d); -}else{ -this.locked=true; -d.callback(this); -} -return d; -},release:function(){ -if(!this.locked){ -throw TypeError("Tried to release an unlocked DeferredLock"); -} -this.locked=false; -if(this.waiting.length>0){ -this.locked=true; -this.waiting.shift().callback(this); -} -},_nextId:MochiKit.Base.counter(),repr:function(){ -var _301; -if(this.locked){ -_301="locked, "+this.waiting.length+" waiting"; -}else{ -_301="unlocked"; -} -return "DeferredLock("+this.id+", "+_301+")"; -},toString:MochiKit.Base.forwardCall("repr")}; -MochiKit.Async.DeferredList=function(list,_303,_304,_305,_306){ -this.list=list; -this.resultList=new Array(this.list.length); -this.chain=[]; -this.id=this._nextId(); -this.fired=-1; -this.paused=0; -this.results=[null,null]; -this.canceller=_306; -this.silentlyCancelled=false; -if(this.list.length===0&&!_303){ -this.callback(this.resultList); -} -this.finishedCount=0; -this.fireOnOneCallback=_303; -this.fireOnOneErrback=_304; -this.consumeErrors=_305; -var _307=0; -MochiKit.Base.map(MochiKit.Base.bind(function(d){ -d.addCallback(MochiKit.Base.bind(this._cbDeferred,this),_307,true); -d.addErrback(MochiKit.Base.bind(this._cbDeferred,this),_307,false); -_307+=1; -},this),this.list); -}; -MochiKit.Base.update(MochiKit.Async.DeferredList.prototype,MochiKit.Async.Deferred.prototype); -MochiKit.Base.update(MochiKit.Async.DeferredList.prototype,{_cbDeferred:function(_308,_309,_310){ -this.resultList[_308]=[_309,_310]; -this.finishedCount+=1; -if(this.fired!==0){ -if(_309&&this.fireOnOneCallback){ -this.callback([_308,_310]); -}else{ -if(!_309&&this.fireOnOneErrback){ -this.errback(_310); -}else{ -if(this.finishedCount==this.list.length){ -this.callback(this.resultList); -} -} -} -} -if(!_309&&this.consumeErrors){ -_310=null; -} -return _310; -}}); -MochiKit.Async.gatherResults=function(_311){ -var d=new MochiKit.Async.DeferredList(_311,false,true,false); -d.addCallback(function(_312){ -var ret=[]; -for(var i=0;i<_312.length;i++){ -ret.push(_312[i][1]); -} -return ret; -}); -return d; -}; -MochiKit.Async.maybeDeferred=function(func){ -var self=MochiKit.Async; -var _313; -try{ -var r=func.apply(null,MochiKit.Base.extend([],arguments,1)); -if(r instanceof self.Deferred){ -_313=r; -}else{ -if(r instanceof Error){ -_313=self.fail(r); -}else{ -_313=self.succeed(r); -} -} -} -catch(e){ -_313=self.fail(e); -} -return _313; -}; -MochiKit.Async.EXPORT=["AlreadyCalledError","CancelledError","BrowserComplianceError","GenericError","XMLHttpRequestError","Deferred","succeed","fail","getXMLHttpRequest","doSimpleXMLHttpRequest","loadJSONDoc","wait","callLater","sendXMLHttpRequest","DeferredLock","DeferredList","gatherResults","maybeDeferred"]; -MochiKit.Async.EXPORT_OK=["evalJSONRequest"]; -MochiKit.Async.__new__=function(){ -var m=MochiKit.Base; -var ne=m.partial(m._newNamedError,this); -ne("AlreadyCalledError",function(_316){ -this.deferred=_316; -}); -ne("CancelledError",function(_317){ -this.deferred=_317; -}); -ne("BrowserComplianceError",function(msg){ -this.message=msg; -}); -ne("GenericError",function(msg){ -this.message=msg; -}); -ne("XMLHttpRequestError",function(req,msg){ -this.req=req; -this.message=msg; -try{ -this.number=req.status; -} -catch(e){ -} -}); -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -m.nameFunctions(this); -}; -MochiKit.Async.__new__(); -MochiKit.Base._exportSymbols(this,MochiKit.Async); -if(typeof (dojo)!="undefined"){ -dojo.provide("MochiKit.DOM"); -dojo.require("MochiKit.Iter"); -} -if(typeof (JSAN)!="undefined"){ -JSAN.use("MochiKit.Iter",[]); -} -try{ -if(typeof (MochiKit.Iter)=="undefined"){ -throw ""; -} -} -catch(e){ -throw "MochiKit.DOM depends on MochiKit.Iter!"; -} -if(typeof (MochiKit.DOM)=="undefined"){ -MochiKit.DOM={}; -} -MochiKit.DOM.NAME="MochiKit.DOM"; -MochiKit.DOM.VERSION="1.3.1"; -MochiKit.DOM.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -MochiKit.DOM.toString=function(){ -return this.__repr__(); -}; -MochiKit.DOM.EXPORT=["formContents","currentWindow","currentDocument","withWindow","withDocument","registerDOMConverter","coerceToDOM","createDOM","createDOMFunc","getNodeAttribute","setNodeAttribute","updateNodeAttributes","appendChildNodes","replaceChildNodes","removeElement","swapDOM","BUTTON","TT","PRE","H1","H2","H3","BR","CANVAS","HR","LABEL","TEXTAREA","FORM","STRONG","SELECT","OPTION","OPTGROUP","LEGEND","FIELDSET","P","UL","OL","LI","TD","TR","THEAD","TBODY","TFOOT","TABLE","TH","INPUT","SPAN","A","DIV","IMG","getElement","$","computedStyle","getElementsByTagAndClassName","addToCallStack","addLoadEvent","focusOnLoad","setElementClass","toggleElementClass","addElementClass","removeElementClass","swapElementClass","hasElementClass","escapeHTML","toHTML","emitHTML","setDisplayForElement","hideElement","showElement","scrapeText","elementDimensions","elementPosition","setElementDimensions","setElementPosition","getViewportDimensions","setOpacity"]; -MochiKit.DOM.EXPORT_OK=["domConverters"]; -MochiKit.DOM.Dimensions=function(w,h){ -this.w=w; -this.h=h; -}; -MochiKit.DOM.Dimensions.prototype.repr=function(){ -var repr=MochiKit.Base.repr; -return "{w: "+repr(this.w)+", h: "+repr(this.h)+"}"; -}; -MochiKit.DOM.Coordinates=function(x,y){ -this.x=x; -this.y=y; -}; -MochiKit.DOM.Coordinates.prototype.repr=function(){ -var repr=MochiKit.Base.repr; -return "{x: "+repr(this.x)+", y: "+repr(this.y)+"}"; -}; -MochiKit.DOM.Coordinates.prototype.toString=function(){ -return this.repr(); -}; -MochiKit.Base.update(MochiKit.DOM,{setOpacity:function(elem,o){ -elem=MochiKit.DOM.getElement(elem); -MochiKit.DOM.updateNodeAttributes(elem,{"style":{"opacity":o,"-moz-opacity":o,"-khtml-opacity":o,"filter":" alpha(opacity="+(o*100)+")"}}); -},getViewportDimensions:function(){ -var d=new MochiKit.DOM.Dimensions(); -var w=MochiKit.DOM._window; -var b=MochiKit.DOM._document.body; -if(w.innerWidth){ -d.w=w.innerWidth; -d.h=w.innerHeight; -}else{ -if(b.parentElement.clientWidth){ -d.w=b.parentElement.clientWidth; -d.h=b.parentElement.clientHeight; -}else{ -if(b&&b.clientWidth){ -d.w=b.clientWidth; -d.h=b.clientHeight; -} -} -} -return d; -},elementDimensions:function(elem){ -var self=MochiKit.DOM; -if(typeof (elem.w)=="number"||typeof (elem.h)=="number"){ -return new self.Dimensions(elem.w||0,elem.h||0); -} -elem=self.getElement(elem); -if(!elem){ -return undefined; -} -if(self.computedStyle(elem,"display")!="none"){ -return new self.Dimensions(elem.offsetWidth||0,elem.offsetHeight||0); -} -var s=elem.style; -var _322=s.visibility; -var _323=s.position; -s.visibility="hidden"; -s.position="absolute"; -s.display=""; -var _324=elem.offsetWidth; -var _325=elem.offsetHeight; -s.display="none"; -s.position=_323; -s.visibility=_322; -return new self.Dimensions(_324,_325); -},elementPosition:function(elem,_326){ -var self=MochiKit.DOM; -elem=self.getElement(elem); -if(!elem){ -return undefined; -} -var c=new self.Coordinates(0,0); -if(elem.x&&elem.y){ -c.x+=elem.x||0; -c.y+=elem.y||0; -return c; -}else{ -if(elem.parentNode===null||self.computedStyle(elem,"display")=="none"){ -return undefined; -} -} -var box=null; -var _329=null; -var d=MochiKit.DOM._document; -var de=d.documentElement; -var b=d.body; -if(elem.getBoundingClientRect){ -box=elem.getBoundingClientRect(); -c.x+=box.left+(de.scrollLeft||b.scrollLeft)-(de.clientLeft||b.clientLeft); -c.y+=box.top+(de.scrollTop||b.scrollTop)-(de.clientTop||b.clientTop); -}else{ -if(d.getBoxObjectFor){ -box=d.getBoxObjectFor(elem); -c.x+=box.x; -c.y+=box.y; -}else{ -if(elem.offsetParent){ -c.x+=elem.offsetLeft; -c.y+=elem.offsetTop; -_329=elem.offsetParent; -if(_329!=elem){ -while(_329){ -c.x+=_329.offsetLeft; -c.y+=_329.offsetTop; -_329=_329.offsetParent; -} -} -var ua=navigator.userAgent.toLowerCase(); -if((typeof (opera)!="undefined"&&parseFloat(opera.version())<9)||(ua.indexOf("safari")!=-1&&self.computedStyle(elem,"position")=="absolute")){ -c.x-=b.offsetLeft; -c.y-=b.offsetTop; -} -} -} -} -if(typeof (_326)!="undefined"){ -_326=arguments.callee(_326); -if(_326){ -c.x-=(_326.x||0); -c.y-=(_326.y||0); -} -} -if(elem.parentNode){ -_329=elem.parentNode; -}else{ -_329=null; -} -while(_329&&_329.tagName!="BODY"&&_329.tagName!="HTML"){ -c.x-=_329.scrollLeft; -c.y-=_329.scrollTop; -if(_329.parentNode){ -_329=_329.parentNode; -}else{ -_329=null; -} -} -return c; -},setElementDimensions:function(elem,_332,_333){ -elem=MochiKit.DOM.getElement(elem); -if(typeof (_333)=="undefined"){ -_333="px"; -} -MochiKit.DOM.updateNodeAttributes(elem,{"style":{"width":_332.w+_333,"height":_332.h+_333}}); -},setElementPosition:function(elem,_334,_335){ -elem=MochiKit.DOM.getElement(elem); -if(typeof (_335)=="undefined"){ -_335="px"; -} -MochiKit.DOM.updateNodeAttributes(elem,{"style":{"left":_334.x+_335,"top":_334.y+_335}}); -},currentWindow:function(){ -return MochiKit.DOM._window; -},currentDocument:function(){ -return MochiKit.DOM._document; -},withWindow:function(win,func){ -var self=MochiKit.DOM; -var _337=self._document; -var _338=self._win; -var rval; -try{ -self._window=win; -self._document=win.document; -rval=func(); -} -catch(e){ -self._window=_338; -self._document=_337; -throw e; -} -self._window=_338; -self._document=_337; -return rval; -},formContents:function(elem){ -var _339=[]; -var _340=[]; -var m=MochiKit.Base; -var self=MochiKit.DOM; -if(typeof (elem)=="undefined"||elem===null){ -elem=self._document; -}else{ -elem=self.getElement(elem); -} -m.nodeWalk(elem,function(elem){ -var name=elem.name; -if(m.isNotEmpty(name)){ -var _341=elem.nodeName; -if(_341=="INPUT"&&(elem.type=="radio"||elem.type=="checkbox")&&!elem.checked){ -return null; -} -if(_341=="SELECT"){ -if(elem.selectedIndex>=0){ -var opt=elem.options[elem.selectedIndex]; -_339.push(name); -_340.push((opt.value)?opt.value:opt.text); -return null; -} -_339.push(name); -_340.push(""); -return null; -} -if(_341=="FORM"||_341=="P"||_341=="SPAN"||_341=="DIV"){ -return elem.childNodes; -} -_339.push(name); -_340.push(elem.value||""); -return null; -} -return elem.childNodes; -}); -return [_339,_340]; -},withDocument:function(doc,func){ -var self=MochiKit.DOM; -var _344=self._document; -var rval; -try{ -self._document=doc; -rval=func(); -} -catch(e){ -self._document=_344; -throw e; -} -self._document=_344; -return rval; -},registerDOMConverter:function(name,_345,wrap,_346){ -MochiKit.DOM.domConverters.register(name,_345,wrap,_346); -},coerceToDOM:function(node,ctx){ -var im=MochiKit.Iter; -var self=MochiKit.DOM; -var iter=im.iter; -var _350=im.repeat; -var imap=im.imap; -var _352=self.domConverters; -var _353=self.coerceToDOM; -var _354=MochiKit.Base.NotFound; -while(true){ -if(typeof (node)=="undefined"||node===null){ -return null; -} -if(typeof (node.nodeType)!="undefined"&&node.nodeType>0){ -return node; -} -if(typeof (node)=="number"||typeof (node)=="boolean"){ -node=node.toString(); -} -if(typeof (node)=="string"){ -return self._document.createTextNode(node); -} -if(typeof (node.toDOM)=="function"){ -node=node.toDOM(ctx); -continue; -} -if(typeof (node)=="function"){ -node=node(ctx); -continue; -} -var _355=null; -try{ -_355=iter(node); -} -catch(e){ -} -if(_355){ -return imap(_353,_355,_350(ctx)); -} -try{ -node=_352.match(node,ctx); -continue; -} -catch(e){ -if(e!=_354){ -throw e; -} -} -return self._document.createTextNode(node.toString()); -} -return undefined; -},setNodeAttribute:function(node,attr,_357){ -var o={}; -o[attr]=_357; -try{ -return MochiKit.DOM.updateNodeAttributes(node,o); -} -catch(e){ -} -return null; -},getNodeAttribute:function(node,attr){ -var self=MochiKit.DOM; -var _358=self.attributeArray.renames[attr]; -node=self.getElement(node); -try{ -if(_358){ -return node[_358]; -} -return node.getAttribute(attr); -} -catch(e){ -} -return null; -},updateNodeAttributes:function(node,_359){ -var elem=node; -var self=MochiKit.DOM; -if(typeof (node)=="string"){ -elem=self.getElement(node); -} -if(_359){ -var _360=MochiKit.Base.updatetree; -if(self.attributeArray.compliant){ -for(var k in _359){ -var v=_359[k]; -if(typeof (v)=="object"&&typeof (elem[k])=="object"){ -_360(elem[k],v); -}else{ -if(k.substring(0,2)=="on"){ -if(typeof (v)=="string"){ -v=new Function(v); -} -elem[k]=v; -}else{ -elem.setAttribute(k,v); -} -} -} -}else{ -var _361=self.attributeArray.renames; -for(k in _359){ -v=_359[k]; -var _362=_361[k]; -if(k=="style"&&typeof (v)=="string"){ -elem.style.cssText=v; -}else{ -if(typeof (_362)=="string"){ -elem[_362]=v; -}else{ -if(typeof (elem[k])=="object"&&typeof (v)=="object"){ -_360(elem[k],v); -}else{ -if(k.substring(0,2)=="on"){ -if(typeof (v)=="string"){ -v=new Function(v); -} -elem[k]=v; -}else{ -elem.setAttribute(k,v); -} -} -} -} -} -} -} -return elem; -},appendChildNodes:function(node){ -var elem=node; -var self=MochiKit.DOM; -if(typeof (node)=="string"){ -elem=self.getElement(node); -} -var _363=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; -var _364=MochiKit.Base.concat; -while(_363.length){ -var n=_363.shift(); -if(typeof (n)=="undefined"||n===null){ -}else{ -if(typeof (n.nodeType)=="number"){ -elem.appendChild(n); -}else{ -_363=_364(n,_363); -} -} -} -return elem; -},replaceChildNodes:function(node){ -var elem=node; -var self=MochiKit.DOM; -if(typeof (node)=="string"){ -elem=self.getElement(node); -arguments[0]=elem; -} -var _365; -while((_365=elem.firstChild)){ -elem.removeChild(_365); -} -if(arguments.length<2){ -return elem; -}else{ -return self.appendChildNodes.apply(this,arguments); -} -},createDOM:function(name,_366){ -var elem; -var self=MochiKit.DOM; -var m=MochiKit.Base; -if(typeof (_366)=="string"||typeof (_366)=="number"){ -var args=m.extend([name,null],arguments,1); -return arguments.callee.apply(this,args); -} -if(typeof (name)=="string"){ -if(_366&&"name" in _366&&!self.attributeArray.compliant){ -name=("<"+name+" name=\""+self.escapeHTML(_366.name)+"\">"); -} -elem=self._document.createElement(name); -}else{ -elem=name; -} -if(_366){ -self.updateNodeAttributes(elem,_366); -} -if(arguments.length<=2){ -return elem; -}else{ -var args=m.extend([elem],arguments,2); -return self.appendChildNodes.apply(this,args); -} -},createDOMFunc:function(){ -var m=MochiKit.Base; -return m.partial.apply(this,m.extend([MochiKit.DOM.createDOM],arguments)); -},swapDOM:function(dest,src){ -var self=MochiKit.DOM; -dest=self.getElement(dest); -var _369=dest.parentNode; -if(src){ -src=self.getElement(src); -_369.replaceChild(src,dest); -}else{ -_369.removeChild(dest); -} -return src; -},getElement:function(id){ -var self=MochiKit.DOM; -if(arguments.length==1){ -return ((typeof (id)=="string")?self._document.getElementById(id):id); -}else{ -return MochiKit.Base.map(self.getElement,arguments); -} -},computedStyle:function(_371,_372,_373){ -if(arguments.length==2){ -_373=_372; -} -var self=MochiKit.DOM; -var el=self.getElement(_371); -var _375=self._document; -if(!el||el==_375){ -return undefined; -} -if(el.currentStyle){ -return el.currentStyle[_372]; -} -if(typeof (_375.defaultView)=="undefined"){ -return undefined; -} -if(_375.defaultView===null){ -return undefined; -} -var _376=_375.defaultView.getComputedStyle(el,null); -if(typeof (_376)=="undefined"||_376===null){ -return undefined; -} -return _376.getPropertyValue(_373); -},getElementsByTagAndClassName:function(_377,_378,_379){ -var self=MochiKit.DOM; -if(typeof (_377)=="undefined"||_377===null){ -_377="*"; -} -if(typeof (_379)=="undefined"||_379===null){ -_379=self._document; -} -_379=self.getElement(_379); -var _380=(_379.getElementsByTagName(_377)||self._document.all); -if(typeof (_378)=="undefined"||_378===null){ -return MochiKit.Base.extend(null,_380); -} -var _381=[]; -for(var i=0;i<_380.length;i++){ -var _382=_380[i]; -var _383=_382.className.split(" "); -for(var j=0;j<_383.length;j++){ -if(_383[j]==_378){ -_381.push(_382); -break; -} -} -} -return _381; -},_newCallStack:function(path,once){ -var rval=function(){ -var _386=arguments.callee.callStack; -for(var i=0;i<_386.length;i++){ -if(_386[i].apply(this,arguments)===false){ -break; -} -} -if(once){ -try{ -this[path]=null; -} -catch(e){ -} -} -}; -rval.callStack=[]; -return rval; -},addToCallStack:function(_387,path,func,once){ -var self=MochiKit.DOM; -var _388=_387[path]; -var _389=_388; -if(!(typeof (_388)=="function"&&typeof (_388.callStack)=="object"&&_388.callStack!==null)){ -_389=self._newCallStack(path,once); -if(typeof (_388)=="function"){ -_389.callStack.push(_388); -} -_387[path]=_389; -} -_389.callStack.push(func); -},addLoadEvent:function(func){ -var self=MochiKit.DOM; -self.addToCallStack(self._window,"onload",func,true); -},focusOnLoad:function(_390){ -var self=MochiKit.DOM; -self.addLoadEvent(function(){ -_390=self.getElement(_390); -if(_390){ -_390.focus(); -} -}); -},setElementClass:function(_391,_392){ -var self=MochiKit.DOM; -var obj=self.getElement(_391); -if(self.attributeArray.compliant){ -obj.setAttribute("class",_392); -}else{ -obj.setAttribute("className",_392); -} -},toggleElementClass:function(_393){ -var self=MochiKit.DOM; -for(var i=1;i/g,">"); -},toHTML:function(dom){ -return MochiKit.DOM.emitHTML(dom).join(""); -},emitHTML:function(dom,lst){ -if(typeof (lst)=="undefined"||lst===null){ -lst=[]; -} -var _409=[dom]; -var self=MochiKit.DOM; -var _410=self.escapeHTML; -var _411=self.attributeArray; -while(_409.length){ -dom=_409.pop(); -if(typeof (dom)=="string"){ -lst.push(dom); -}else{ -if(dom.nodeType==1){ -lst.push("<"+dom.nodeName.toLowerCase()); -var _412=[]; -var _413=_411(dom); -for(var i=0;i<_413.length;i++){ -var a=_413[i]; -_412.push([" ",a.name,"=\"",_410(a.value),"\""]); -} -_412.sort(); -for(i=0;i<_412.length;i++){ -var _414=_412[i]; -for(var j=0;j<_414.length;j++){ -lst.push(_414[j]); -} -} -if(dom.hasChildNodes()){ -lst.push(">"); -_409.push(""); -var _415=dom.childNodes; -for(i=_415.length-1;i>=0;i--){ -_409.push(_415[i]); -} -}else{ -lst.push("/>"); -} -}else{ -if(dom.nodeType==3){ -lst.push(_410(dom.nodeValue)); -} -} -} -} -return lst; -},setDisplayForElement:function(_416,_417){ -var m=MochiKit.Base; -var _418=m.extend(null,arguments,1); -MochiKit.Iter.forEach(m.filter(null,m.map(MochiKit.DOM.getElement,_418)),function(_417){ -_417.style.display=_416; -}); -},scrapeText:function(node,_419){ -var rval=[]; -(function(node){ -var cn=node.childNodes; -if(cn){ -for(var i=0;i0){ -var _424=m.filter; -_423=function(node){ -return _424(_423.ignoreAttrFilter,node.attributes); -}; -_423.ignoreAttr={}; -MochiKit.Iter.forEach(_422.attributes,function(a){ -_423.ignoreAttr[a.name]=a.value; -}); -_423.ignoreAttrFilter=function(a){ -return (_423.ignoreAttr[a.name]!=a.value); -}; -_423.compliant=false; -_423.renames={"class":"className","checked":"defaultChecked","usemap":"useMap","for":"htmlFor"}; -}else{ -_423=function(node){ -return node.attributes; -}; -_423.compliant=true; -_423.renames={}; -} -this.attributeArray=_423; -var _425=this.createDOMFunc; -this.UL=_425("ul"); -this.OL=_425("ol"); -this.LI=_425("li"); -this.TD=_425("td"); -this.TR=_425("tr"); -this.TBODY=_425("tbody"); -this.THEAD=_425("thead"); -this.TFOOT=_425("tfoot"); -this.TABLE=_425("table"); -this.TH=_425("th"); -this.INPUT=_425("input"); -this.SPAN=_425("span"); -this.A=_425("a"); -this.DIV=_425("div"); -this.IMG=_425("img"); -this.BUTTON=_425("button"); -this.TT=_425("tt"); -this.PRE=_425("pre"); -this.H1=_425("h1"); -this.H2=_425("h2"); -this.H3=_425("h3"); -this.BR=_425("br"); -this.HR=_425("hr"); -this.LABEL=_425("label"); -this.TEXTAREA=_425("textarea"); -this.FORM=_425("form"); -this.P=_425("p"); -this.SELECT=_425("select"); -this.OPTION=_425("option"); -this.OPTGROUP=_425("optgroup"); -this.LEGEND=_425("legend"); -this.FIELDSET=_425("fieldset"); -this.STRONG=_425("strong"); -this.CANVAS=_425("canvas"); -this.hideElement=m.partial(this.setDisplayForElement,"none"); -this.showElement=m.partial(this.setDisplayForElement,"block"); -this.removeElement=this.swapDOM; -this.$=this.getElement; -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -m.nameFunctions(this); -}}); -MochiKit.DOM.__new__(((typeof (window)=="undefined")?this:window)); -if(!MochiKit.__compat__){ -withWindow=MochiKit.DOM.withWindow; -withDocument=MochiKit.DOM.withDocument; -} -MochiKit.Base._exportSymbols(this,MochiKit.DOM); -if(typeof (dojo)!="undefined"){ -dojo.provide("MochiKit.LoggingPane"); -dojo.require("MochiKit.Logging"); -dojo.require("MochiKit.Base"); -} -if(typeof (JSAN)!="undefined"){ -JSAN.use("MochiKit.Logging",[]); -JSAN.use("MochiKit.Base",[]); -} -try{ -if(typeof (MochiKit.Base)=="undefined"||typeof (MochiKit.Logging)=="undefined"){ -throw ""; -} -} -catch(e){ -throw "MochiKit.LoggingPane depends on MochiKit.Base and MochiKit.Logging!"; -} -if(typeof (MochiKit.LoggingPane)=="undefined"){ -MochiKit.LoggingPane={}; -} -MochiKit.LoggingPane.NAME="MochiKit.LoggingPane"; -MochiKit.LoggingPane.VERSION="1.3.1"; -MochiKit.LoggingPane.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -MochiKit.LoggingPane.toString=function(){ -return this.__repr__(); -}; -MochiKit.LoggingPane.createLoggingPane=function(_426){ -var m=MochiKit.LoggingPane; -_426=!(!_426); -if(m._loggingPane&&m._loggingPane.inline!=_426){ -m._loggingPane.closePane(); -m._loggingPane=null; -} -if(!m._loggingPane||m._loggingPane.closed){ -m._loggingPane=new m.LoggingPane(_426,MochiKit.Logging.logger); -} -return m._loggingPane; -}; -MochiKit.LoggingPane.LoggingPane=function(_427,_428){ -if(typeof (_428)=="undefined"||_428===null){ -_428=MochiKit.Logging.logger; -} -this.logger=_428; -var _429=MochiKit.Base.update; -var _430=MochiKit.Base.updatetree; -var bind=MochiKit.Base.bind; -var _431=MochiKit.Base.clone; -var win=window; -var uid="_MochiKit_LoggingPane"; -if(typeof (MochiKit.DOM)!="undefined"){ -win=MochiKit.DOM.currentWindow(); -} -if(!_427){ -var url=win.location.href.split("?")[0].replace(/[:\/.><&]/g,"_"); -var name=uid+"_"+url; -var nwin=win.open("",name,"dependent,resizable,height=200"); -if(!nwin){ -alert("Not able to open debugging window due to pop-up blocking."); -return undefined; -} -nwin.document.write(""+"[MochiKit.LoggingPane]"+""); -nwin.document.close(); -nwin.document.title+=" "+win.document.title; -win=nwin; -} -var doc=win.document; -this.doc=doc; -var _434=doc.getElementById(uid); -var _435=!!_434; -if(_434&&typeof (_434.loggingPane)!="undefined"){ -_434.loggingPane.logger=this.logger; -_434.loggingPane.buildAndApplyFilter(); -return _434.loggingPane; -} -if(_435){ -var _436; -while((_436=_434.firstChild)){ -_434.removeChild(_436); -} -}else{ -_434=doc.createElement("div"); -_434.id=uid; -} -_434.loggingPane=this; -var _437=doc.createElement("input"); -var _438=doc.createElement("input"); -var _439=doc.createElement("button"); -var _440=doc.createElement("button"); -var _441=doc.createElement("button"); -var _442=doc.createElement("button"); -var _443=doc.createElement("div"); -var _444=doc.createElement("div"); -var _445=uid+"_Listener"; -this.colorTable=_431(this.colorTable); -var _446=[]; -var _447=null; -var _448=function(msg){ -var _449=msg.level; -if(typeof (_449)=="number"){ -_449=MochiKit.Logging.LogLevel[_449]; -} -return _449; -}; -var _450=function(msg){ -return msg.info.join(" "); -}; -var _451=bind(function(msg){ -var _452=_448(msg); -var text=_450(msg); -var c=this.colorTable[_452]; -var p=doc.createElement("span"); -p.className="MochiKit-LogMessage MochiKit-LogLevel-"+_452; -p.style.cssText="margin: 0px; white-space: -moz-pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; white-space: pre-line; word-wrap: break-word; wrap-option: emergency; color: "+c; -p.appendChild(doc.createTextNode(_452+": "+text)); -_444.appendChild(p); -_444.appendChild(doc.createElement("br")); -if(_443.offsetHeight>_443.scrollHeight){ -_443.scrollTop=0; -}else{ -_443.scrollTop=_443.scrollHeight; -} -},this); -var _454=function(msg){ -_446[_446.length]=msg; -_451(msg); -}; -var _455=function(){ -var _456,infore; -try{ -_456=new RegExp(_437.value); -infore=new RegExp(_438.value); -} -catch(e){ -logDebug("Error in filter regex: "+e.message); -return null; -} -return function(msg){ -return (_456.test(_448(msg))&&infore.test(_450(msg))); -}; -}; -var _457=function(){ -while(_444.firstChild){ -_444.removeChild(_444.firstChild); -} -}; -var _458=function(){ -_446=[]; -_457(); -}; -var _459=bind(function(){ -if(this.closed){ -return; -} -this.closed=true; -if(MochiKit.LoggingPane._loggingPane==this){ -MochiKit.LoggingPane._loggingPane=null; -} -this.logger.removeListener(_445); -_434.loggingPane=null; -if(_427){ -_434.parentNode.removeChild(_434); -}else{ -this.win.close(); -} -},this); -var _460=function(){ -_457(); -for(var i=0;i<_446.length;i++){ -var msg=_446[i]; -if(_447===null||_447(msg)){ -_451(msg); -} -} -}; -this.buildAndApplyFilter=function(){ -_447=_455(); -_460(); -this.logger.removeListener(_445); -this.logger.addListener(_445,_447,_454); -}; -var _461=bind(function(){ -_446=this.logger.getMessages(); -_460(); -},this); -var _462=bind(function(_463){ -_463=_463||window.event; -key=_463.which||_463.keyCode; -if(key==13){ -this.buildAndApplyFilter(); -} -},this); -var _464="display: block; z-index: 1000; left: 0px; bottom: 0px; position: fixed; width: 100%; background-color: white; font: "+this.logFont; -if(_427){ -_464+="; height: 10em; border-top: 2px solid black"; -}else{ -_464+="; height: 100%;"; -} -_434.style.cssText=_464; -if(!_435){ -doc.body.appendChild(_434); -} -_464={"cssText":"width: 33%; display: inline; font: "+this.logFont}; -_430(_437,{"value":"FATAL|ERROR|WARNING|INFO|DEBUG","onkeypress":_462,"style":_464}); -_434.appendChild(_437); -_430(_438,{"value":".*","onkeypress":_462,"style":_464}); -_434.appendChild(_438); -_464="width: 8%; display:inline; font: "+this.logFont; -_439.appendChild(doc.createTextNode("Filter")); -_439.onclick=bind("buildAndApplyFilter",this); -_439.style.cssText=_464; -_434.appendChild(_439); -_440.appendChild(doc.createTextNode("Load")); -_440.onclick=_461; -_440.style.cssText=_464; -_434.appendChild(_440); -_441.appendChild(doc.createTextNode("Clear")); -_441.onclick=_458; -_441.style.cssText=_464; -_434.appendChild(_441); -_442.appendChild(doc.createTextNode("Close")); -_442.onclick=_459; -_442.style.cssText=_464; -_434.appendChild(_442); -_443.style.cssText="overflow: auto; width: 100%"; -_444.style.cssText="width: 100%; height: "+(_427?"8em":"100%"); -_443.appendChild(_444); -_434.appendChild(_443); -this.buildAndApplyFilter(); -_461(); -if(_427){ -this.win=undefined; -}else{ -this.win=win; -} -this.inline=_427; -this.closePane=_459; -this.closed=false; -return this; -}; -MochiKit.LoggingPane.LoggingPane.prototype={"logFont":"8pt Verdana,sans-serif","colorTable":{"ERROR":"red","FATAL":"darkred","WARNING":"blue","INFO":"black","DEBUG":"green"}}; -MochiKit.LoggingPane.EXPORT_OK=["LoggingPane"]; -MochiKit.LoggingPane.EXPORT=["createLoggingPane"]; -MochiKit.LoggingPane.__new__=function(){ -this.EXPORT_TAGS={":common":this.EXPORT,":all":MochiKit.Base.concat(this.EXPORT,this.EXPORT_OK)}; -MochiKit.Base.nameFunctions(this); -MochiKit.LoggingPane._loggingPane=null; -}; -MochiKit.LoggingPane.__new__(); -MochiKit.Base._exportSymbols(this,MochiKit.LoggingPane); -if(typeof (dojo)!="undefined"){ -dojo.provide("MochiKit.Color"); -dojo.require("MochiKit.Base"); -} -if(typeof (JSAN)!="undefined"){ -JSAN.use("MochiKit.Base",[]); -} -try{ -if(typeof (MochiKit.Base)=="undefined"){ -throw ""; -} -} -catch(e){ -throw "MochiKit.Color depends on MochiKit.Base"; -} -if(typeof (MochiKit.Color)=="undefined"){ -MochiKit.Color={}; -} -MochiKit.Color.NAME="MochiKit.Color"; -MochiKit.Color.VERSION="1.3.1"; -MochiKit.Color.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -MochiKit.Color.toString=function(){ -return this.__repr__(); -}; -MochiKit.Color.Color=function(red,_466,blue,_468){ -if(typeof (_468)=="undefined"||_468===null){ -_468=1; -} -this.rgb={r:red,g:_466,b:blue,a:_468}; -}; -MochiKit.Color.Color.prototype={__class__:MochiKit.Color.Color,colorWithAlpha:function(_469){ -var rgb=this.rgb; -var m=MochiKit.Color; -return m.Color.fromRGB(rgb.r,rgb.g,rgb.b,_469); -},colorWithHue:function(hue){ -var hsl=this.asHSL(); -hsl.h=hue; -var m=MochiKit.Color; -return m.Color.fromHSL(hsl); -},colorWithSaturation:function(_473){ -var hsl=this.asHSL(); -hsl.s=_473; -var m=MochiKit.Color; -return m.Color.fromHSL(hsl); -},colorWithLightness:function(_474){ -var hsl=this.asHSL(); -hsl.l=_474; -var m=MochiKit.Color; -return m.Color.fromHSL(hsl); -},darkerColorWithLevel:function(_475){ -var hsl=this.asHSL(); -hsl.l=Math.max(hsl.l-_475,0); -var m=MochiKit.Color; -return m.Color.fromHSL(hsl); -},lighterColorWithLevel:function(_476){ -var hsl=this.asHSL(); -hsl.l=Math.min(hsl.l+_476,1); -var m=MochiKit.Color; -return m.Color.fromHSL(hsl); -},blendedColor:function(_477,_478){ -if(typeof (_478)=="undefined"||_478===null){ -_478=0.5; -} -var sf=1-_478; -var s=this.rgb; -var d=_477.rgb; -var df=_478; -return MochiKit.Color.Color.fromRGB((s.r*sf)+(d.r*df),(s.g*sf)+(d.g*df),(s.b*sf)+(d.b*df),(s.a*sf)+(d.a*df)); -},compareRGB:function(_481){ -var a=this.asRGB(); -var b=_481.asRGB(); -return MochiKit.Base.compare([a.r,a.g,a.b,a.a],[b.r,b.g,b.b,b.a]); -},isLight:function(){ -return this.asHSL().b>0.5; -},isDark:function(){ -return (!this.isLight()); -},toHSLString:function(){ -var c=this.asHSL(); -var ccc=MochiKit.Color.clampColorComponent; -var rval=this._hslString; -if(!rval){ -var mid=(ccc(c.h,360).toFixed(0)+","+ccc(c.s,100).toPrecision(4)+"%"+","+ccc(c.l,100).toPrecision(4)+"%"); -var a=c.a; -if(a>=1){ -a=1; -rval="hsl("+mid+")"; -}else{ -if(a<=0){ -a=0; -} -rval="hsla("+mid+","+a+")"; -} -this._hslString=rval; -} -return rval; -},toRGBString:function(){ -var c=this.rgb; -var ccc=MochiKit.Color.clampColorComponent; -var rval=this._rgbString; -if(!rval){ -var mid=(ccc(c.r,255).toFixed(0)+","+ccc(c.g,255).toFixed(0)+","+ccc(c.b,255).toFixed(0)); -if(c.a!=1){ -rval="rgba("+mid+","+c.a+")"; -}else{ -rval="rgb("+mid+")"; -} -this._rgbString=rval; -} -return rval; -},asRGB:function(){ -return MochiKit.Base.clone(this.rgb); -},toHexString:function(){ -var m=MochiKit.Color; -var c=this.rgb; -var ccc=MochiKit.Color.clampColorComponent; -var rval=this._hexString; -if(!rval){ -rval=("#"+m.toColorPart(ccc(c.r,255))+m.toColorPart(ccc(c.g,255))+m.toColorPart(ccc(c.b,255))); -this._hexString=rval; -} -return rval; -},asHSV:function(){ -var hsv=this.hsv; -var c=this.rgb; -if(typeof (hsv)=="undefined"||hsv===null){ -hsv=MochiKit.Color.rgbToHSV(this.rgb); -this.hsv=hsv; -} -return MochiKit.Base.clone(hsv); -},asHSL:function(){ -var hsl=this.hsl; -var c=this.rgb; -if(typeof (hsl)=="undefined"||hsl===null){ -hsl=MochiKit.Color.rgbToHSL(this.rgb); -this.hsl=hsl; -} -return MochiKit.Base.clone(hsl); -},toString:function(){ -return this.toRGBString(); -},repr:function(){ -var c=this.rgb; -var col=[c.r,c.g,c.b,c.a]; -return this.__class__.NAME+"("+col.join(", ")+")"; -}}; -MochiKit.Base.update(MochiKit.Color.Color,{fromRGB:function(red,_486,blue,_487){ -var _488=MochiKit.Color.Color; -if(arguments.length==1){ -var rgb=red; -red=rgb.r; -_486=rgb.g; -blue=rgb.b; -if(typeof (rgb.a)=="undefined"){ -_487=undefined; -}else{ -_487=rgb.a; -} -} -return new _488(red,_486,blue,_487); -},fromHSL:function(hue,_489,_490,_491){ -var m=MochiKit.Color; -return m.Color.fromRGB(m.hslToRGB.apply(m,arguments)); -},fromHSV:function(hue,_492,_493,_494){ -var m=MochiKit.Color; -return m.Color.fromRGB(m.hsvToRGB.apply(m,arguments)); -},fromName:function(name){ -var _495=MochiKit.Color.Color; -if(name.charAt(0)=="\""){ -name=name.substr(1,name.length-2); -} -var _496=_495._namedColors[name.toLowerCase()]; -if(typeof (_496)=="string"){ -return _495.fromHexString(_496); -}else{ -if(name=="transparent"){ -return _495.transparentColor(); -} -} -return null; -},fromString:function(_497){ -var self=MochiKit.Color.Color; -var _498=_497.substr(0,3); -if(_498=="rgb"){ -return self.fromRGBString(_497); -}else{ -if(_498=="hsl"){ -return self.fromHSLString(_497); -}else{ -if(_497.charAt(0)=="#"){ -return self.fromHexString(_497); -} -} -} -return self.fromName(_497); -},fromHexString:function(_499){ -if(_499.charAt(0)=="#"){ -_499=_499.substring(1); -} -var _500=[]; -var i,hex; -if(_499.length==3){ -for(i=0;i<3;i++){ -hex=_499.substr(i,1); -_500.push(parseInt(hex+hex,16)/255); -} -}else{ -for(i=0;i<6;i+=2){ -hex=_499.substr(i,2); -_500.push(parseInt(hex,16)/255); -} -} -var _501=MochiKit.Color.Color; -return _501.fromRGB.apply(_501,_500); -},_fromColorString:function(pre,_503,_504,_505){ -if(_505.indexOf(pre)===0){ -_505=_505.substring(_505.indexOf("(",3)+1,_505.length-1); -} -var _506=_505.split(/\s*,\s*/); -var _507=[]; -for(var i=0;i<_506.length;i++){ -var c=_506[i]; -var val; -var _508=c.substring(c.length-3); -if(c.charAt(c.length-1)=="%"){ -val=0.01*parseFloat(c.substring(0,c.length-1)); -}else{ -if(_508=="deg"){ -val=parseFloat(c)/360; -}else{ -if(_508=="rad"){ -val=parseFloat(c)/(Math.PI*2); -}else{ -val=_504[i]*parseFloat(c); -} -} -} -_507.push(val); -} -return this[_503].apply(this,_507); -},fromComputedStyle:function(elem,_509,_510){ -var d=MochiKit.DOM; -var cls=MochiKit.Color.Color; -for(elem=d.getElement(elem);elem;elem=elem.parentNode){ -var _511=d.computedStyle.apply(d,arguments); -if(!_511){ -continue; -} -var _512=cls.fromString(_511); -if(!_512){ -break; -} -if(_512.asRGB().a>0){ -return _512; -} -} -return null; -},fromBackground:function(elem){ -var cls=MochiKit.Color.Color; -return cls.fromComputedStyle(elem,"backgroundColor","background-color")||cls.whiteColor(); -},fromText:function(elem){ -var cls=MochiKit.Color.Color; -return cls.fromComputedStyle(elem,"color","color")||cls.blackColor(); -},namedColors:function(){ -return MochiKit.Base.clone(MochiKit.Color.Color._namedColors); -}}); -MochiKit.Base.update(MochiKit.Color,{clampColorComponent:function(v,_513){ -v*=_513; -if(v<0){ -return 0; -}else{ -if(v>_513){ -return _513; -}else{ -return v; -} -} -},_hslValue:function(n1,n2,hue){ -if(hue>6){ -hue-=6; -}else{ -if(hue<0){ -hue+=6; -} -} -var val; -if(hue<1){ -val=n1+(n2-n1)*hue; -}else{ -if(hue<3){ -val=n2; -}else{ -if(hue<4){ -val=n1+(n2-n1)*(4-hue); -}else{ -val=n1; -} -} -} -return val; -},hsvToRGB:function(hue,_516,_517,_518){ -if(arguments.length==1){ -var hsv=hue; -hue=hsv.h; -_516=hsv.s; -_517=hsv.v; -_518=hsv.a; -} -var red; -var _519; -var blue; -if(_516===0){ -red=0; -_519=0; -blue=0; -}else{ -var i=Math.floor(hue*6); -var f=(hue*6)-i; -var p=_517*(1-_516); -var q=_517*(1-(_516*f)); -var t=_517*(1-(_516*(1-f))); -switch(i){ -case 1: -red=q; -_519=_517; -blue=p; -break; -case 2: -red=p; -_519=_517; -blue=t; -break; -case 3: -red=p; -_519=q; -blue=_517; -break; -case 4: -red=t; -_519=p; -blue=_517; -break; -case 5: -red=_517; -_519=p; -blue=q; -break; -case 6: -case 0: -red=_517; -_519=t; -blue=p; -break; -} -} -return {r:red,g:_519,b:blue,a:_518}; -},hslToRGB:function(hue,_521,_522,_523){ -if(arguments.length==1){ -var hsl=hue; -hue=hsl.h; -_521=hsl.s; -_522=hsl.l; -_523=hsl.a; -} -var red; -var _524; -var blue; -if(_521===0){ -red=_522; -_524=_522; -blue=_522; -}else{ -var m2; -if(_522<=0.5){ -m2=_522*(1+_521); -}else{ -m2=_522+_521-(_522*_521); -} -var m1=(2*_522)-m2; -var f=MochiKit.Color._hslValue; -var h6=hue*6; -red=f(m1,m2,h6+2); -_524=f(m1,m2,h6); -blue=f(m1,m2,h6-2); -} -return {r:red,g:_524,b:blue,a:_523}; -},rgbToHSV:function(red,_528,blue,_529){ -if(arguments.length==1){ -var rgb=red; -red=rgb.r; -_528=rgb.g; -blue=rgb.b; -_529=rgb.a; -} -var max=Math.max(Math.max(red,_528),blue); -var min=Math.min(Math.min(red,_528),blue); -var hue; -var _532; -var _533=max; -if(min==max){ -hue=0; -_532=0; -}else{ -var _534=(max-min); -_532=_534/max; -if(red==max){ -hue=(_528-blue)/_534; -}else{ -if(_528==max){ -hue=2+((blue-red)/_534); -}else{ -hue=4+((red-_528)/_534); -} -} -hue/=6; -if(hue<0){ -hue+=1; -} -if(hue>1){ -hue-=1; -} -} -return {h:hue,s:_532,v:_533,a:_529}; -},rgbToHSL:function(red,_535,blue,_536){ -if(arguments.length==1){ -var rgb=red; -red=rgb.r; -_535=rgb.g; -blue=rgb.b; -_536=rgb.a; -} -var max=Math.max(red,Math.max(_535,blue)); -var min=Math.min(red,Math.min(_535,blue)); -var hue; -var _537; -var _538=(max+min)/2; -var _539=max-min; -if(_539===0){ -hue=0; -_537=0; -}else{ -if(_538<=0.5){ -_537=_539/(max+min); -}else{ -_537=_539/(2-max-min); -} -if(red==max){ -hue=(_535-blue)/_539; -}else{ -if(_535==max){ -hue=2+((blue-red)/_539); -}else{ -hue=4+((red-_535)/_539); -} -} -hue/=6; -if(hue<0){ -hue+=1; -} -if(hue>1){ -hue-=1; -} -} -return {h:hue,s:_537,l:_538,a:_536}; -},toColorPart:function(num){ -num=Math.round(num); -var _540=num.toString(16); -if(num<16){ -return "0"+_540; -} -return _540; -},__new__:function(){ -var m=MochiKit.Base; -this.Color.fromRGBString=m.bind(this.Color._fromColorString,this.Color,"rgb","fromRGB",[1/255,1/255,1/255,1]); -this.Color.fromHSLString=m.bind(this.Color._fromColorString,this.Color,"hsl","fromHSL",[1/360,0.01,0.01,1]); -var _541=1/3; -var _542={black:[0,0,0],blue:[0,0,1],brown:[0.6,0.4,0.2],cyan:[0,1,1],darkGray:[_541,_541,_541],gray:[0.5,0.5,0.5],green:[0,1,0],lightGray:[2*_541,2*_541,2*_541],magenta:[1,0,1],orange:[1,0.5,0],purple:[0.5,0,0.5],red:[1,0,0],transparent:[0,0,0,0],white:[1,1,1],yellow:[1,1,0]}; -var _543=function(name,r,g,b,a){ -var rval=this.fromRGB(r,g,b,a); -this[name]=function(){ -return rval; -}; -return rval; -}; -for(var k in _542){ -var name=k+"Color"; -var _545=m.concat([_543,this.Color,name],_542[k]); -this.Color[name]=m.bind.apply(null,_545); -} -var _546=function(){ -for(var i=0;i1){ -var src=MochiKit.DOM.getElement(arguments[0]); -var sig=arguments[1]; -var obj=arguments[2]; -var func=arguments[3]; -for(var i=_562.length-1;i>=0;i--){ -var o=_562[i]; -if(o[0]===src&&o[1]===sig&&o[4]===obj&&o[5]===func){ -self._disconnect(o); -_562.splice(i,1); -return true; -} -} -}else{ -var idx=m.findIdentical(_562,_561); -if(idx>=0){ -self._disconnect(_561); -_562.splice(idx,1); -return true; -} -} -return false; -},disconnectAll:function(src,sig){ -src=MochiKit.DOM.getElement(src); -var m=MochiKit.Base; -var _563=m.flattenArguments(m.extend(null,arguments,1)); -var self=MochiKit.Signal; -var _564=self._disconnect; -var _565=self._observers; -if(_563.length===0){ -for(var i=_565.length-1;i>=0;i--){ -var _566=_565[i]; -if(_566[0]===src){ -_564(_566); -_565.splice(i,1); -} -} -}else{ -var sigs={}; -for(var i=0;i<_563.length;i++){ -sigs[_563[i]]=true; -} -for(var i=_565.length-1;i>=0;i--){ -var _566=_565[i]; -if(_566[0]===src&&_566[1] in sigs){ -_564(_566); -_565.splice(i,1); -} -} -} -},signal:function(src,sig){ -var _568=MochiKit.Signal._observers; -src=MochiKit.DOM.getElement(src); -var args=MochiKit.Base.extend(null,arguments,2); -var _569=[]; -for(var i=0;i<_568.length;i++){ -var _570=_568[i]; -if(_570[0]===src&&_570[1]===sig){ -try{ -_570[2].apply(src,args); -} -catch(e){ -_569.push(e); -} -} -} -if(_569.length==1){ -throw _569[0]; -}else{ -if(_569.length>1){ -var e=new Error("Multiple errors thrown in handling 'sig', see errors property"); -e.errors=_569; -throw e; -} -} -}}); -MochiKit.Signal.EXPORT_OK=[]; -MochiKit.Signal.EXPORT=["connect","disconnect","signal","disconnectAll"]; -MochiKit.Signal.__new__=function(win){ -var m=MochiKit.Base; -this._document=document; -this._window=win; -try{ -this.connect(window,"onunload",this._unloadCache); -} -catch(e){ -} -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -m.nameFunctions(this); -}; -MochiKit.Signal.__new__(this); -if(!MochiKit.__compat__){ -connect=MochiKit.Signal.connect; -disconnect=MochiKit.Signal.disconnect; -disconnectAll=MochiKit.Signal.disconnectAll; -signal=MochiKit.Signal.signal; -} -MochiKit.Base._exportSymbols(this,MochiKit.Signal); -if(typeof (dojo)!="undefined"){ -dojo.provide("MochiKit.Visual"); -dojo.require("MochiKit.Base"); -dojo.require("MochiKit.DOM"); -dojo.require("MochiKit.Color"); -} -if(typeof (JSAN)!="undefined"){ -JSAN.use("MochiKit.Base",[]); -JSAN.use("MochiKit.DOM",[]); -JSAN.use("MochiKit.Color",[]); -} -try{ -if(typeof (MochiKit.Base)=="undefined"||typeof (MochiKit.DOM)=="undefined"||typeof (MochiKit.Color)=="undefined"){ -throw ""; -} -} -catch(e){ -throw "MochiKit.Visual depends on MochiKit.Base, MochiKit.DOM and MochiKit.Color!"; -} -if(typeof (MochiKit.Visual)=="undefined"){ -MochiKit.Visual={}; -} -MochiKit.Visual.NAME="MochiKit.Visual"; -MochiKit.Visual.VERSION="1.3.1"; -MochiKit.Visual.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -MochiKit.Visual.toString=function(){ -return this.__repr__(); -}; -MochiKit.Visual._RoundCorners=function(e,_571){ -e=MochiKit.DOM.getElement(e); -this._setOptions(_571); -if(this.options.__unstable__wrapElement){ -e=this._doWrap(e); -} -var _572=this.options.color; -var C=MochiKit.Color.Color; -if(this.options.color=="fromElement"){ -_572=C.fromBackground(e); -}else{ -if(!(_572 instanceof C)){ -_572=C.fromString(_572); -} -} -this.isTransparent=(_572.asRGB().a<=0); -var _574=this.options.bgColor; -if(this.options.bgColor=="fromParent"){ -_574=C.fromBackground(e.offsetParent); -}else{ -if(!(_574 instanceof C)){ -_574=C.fromString(_574); -} -} -this._roundCornersImpl(e,_572,_574); -}; -MochiKit.Visual._RoundCorners.prototype={_doWrap:function(e){ -var _575=e.parentNode; -var doc=MochiKit.DOM.currentDocument(); -if(typeof (doc.defaultView)=="undefined"||doc.defaultView===null){ -return e; -} -var _576=doc.defaultView.getComputedStyle(e,null); -if(typeof (_576)=="undefined"||_576===null){ -return e; -} -var _577=MochiKit.DOM.DIV({"style":{display:"block",marginTop:_576.getPropertyValue("padding-top"),marginRight:_576.getPropertyValue("padding-right"),marginBottom:_576.getPropertyValue("padding-bottom"),marginLeft:_576.getPropertyValue("padding-left"),padding:"0px"}}); -_577.innerHTML=e.innerHTML; -e.innerHTML=""; -e.appendChild(_577); -return e; -},_roundCornersImpl:function(e,_578,_579){ -if(this.options.border){ -this._renderBorder(e,_579); -} -if(this._isTopRounded()){ -this._roundTopCorners(e,_578,_579); -} -if(this._isBottomRounded()){ -this._roundBottomCorners(e,_578,_579); -} -},_renderBorder:function(el,_580){ -var _581="1px solid "+this._borderColor(_580); -var _582="border-left: "+_581; -var _583="border-right: "+_581; -var _584="style='"+_582+";"+_583+"'"; -el.innerHTML="
"+el.innerHTML+"
"; -},_roundTopCorners:function(el,_585,_586){ -var _587=this._createCorner(_586); -for(var i=0;i=0;i--){ -_590.appendChild(this._createCornerSlice(_588,_589,i,"bottom")); -} -el.style.paddingBottom=0; -el.appendChild(_590); -},_createCorner:function(_591){ -var dom=MochiKit.DOM; -return dom.DIV({style:{backgroundColor:_591.toString()}}); -},_createCornerSlice:function(_592,_593,n,_594){ -var _595=MochiKit.DOM.SPAN(); -var _596=_595.style; -_596.backgroundColor=_592.toString(); -_596.display="block"; -_596.height="1px"; -_596.overflow="hidden"; -_596.fontSize="1px"; -var _597=this._borderColor(_592,_593); -if(this.options.border&&n===0){ -_596.borderTopStyle="solid"; -_596.borderTopWidth="1px"; -_596.borderLeftWidth="0px"; -_596.borderRightWidth="0px"; -_596.borderBottomWidth="0px"; -_596.height="0px"; -_596.borderColor=_597.toString(); -}else{ -if(_597){ -_596.borderColor=_597.toString(); -_596.borderStyle="solid"; -_596.borderWidth="0px 1px"; -} -} -if(!this.options.compact&&(n==(this.options.numSlices-1))){ -_596.height="2px"; -} -this._setMargin(_595,n,_594); -this._setBorder(_595,n,_594); -return _595; -},_setOptions:function(_598){ -this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false,__unstable__wrapElement:false}; -MochiKit.Base.update(this.options,_598); -this.options.numSlices=(this.options.compact?2:4); -},_whichSideTop:function(){ -var _599=this.options.corners; -if(this._hasString(_599,"all","top")){ -return ""; -} -var _600=(_599.indexOf("tl")!=-1); -var _601=(_599.indexOf("tr")!=-1); -if(_600&&_601){ -return ""; -} -if(_600){ -return "left"; -} -if(_601){ -return "right"; -} -return ""; -},_whichSideBottom:function(){ -var _602=this.options.corners; -if(this._hasString(_602,"all","bottom")){ -return ""; -} -var _603=(_602.indexOf("bl")!=-1); -var _604=(_602.indexOf("br")!=-1); -if(_603&&_604){ -return ""; -} -if(_603){ -return "left"; -} -if(_604){ -return "right"; -} -return ""; -},_borderColor:function(_605,_606){ -if(_605=="transparent"){ -return _606; -}else{ -if(this.options.border){ -return this.options.border; -}else{ -if(this.options.blend){ -return _606.blendedColor(_605); -} -} -} -return ""; -},_setMargin:function(el,n,_607){ -var _608=this._marginSize(n)+"px"; -var _609=(_607=="top"?this._whichSideTop():this._whichSideBottom()); -var _610=el.style; -if(_609=="left"){ -_610.marginLeft=_608; -_610.marginRight="0px"; -}else{ -if(_609=="right"){ -_610.marginRight=_608; -_610.marginLeft="0px"; -}else{ -_610.marginLeft=_608; -_610.marginRight=_608; -} -} -},_setBorder:function(el,n,_611){ -var _612=this._borderSize(n)+"px"; -var _613=(_611=="top"?this._whichSideTop():this._whichSideBottom()); -var _614=el.style; -if(_613=="left"){ -_614.borderLeftWidth=_612; -_614.borderRightWidth="0px"; -}else{ -if(_613=="right"){ -_614.borderRightWidth=_612; -_614.borderLeftWidth="0px"; -}else{ -_614.borderLeftWidth=_612; -_614.borderRightWidth=_612; -} -} -},_marginSize:function(n){ -if(this.isTransparent){ -return 0; -} -var o=this.options; -if(o.compact&&o.blend){ -var _615=[1,0]; -return _615[n]; -}else{ -if(o.compact){ -var _616=[2,1]; -return _616[n]; -}else{ -if(o.blend){ -var _617=[3,2,1,0]; -return _617[n]; -}else{ -var _618=[5,3,2,1]; -return _618[n]; -} -} -} -},_borderSize:function(n){ -var o=this.options; -var _619; -if(o.compact&&(o.blend||this.isTransparent)){ -return 1; -}else{ -if(o.compact){ -_619=[1,0]; -}else{ -if(o.blend){ -_619=[2,1,1,1]; -}else{ -if(o.border){ -_619=[0,2,0,0]; -}else{ -if(this.isTransparent){ -_619=[5,3,2,1]; -}else{ -return 0; -} -} -} -} -} -return _619[n]; -},_hasString:function(str){ -for(var i=1;i"); -} -} -})(); -} diff --git a/applications/luci-livestats/htdocs/luci-static/resources/livestats/PlotKit.js b/applications/luci-livestats/htdocs/luci-static/resources/livestats/PlotKit.js deleted file mode 100644 index 363042ac2..000000000 --- a/applications/luci-livestats/htdocs/luci-static/resources/livestats/PlotKit.js +++ /dev/null @@ -1,2177 +0,0 @@ -/*** - - PlotKit.PlotKit 0.9.1 : PACKED VERSION - - THIS FILE IS AUTOMATICALLY GENERATED. If creating patches, please - diff against the source tree, not this file. - - For more information, . - - Copyright (c) 2006. Alastair Tse. - -***/ - -try{ -if(typeof (MochiKit.Base)=="undefined"||typeof (MochiKit.DOM)=="undefined"||typeof (MochiKit.Color)=="undefined"||typeof (MochiKit.Format)=="undefined"){ -throw ""; -} -} -catch(e){ -throw "PlotKit depends on MochiKit.{Base,Color,DOM,Format}"; -} -MochiKit.Base.update(MochiKit.Color.Color.prototype,{asFillColor:function(){ -return this.lighterColorWithLevel(0.3); -},asStrokeColor:function(){ -return this.darkerColorWithLevel(0.1); -},asPointColor:function(){ -return this.lighterColorWithLevel(0.1); -}}); -if(typeof (PlotKit)=="undefined"){ -PlotKit={}; -} -PlotKit.NAME="PlotKit"; -PlotKit.VERSION="0.8"; -PlotKit.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -PlotKit.toString=function(){ -return this.__repr__(); -}; -if(typeof (PlotKit.Base)=="undefined"){ -PlotKit.Base={}; -} -PlotKit.Base.NAME="PlotKit.Base"; -PlotKit.Base.VERSION=PlotKit.VERSION; -PlotKit.Base.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -PlotKit.Base.toString=function(){ -return this.__repr__(); -}; -PlotKit.Base.usingPrototype=function(){ -try{ -return (typeof (Object.extend)=="function"); -} -catch(e){ -return false; -} -}; -MochiKit.Base.update(PlotKit.Base,{roundInterval:function(_1,_2,_3){ -var _4=MochiKit.Format.roundToFixed; -var _5=_1/_2; -return parseFloat(_4(_5,_3)); -},collapse:function(_6){ -var m=MochiKit.Base; -var _8=new Array(); -for(var i=0;i<_6.length;i++){ -_8=m.concat(_8,_6[i]); -} -if(PlotKit.Base.usingPrototype()){ -delete _8.extend; -delete _8.from; -delete _8.inspect; -} -return _8; -},uniq:function(_10){ -var m=MochiKit.Base; -if(!m.isArrayLike(_10)||(_10.length<1)){ -return new Array(); -} -var _11=new Array(); -var _12=_10[0]; -_11.push(_10[0]); -for(var i=1;i<_10.length;i++){ -if(m.compare(_10[i],_12)!=0){ -_12=_10[i]; -_11.push(_10[i]); -} -} -return _11; -},colorScheme:function(){ -var mb=MochiKit.Base; -var mc=MochiKit.Color; -var _15=["red","orange","yellow","green","cyan","blue","purple","magenta"]; -var _16=function(_17){ -return mc.Color[_17+"Color"](); -}; -return mb.map(_16,_15); -},baseDarkPrimaryColors:function(){ -var _18=MochiKit.Color.Color.fromHexString; -return [_18("#ad3f40"),_18("#ddac2c"),_18("#dfdd0c"),_18("#5276c4"),_18("#739c5a")]; -},basePrimaryColors:function(){ -var _19=MochiKit.Color.Color.fromHexString; -return [_19("#d24c4d"),_19("#f2b32f"),_19("#ece90e"),_19("#5d83da"),_19("#78a15d")]; -},baseBlueColors:function(){ -var _20=MochiKit.Color.Color.fromHexString; -return [_20("#4b6b94"),_20("#5d81b4"),_20("#acbad2")]; -},palette:function(_21,_22,_23,_24){ -var _25=MochiKit.Base.isUndefinedOrNull; -var _26=new Array(); -if(_25(_24)){ -_24=0.1; -} -if(_25(_23)){ -_23=0.4; -} -if(_25(_22)){ -_22=-0.2; -} -var _27=_22; -while(_27<=_23){ -_26.push(_27); -_27+=_24; -} -var _28=function(_29,_30){ -return _29.lighterColorWithLevel(_30); -}; -return MochiKit.Base.map(partial(_28,_21),_26); -},excanvasSupported:function(){ -if(/MSIE/.test(navigator.userAgent)&&!window.opera){ -return true; -} -return false; -},findPosX:function(obj){ -var _32=0; -if(obj.offsetParent){ -while(obj.offsetParent){ -_32+=obj.offsetLeft; -obj=obj.offsetParent; -} -}else{ -if(obj.x){ -_32+=obj.x; -} -} -return _32; -},findPosY:function(obj){ -var _33=0; -if(obj.offsetParent){ -while(obj.offsetParent){ -_33+=obj.offsetTop; -obj=obj.offsetParent; -} -}else{ -if(obj.y){ -_33+=obj.y; -} -} -return _33; -},isFuncLike:function(obj){ -return (typeof (obj)=="function"); -}}); -PlotKit.Base.map=function(fn,lst){ -if(PlotKit.Base.usingPrototype()){ -var _36=[]; -for(var x in lst){ -if(typeof (lst[x])=="function"){ -continue; -} -_36.push(fn(lst[x])); -} -return _36; -}else{ -return MochiKit.Base.map(fn,lst); -} -}; -PlotKit.Base.items=function(lst){ -if(PlotKit.Base.usingPrototype()){ -var _38=[]; -for(var x in lst){ -if(typeof (lst[x])=="function"){ -continue; -} -_38.push([x,lst[x]]); -} -return _38; -}else{ -return MochiKit.Base.items(lst); -} -}; -PlotKit.Base.keys=function(lst){ -if(PlotKit.Base.usingPrototype()){ -var _39=[]; -for(var x in lst){ -if(typeof (lst[x])=="function"){ -continue; -} -_39.push(x); -} -return _39; -}else{ -return MochiKit.Base.keys(lst); -} -}; -PlotKit.Base.baseColors=function(){ -var _40=MochiKit.Color.Color.fromHexString; -return [_40("#476fb2"),_40("#be2c2b"),_40("#85b730"),_40("#734a99"),_40("#26a1c5"),_40("#fb8707"),_40("#000000")]; -}; -PlotKit.Base.officeBaseStyle={"axisLineWidth":2,"axisLabelColor":Color.grayColor(),"axisLineColor":Color.whiteColor(),"padding":{top:5,bottom:10,left:30,right:30}}; -MochiKit.Base.update(PlotKit.Base,{officeBlue:function(){ -var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[0]),"backgroundColor":PlotKit.Base.baseColors()[0].lighterColorWithLevel(0.45)}; -MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle); -return r; -},officeRed:function(){ -var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[1]),"backgroundColor":PlotKit.Base.baseColors()[1].lighterColorWithLevel(0.5)}; -MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle); -return r; -},officeGreen:function(){ -var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[2]),"backgroundColor":PlotKit.Base.baseColors()[2].lighterColorWithLevel(0.5)}; -MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle); -return r; -},officePurple:function(){ -var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[3]),"backgroundColor":PlotKit.Base.baseColors()[3].lighterColorWithLevel(0.5)}; -MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle); -return r; -},officeCyan:function(){ -var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[4]),"backgroundColor":PlotKit.Base.baseColors()[4].lighterColorWithLevel(0.5)}; -MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle); -return r; -},officeOrange:function(){ -var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[5]),"backgroundColor":PlotKit.Base.baseColors()[5].lighterColorWithLevel(0.4)}; -MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle); -return r; -},officeBlack:function(){ -var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[6],0,0.6),"backgroundColor":PlotKit.Base.baseColors()[6].lighterColorWithLevel(0.9)}; -MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle); -return r; -}}); -PlotKit.Base.EXPORT=["baseColors","collapse","colorScheme","findPosX","findPosY","officeBaseStyle","officeBlue","officeRed","officeGreen","officePurple","officeCyan","officeOrange","officeBlack","roundInterval","uniq","isFuncLike","excanvasSupported"]; -PlotKit.Base.EXPORT_OK=[]; -PlotKit.Base.__new__=function(){ -var m=MochiKit.Base; -m.nameFunctions(this); -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -}; -PlotKit.Base.__new__(); -MochiKit.Base._exportSymbols(this,PlotKit.Base); -try{ -if(typeof (PlotKit.Base)=="undefined"){ -throw ""; -} -} -catch(e){ -throw "PlotKit.Layout depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.Base"; -} -if(typeof (PlotKit.Layout)=="undefined"){ -PlotKit.Layout={}; -} -PlotKit.Layout.NAME="PlotKit.Layout"; -PlotKit.Layout.VERSION=PlotKit.VERSION; -PlotKit.Layout.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -PlotKit.Layout.toString=function(){ -return this.__repr__(); -}; -PlotKit.Layout.valid_styles=["bar","line","pie","point"]; -PlotKit.Layout=function(_42,_43){ -this.options={"barWidthFillFraction":0.75,"barOrientation":"vertical","xOriginIsZero":true,"yOriginIsZero":true,"xAxis":null,"yAxis":null,"xTicks":null,"yTicks":null,"xNumberOfTicks":10,"yNumberOfTicks":5,"xTickPrecision":1,"yTickPrecision":1,"pieRadius":0.4}; -this.style=_42; -MochiKit.Base.update(this.options,_43?_43:{}); -if(!MochiKit.Base.isUndefinedOrNull(this.options.xAxis)){ -this.minxval=this.options.xAxis[0]; -this.maxxval=this.options.xAxis[1]; -this.xscale=this.maxxval-this.minxval; -}else{ -this.minxval=0; -this.maxxval=null; -this.xscale=null; -} -if(!MochiKit.Base.isUndefinedOrNull(this.options.yAxis)){ -this.minyval=this.options.yAxis[0]; -this.maxyval=this.options.yAxis[1]; -this.yscale=this.maxyval-this.minyval; -}else{ -this.minyval=0; -this.maxyval=null; -this.yscale=null; -} -this.bars=new Array(); -this.points=new Array(); -this.slices=new Array(); -this.xticks=new Array(); -this.yticks=new Array(); -this.datasets=new Array(); -this.minxdelta=0; -this.xrange=1; -this.yrange=1; -this.hitTestCache={x2maxy:null}; -}; -PlotKit.Layout.prototype.addDataset=function(_44,_45){ -this.datasets[_44]=_45; -}; -PlotKit.Layout.prototype.removeDataset=function(_46,_47){ -delete this.datasets[_46]; -}; -PlotKit.Layout.prototype.addDatasetFromTable=function(_48,_49,_50,_51,_52){ -var _53=MochiKit.Base.isUndefinedOrNull; -var _54=MochiKit.DOM.scrapeText; -var _55=MochiKit.Format.strip; -if(_53(_50)){ -_50=0; -} -if(_53(_51)){ -_51=1; -} -if(_53(_52)){ -_52=-1; -} -var _56=_49.tBodies[0].rows; -var _57=new Array(); -var _58=new Array(); -if(!_53(_56)){ -for(var i=0;i<_56.length;i++){ -_57.push([parseFloat(_55(_54(_56[i].cells[_50]))),parseFloat(_55(_54(_56[i].cells[_51])))]); -if(_52>=0){ -_58.push({v:parseFloat(_55(_54(_56[i].cells[_50]))),label:_55(_54(_56[i].cells[_52]))}); -} -} -this.addDataset(_48,_57); -if(_52>=0){ -this.options.xTicks=_58; -} -return true; -} -return false; -}; -PlotKit.Layout.prototype.evaluate=function(){ -this._evaluateLimits(); -this._evaluateScales(); -if(this.style=="bar"){ -if(this.options.barOrientation=="horizontal"){ -this._evaluateHorizBarCharts(); -}else{ -this._evaluateBarCharts(); -} -this._evaluateBarTicks(); -}else{ -if(this.style=="line"){ -this._evaluateLineCharts(); -this._evaluateLineTicks(); -}else{ -if(this.style=="pie"){ -this._evaluatePieCharts(); -this._evaluatePieTicks(); -} -} -} -}; -PlotKit.Layout.prototype.hitTest=function(x,y){ -var f=MochiKit.Format.twoDigitFloat; -if((this.style=="bar")&&this.bars&&(this.bars.length>0)){ -for(var i=0;i=bar.x)&&(x<=bar.x+bar.w)&&(y>=bar.y)&&(y-bar.y<=bar.h)){ -return bar; -} -} -}else{ -if(this.style=="line"){ -if(this.hitTestCache.x2maxy==null){ -this._regenerateHitTestCache(); -} -var _62=x/this.xscale; -var _63=this.hitTestCache.xvalues; -var _64=null; -var _65=null; -for(var i=1;i<_63.length;i++){ -if(_63[i]>_62){ -_64=_63[i-1]; -_65=_63[i]; -break; -} -} -if((_64!=null)){ -var _66=this.hitTestCache.x2maxy[_64]; -var _67=this.hitTestCache.x2maxy[_65]; -var _68=(1-y)/this.yscale; -var _69=(_67-_66)/(_65-_64); -var _70=_66+_69*(_62-_64); -if(_70>=_68){ -var obj={xval:_62,yval:_68,xafter:_65,yafter:_67,xbefore:_64,ybefore:_66,yprojected:_70}; -return obj; -} -} -}else{ -if(this.style=="pie"){ -var _71=Math.sqrt((y-0.5)*(y-0.5)+(x-0.5)*(x-0.5)); -if(_71>this.options.pieRadius){ -return null; -} -var _72=Math.atan2(y-0.5,x-0.5)-Math.PI/2; -for(var i=0;i=_72){ -return _73; -} -} -} -} -} -return null; -}; -PlotKit.Layout.prototype.rectForX=function(x){ -return null; -}; -PlotKit.Layout.prototype.angleRangeForX=function(x){ -return null; -}; -PlotKit.Layout.prototype._evaluateLimits=function(){ -var map=PlotKit.Base.map; -var _75=PlotKit.Base.items; -var _76=MochiKit.Base.itemgetter; -var _77=PlotKit.Base.collapse; -var _78=MochiKit.Base.listMin; -var _79=MochiKit.Base.listMax; -var _80=MochiKit.Base.isUndefinedOrNull; -var all=_77(map(_76(1),_75(this.datasets))); -if(_80(this.options.xAxis)){ -if(this.options.xOriginIsZero){ -this.minxval=0; -}else{ -this.minxval=_78(map(parseFloat,map(_76(0),all))); -} -this.maxxval=_79(map(parseFloat,map(_76(0),all))); -}else{ -this.minxval=this.options.xAxis[0]; -this.maxxval=this.options.xAxis[1]; -this.xscale=this.maxval-this.minxval; -} -if(_80(this.options.yAxis)){ -if(this.options.yOriginIsZero){ -this.minyval=0; -}else{ -this.minyval=_78(map(parseFloat,map(_76(1),all))); -} -this.maxyval=_79(map(parseFloat,map(_76(1),all))); -}else{ -this.minyval=this.options.yAxis[0]; -this.maxyval=this.options.yAxis[1]; -this.yscale=this.maxyval-this.minyval; -} -}; -PlotKit.Layout.prototype._evaluateScales=function(){ -var _82=MochiKit.Base.isUndefinedOrNull; -this.xrange=this.maxxval-this.minxval; -if(this.xrange==0){ -this.xscale=1; -}else{ -this.xscale=1/this.xrange; -} -this.yrange=this.maxyval-this.minyval; -if(this.yrange==0){ -this.yscale=1; -}else{ -this.yscale=1/this.yrange; -} -}; -PlotKit.Layout.prototype._uniqueXValues=function(){ -var _83=PlotKit.Base.collapse; -var map=PlotKit.Base.map; -var _84=PlotKit.Base.uniq; -var _85=MochiKit.Base.itemgetter; -var _86=PlotKit.Base.items; -var _87=map(parseFloat,map(_85(0),_83(map(_85(1),_86(this.datasets))))); -_87.sort(MochiKit.Base.compare); -return _84(_87); -}; -PlotKit.Layout.prototype._evaluateBarCharts=function(){ -var _88=PlotKit.Base.items; -var _89=_88(this.datasets).length; -var _90=10000000; -var _91=this._uniqueXValues(); -for(var i=1;i<_91.length;i++){ -_90=Math.min(Math.abs(_91[i]-_91[i-1]),_90); -} -var _92=0; -var _93=0; -var _94=0; -if(_91.length==1){ -_90=1; -this.xscale=1; -this.minxval=_91[0]; -_92=1*this.options.barWidthFillFraction; -_93=_92/_89; -_94=(1-this.options.barWidthFillFraction)/2; -}else{ -if(this.xrange==1){ -this.xscale=0.5; -}else{ -if(this.xrange==2){ -this.xscale=1/3; -}else{ -this.xscale=(1-_90/this.xrange)/this.xrange; -} -} -_92=_90*this.xscale*this.options.barWidthFillFraction; -_93=_92/_89; -_94=_90*this.xscale*(1-this.options.barWidthFillFraction)/2; -} -this.minxdelta=_90; -this.bars=new Array(); -var i=0; -for(var _95 in this.datasets){ -var _96=this.datasets[_95]; -if(PlotKit.Base.isFuncLike(_96)){ -continue; -} -for(var j=0;j<_96.length;j++){ -var _98=_96[j]; -var _99={x:((parseFloat(_98[0])-this.minxval)*this.xscale)+(i*_93)+_94,y:1-((parseFloat(_98[1])-this.minyval)*this.yscale),w:_93,h:((parseFloat(_98[1])-this.minyval)*this.yscale),xval:parseFloat(_98[0]),yval:parseFloat(_98[1]),name:_95}; -if((_99.x>=0)&&(_99.x<=1)&&(_99.y>=0)&&(_99.y<=1)){ -this.bars.push(_99); -} -} -i++; -} -}; -PlotKit.Layout.prototype._evaluateHorizBarCharts=function(){ -var _100=PlotKit.Base.items; -var _101=_100(this.datasets).length; -var _102=10000000; -var _103=this._uniqueXValues(); -for(var i=1;i<_103.length;i++){ -_102=Math.min(Math.abs(_103[i]-_103[i-1]),_102); -} -var _104=0; -var _105=0; -var _106=0; -if(_103.length==1){ -_102=1; -this.xscale=1; -this.minxval=_103[0]; -_104=1*this.options.barWidthFillFraction; -_105=_104/_101; -_106=(1-this.options.barWidthFillFraction)/2; -}else{ -this.xscale=(1-_102/this.xrange)/this.xrange; -_104=_102*this.xscale*this.options.barWidthFillFraction; -_105=_104/_101; -_106=_102*this.xscale*(1-this.options.barWidthFillFraction)/2; -} -this.minxdelta=_102; -this.bars=new Array(); -var i=0; -for(var _107 in this.datasets){ -var _108=this.datasets[_107]; -if(PlotKit.Base.isFuncLike(_108)){ -continue; -} -for(var j=0;j<_108.length;j++){ -var item=_108[j]; -var rect={y:((parseFloat(item[0])-this.minxval)*this.xscale)+(i*_105)+_106,x:0,h:_105,w:((parseFloat(item[1])-this.minyval)*this.yscale),xval:parseFloat(item[0]),yval:parseFloat(item[1]),name:_107}; -if(rect.y<=0){ -rect.y=0; -} -if(rect.y>=1){ -rect.y=1; -} -if((rect.x>=0)&&(rect.x<=1)){ -this.bars.push(rect); -} -} -i++; -} -}; -PlotKit.Layout.prototype._evaluateLineCharts=function(){ -var _111=PlotKit.Base.items; -var _112=_111(this.datasets).length; -this.points=new Array(); -var i=0; -for(var _113 in this.datasets){ -var _114=this.datasets[_113]; -if(PlotKit.Base.isFuncLike(_114)){ -continue; -} -_114.sort(function(a,b){ -return compare(parseFloat(a[0]),parseFloat(b[0])); -}); -for(var j=0;j<_114.length;j++){ -var item=_114[j]; -var _117={x:((parseFloat(item[0])-this.minxval)*this.xscale),y:1-((parseFloat(item[1])-this.minyval)*this.yscale),xval:parseFloat(item[0]),yval:parseFloat(item[1]),name:_113}; -if(_117.y<=0){ -_117.y=0; -} -if(_117.y>=1){ -_117.y=1; -} -if((_117.x>=0)&&(_117.x<=1)){ -this.points.push(_117); -} -} -i++; -} -}; -PlotKit.Layout.prototype._evaluatePieCharts=function(){ -var _118=PlotKit.Base.items; -var sum=MochiKit.Iter.sum; -var _120=MochiKit.Base.itemgetter; -var _121=_118(this.datasets).length; -var _122=_118(this.datasets)[0][1]; -var _123=sum(map(_120(1),_122)); -this.slices=new Array(); -var _124=0; -for(var i=0;i<_122.length;i++){ -var _125=_122[i][1]/_123; -var _126=_124*Math.PI*2; -var _127=(_124+_125)*Math.PI*2; -var _128={fraction:_125,xval:_122[i][0],yval:_122[i][1],startAngle:_126,endAngle:_127}; -if(_122[i][1]!=0){ -this.slices.push(_128); -} -_124+=_125; -} -}; -PlotKit.Layout.prototype._evaluateLineTicksForXAxis=function(){ -var _129=MochiKit.Base.isUndefinedOrNull; -if(this.options.xTicks){ -this.xticks=new Array(); -var _130=function(tick){ -var _132=tick.label; -if(_129(_132)){ -_132=tick.v.toString(); -} -var pos=this.xscale*(tick.v-this.minxval); -if((pos>=0)&&(pos<=1)){ -this.xticks.push([pos,_132]); -} -}; -MochiKit.Iter.forEach(this.options.xTicks,bind(_130,this)); -}else{ -if(this.options.xNumberOfTicks){ -var _134=this._uniqueXValues(); -var _135=this.xrange/this.options.xNumberOfTicks; -var _136=0; -this.xticks=new Array(); -for(var i=0;i<=_134.length;i++){ -if((_134[i]-this.minxval)>=(_136*_135)){ -var pos=this.xscale*(_134[i]-this.minxval); -if((pos>1)||(pos<0)){ -continue; -} -this.xticks.push([pos,_134[i]]); -_136++; -} -if(_136>this.options.xNumberOfTicks){ -break; -} -} -} -} -}; -PlotKit.Layout.prototype._evaluateLineTicksForYAxis=function(){ -var _137=MochiKit.Base.isUndefinedOrNull; -if(this.options.yTicks){ -this.yticks=new Array(); -var _138=function(tick){ -var _139=tick.label; -if(_137(_139)){ -_139=tick.v.toString(); -} -var pos=1-(this.yscale*(tick.v-this.minyval)); -if((pos>=0)&&(pos<=1)){ -this.yticks.push([pos,_139]); -} -}; -MochiKit.Iter.forEach(this.options.yTicks,bind(_138,this)); -}else{ -if(this.options.yNumberOfTicks){ -this.yticks=new Array(); -var _140=PlotKit.Base.roundInterval; -var prec=this.options.yTickPrecision; -var _142=_140(this.yrange,this.options.yNumberOfTicks,prec); -for(var i=0;i<=this.options.yNumberOfTicks;i++){ -var yval=this.minyval+(i*_142); -var pos=1-((yval-this.minyval)*this.yscale); -if((pos>1)||(pos<0)){ -continue; -} -this.yticks.push([pos,MochiKit.Format.roundToFixed(yval,prec)]); -} -} -} -}; -PlotKit.Layout.prototype._evaluateLineTicks=function(){ -this._evaluateLineTicksForXAxis(); -this._evaluateLineTicksForYAxis(); -}; -PlotKit.Layout.prototype._evaluateBarTicks=function(){ -this._evaluateLineTicks(); -var _144=function(tick){ -return [tick[0]+(this.minxdelta*this.xscale)/2,tick[1]]; -}; -this.xticks=MochiKit.Base.map(bind(_144,this),this.xticks); -if(this.options.barOrientation=="horizontal"){ -var _145=this.xticks; -this.xticks=this.yticks; -this.yticks=_145; -var _146=function(tick){ -return [1-tick[0],tick[1]]; -}; -this.xticks=MochiKit.Base.map(_146,this.xticks); -} -}; -PlotKit.Layout.prototype._evaluatePieTicks=function(){ -var _147=MochiKit.Base.isUndefinedOrNull; -var _148=MochiKit.Format.numberFormatter("#%"); -this.xticks=new Array(); -if(this.options.xTicks){ -var _149=new Array(); -for(var i=0;i0){ -this.__init__(_158,_159,_160); -} -}; -PlotKit.CanvasRenderer.prototype.__init__=function(_161,_162,_163){ -var _164=MochiKit.Base.isUndefinedOrNull; -var _165=MochiKit.Color.Color; -this.options={"drawBackground":true,"backgroundColor":_165.whiteColor(),"padding":{left:30,right:30,top:5,bottom:10},"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[0]),"strokeColor":_165.whiteColor(),"strokeColorTransform":"asStrokeColor","strokeWidth":0.5,"shouldFill":true,"shouldStroke":true,"drawXAxis":true,"drawYAxis":true,"axisLineColor":_165.blackColor(),"axisLineWidth":0.5,"axisTickSize":3,"axisLabelColor":_165.blackColor(),"axisLabelFont":"Arial","axisLabelFontSize":9,"axisLabelWidth":50,"pieRadius":0.4,"enableEvents":true}; -MochiKit.Base.update(this.options,_163?_163:{}); -this.layout=_162; -this.element=MochiKit.DOM.getElement(_161); -this.container=this.element.parentNode; -this.isIE=PlotKit.Base.excanvasSupported(); -if(this.isIE&&!_164(G_vmlCanvasManager)){ -this.IEDelay=0.5; -this.maxTries=5; -this.renderDelay=null; -this.clearDelay=null; -this.element=G_vmlCanvasManager.initElement(this.element); -} -this.height=this.element.height; -this.width=this.element.width; -if(_164(this.element)){ -throw "CanvasRenderer() - passed canvas is not found"; -} -if(!this.isIE&&!(PlotKit.CanvasRenderer.isSupported(this.element))){ -throw "CanvasRenderer() - Canvas is not supported."; -} -if(_164(this.container)||(this.container.nodeName.toLowerCase()!="div")){ -throw "CanvasRenderer() - needs to be enclosed in
"; -} -this.xlabels=new Array(); -this.ylabels=new Array(); -this.isFirstRender=true; -this.area={x:this.options.padding.left,y:this.options.padding.top,w:this.width-this.options.padding.left-this.options.padding.right,h:this.height-this.options.padding.top-this.options.padding.bottom}; -MochiKit.DOM.updateNodeAttributes(this.container,{"style":{"position":"relative","width":this.width+"px"}}); -}; -PlotKit.CanvasRenderer.prototype.render=function(){ -if(this.isIE){ -try{ -if(this.renderDelay){ -this.renderDelay.cancel(); -this.renderDelay=null; -} -var _166=this.element.getContext("2d"); -} -catch(e){ -this.isFirstRender=false; -if(this.maxTries-->0){ -this.renderDelay=MochiKit.Async.wait(this.IEDelay); -this.renderDelay.addCallback(bind(this.render,this)); -} -return; -} -} -if(this.options.drawBackground){ -this._renderBackground(); -} -if(this.layout.style=="bar"){ -this._renderBarChart(); -this._renderBarAxis(); -}else{ -if(this.layout.style=="pie"){ -this._renderPieChart(); -this._renderPieAxis(); -}else{ -if(this.layout.style=="line"){ -this._renderLineChart(); -this._renderLineAxis(); -} -} -} -}; -PlotKit.CanvasRenderer.prototype._renderBarChartWrap=function(data,_168){ -var _169=this.element.getContext("2d"); -var _170=this.options.colorScheme.length; -var _171=this.options.colorScheme; -var _172=MochiKit.Base.keys(this.layout.datasets); -var _173=_172.length; -for(var i=0;i<_173;i++){ -var _174=_172[i]; -var _175=_171[i%_170]; -_169.save(); -_169.fillStyle=_175.toRGBString(); -if(this.options.strokeColor){ -_169.strokeStyle=this.options.strokeColor.toRGBString(); -}else{ -if(this.options.strokeColorTransform){ -_169.strokeStyle=_175[this.options.strokeColorTransform]().toRGBString(); -} -} -_169.lineWidth=this.options.strokeWidth; -var _176=function(obj){ -if(obj.name==_174){ -_168(_169,obj); -} -}; -MochiKit.Iter.forEach(data,bind(_176,this)); -_169.restore(); -} -}; -PlotKit.CanvasRenderer.prototype._renderBarChart=function(){ -var bind=MochiKit.Base.bind; -var _178=function(_179,bar){ -var x=this.area.w*bar.x+this.area.x; -var y=this.area.h*bar.y+this.area.y; -var w=this.area.w*bar.w; -var h=this.area.h*bar.h; -if((w<1)||(h<1)){ -return; -} -if(this.options.shouldFill){ -_179.fillRect(x,y,w,h); -} -if(this.options.shouldStroke){ -_179.strokeRect(x,y,w,h); -} -}; -this._renderBarChartWrap(this.layout.bars,bind(_178,this)); -}; -PlotKit.CanvasRenderer.prototype._renderLineChart=function(){ -var _182=this.element.getContext("2d"); -var _183=this.options.colorScheme.length; -var _184=this.options.colorScheme; -var _185=MochiKit.Base.keys(this.layout.datasets); -var _186=_185.length; -var bind=MochiKit.Base.bind; -var _187=MochiKit.Base.partial; -for(var i=0;i<_186;i++){ -var _188=_185[i]; -var _189=_184[i%_183]; -var _190=this.options.strokeColorTransform; -_182.save(); -_182.fillStyle=_189.toRGBString(); -if(this.options.strokeColor){ -_182.strokeStyle=this.options.strokeColor.toRGBString(); -}else{ -if(this.options.strokeColorTransform){ -_182.strokeStyle=_189[_190]().toRGBString(); -} -} -_182.lineWidth=this.options.strokeWidth; -var _191=function(ctx){ -ctx.beginPath(); -ctx.moveTo(this.area.x,this.area.y+this.area.h); -var _193=function(ctx_,_195){ -if(_195.name==_188){ -ctx_.lineTo(this.area.w*_195.x+this.area.x,this.area.h*_195.y+this.area.y); -} -}; -MochiKit.Iter.forEach(this.layout.points,_187(_193,ctx),this); -ctx.lineTo(this.area.w+this.area.x,this.area.h+this.area.y); -ctx.lineTo(this.area.x,this.area.y+this.area.h); -ctx.closePath(); -}; -if(this.options.shouldFill){ -bind(_191,this)(_182); -_182.fill(); -} -if(this.options.shouldStroke){ -bind(_191,this)(_182); -_182.stroke(); -} -_182.restore(); -} -}; -PlotKit.CanvasRenderer.prototype._renderPieChart=function(){ -var _196=this.element.getContext("2d"); -var _197=this.options.colorScheme.length; -var _198=this.layout.slices; -var _199=this.area.x+this.area.w*0.5; -var _200=this.area.y+this.area.h*0.5; -var _201=Math.min(this.area.w*this.options.pieRadius,this.area.h*this.options.pieRadius); -if(this.isIE){ -_199=parseInt(_199); -_200=parseInt(_200); -_201=parseInt(_201); -} -for(var i=0;i<_198.length;i++){ -var _202=this.options.colorScheme[i%_197]; -_196.save(); -_196.fillStyle=_202.toRGBString(); -var _203=function(){ -_196.beginPath(); -_196.moveTo(_199,_200); -_196.arc(_199,_200,_201,_198[i].startAngle-Math.PI/2,_198[i].endAngle-Math.PI/2,false); -_196.lineTo(_199,_200); -_196.closePath(); -}; -if(Math.abs(_198[i].startAngle-_198[i].endAngle)>0.001){ -if(this.options.shouldFill){ -_203(); -_196.fill(); -} -if(this.options.shouldStroke){ -_203(); -_196.lineWidth=this.options.strokeWidth; -if(this.options.strokeColor){ -_196.strokeStyle=this.options.strokeColor.toRGBString(); -}else{ -if(this.options.strokeColorTransform){ -_196.strokeStyle=_202[this.options.strokeColorTransform]().toRGBString(); -} -} -_196.stroke(); -} -} -_196.restore(); -} -}; -PlotKit.CanvasRenderer.prototype._renderBarAxis=function(){ -this._renderAxis(); -}; -PlotKit.CanvasRenderer.prototype._renderLineAxis=function(){ -this._renderAxis(); -}; -PlotKit.CanvasRenderer.prototype._renderAxis=function(){ -if(!this.options.drawXAxis&&!this.options.drawYAxis){ -return; -} -var _204=this.element.getContext("2d"); -var _205={"style":{"position":"absolute","fontSize":this.options.axisLabelFontSize+"px","zIndex":10,"color":this.options.axisLabelColor.toRGBString(),"width":this.options.axisLabelWidth+"px","overflow":"hidden"}}; -_204.save(); -_204.strokeStyle=this.options.axisLineColor.toRGBString(); -_204.lineWidth=this.options.axisLineWidth; -if(this.options.drawYAxis){ -if(this.layout.yticks){ -var _206=function(tick){ -if(typeof (tick)=="function"){ -return; -} -var x=this.area.x; -var y=this.area.y+tick[0]*this.area.h; -_204.beginPath(); -_204.moveTo(x,y); -_204.lineTo(x-this.options.axisTickSize,y); -_204.closePath(); -_204.stroke(); -var _207=DIV(_205,tick[1]); -_207.style.top=(y-this.options.axisLabelFontSize)+"px"; -_207.style.left=(x-this.options.padding.left-this.options.axisTickSize)+"px"; -_207.style.textAlign="right"; -_207.style.width=(this.options.padding.left-this.options.axisTickSize*2)+"px"; -MochiKit.DOM.appendChildNodes(this.container,_207); -this.ylabels.push(_207); -}; -MochiKit.Iter.forEach(this.layout.yticks,bind(_206,this)); -} -_204.beginPath(); -_204.moveTo(this.area.x,this.area.y); -_204.lineTo(this.area.x,this.area.y+this.area.h); -_204.closePath(); -_204.stroke(); -} -if(this.options.drawXAxis){ -if(this.layout.xticks){ -var _206=function(tick){ -if(typeof (dataset)=="function"){ -return; -} -var x=this.area.x+tick[0]*this.area.w; -var y=this.area.y+this.area.h; -_204.beginPath(); -_204.moveTo(x,y); -_204.lineTo(x,y+this.options.axisTickSize); -_204.closePath(); -_204.stroke(); -var _208=DIV(_205,tick[1]); -_208.style.top=(y+this.options.axisTickSize)+"px"; -_208.style.left=(x-this.options.axisLabelWidth/2)+"px"; -_208.style.textAlign="center"; -_208.style.width=this.options.axisLabelWidth+"px"; -MochiKit.DOM.appendChildNodes(this.container,_208); -this.xlabels.push(_208); -}; -MochiKit.Iter.forEach(this.layout.xticks,bind(_206,this)); -} -_204.beginPath(); -_204.moveTo(this.area.x,this.area.y+this.area.h); -_204.lineTo(this.area.x+this.area.w,this.area.y+this.area.h); -_204.closePath(); -_204.stroke(); -} -_204.restore(); -}; -PlotKit.CanvasRenderer.prototype._renderPieAxis=function(){ -if(!this.options.drawXAxis){ -return; -} -if(this.layout.xticks){ -var _209=new Array(); -for(var i=0;iMath.PI*2){ -_216=_216-Math.PI*2; -}else{ -if(_216<0){ -_216=_216+Math.PI*2; -} -} -var _217=_210+Math.sin(_216)*(_212+10); -var _218=_211-Math.cos(_216)*(_212+10); -var _219={"position":"absolute","zIndex":11,"width":_213+"px","fontSize":this.options.axisLabelFontSize+"px","overflow":"hidden","color":this.options.axisLabelColor.toHexString()}; -if(_216<=Math.PI*0.5){ -_219["textAlign"]="left"; -_219["verticalAlign"]="top"; -_219["left"]=_217+"px"; -_219["top"]=(_218-this.options.axisLabelFontSize)+"px"; -}else{ -if((_216>Math.PI*0.5)&&(_216<=Math.PI)){ -_219["textAlign"]="left"; -_219["verticalAlign"]="bottom"; -_219["left"]=_217+"px"; -_219["top"]=_218+"px"; -}else{ -if((_216>Math.PI)&&(_216<=Math.PI*1.5)){ -_219["textAlign"]="right"; -_219["verticalAlign"]="bottom"; -_219["left"]=(_217-_213)+"px"; -_219["top"]=_218+"px"; -}else{ -_219["textAlign"]="right"; -_219["verticalAlign"]="bottom"; -_219["left"]=(_217-_213)+"px"; -_219["top"]=(_218-this.options.axisLabelFontSize)+"px"; -} -} -} -var _220=DIV({"style":_219},this.layout.xticks[i][1]); -this.xlabels.push(_220); -MochiKit.DOM.appendChildNodes(this.container,_220); -} -} -}; -PlotKit.CanvasRenderer.prototype._renderBackground=function(){ -var _221=this.element.getContext("2d"); -_221.save(); -_221.fillStyle=this.options.backgroundColor.toRGBString(); -_221.fillRect(0,0,this.width,this.height); -_221.restore(); -}; -PlotKit.CanvasRenderer.prototype.clear=function(){ -if(this.isIE){ -try{ -if(this.clearDelay){ -this.clearDelay.cancel(); -this.clearDelay=null; -} -var _222=this.element.getContext("2d"); -} -catch(e){ -this.isFirstRender=false; -this.clearDelay=MochiKit.Async.wait(this.IEDelay); -this.clearDelay.addCallback(bind(this.clear,this)); -return; -} -} -var _222=this.element.getContext("2d"); -_222.clearRect(0,0,this.width,this.height); -MochiKit.Iter.forEach(this.xlabels,MochiKit.DOM.removeElement); -MochiKit.Iter.forEach(this.ylabels,MochiKit.DOM.removeElement); -this.xlabels=new Array(); -this.ylabels=new Array(); -}; -PlotKit.CanvasRenderer.prototype._initialiseEvents=function(){ -var _223=MochiKit.Signal.connect; -var bind=MochiKit.Base.bind; -_223(this.element,"onclick",bind(this.onclick,this)); -}; -PlotKit.CanvasRenderer.prototype._resolveObject=function(e){ -var x=(e.mouse().page.x-PlotKit.Base.findPosX(this.element)-this.area.x)/this.area.w; -var y=(e.mouse().page.y-PlotKit.Base.findPosY(this.element)-this.area.y)/this.area.h; -var _225=this.layout.hitTest(x,y); -if(_225){ -return _225; -} -return null; -}; -PlotKit.CanvasRenderer.prototype._createEventObject=function(_226,e){ -if(_226==null){ -return null; -} -e.chart=_226; -return e; -}; -PlotKit.CanvasRenderer.prototype.onclick=function(e){ -var _227=this._resolveObject(e); -var _228=this._createEventObject(_227,e); -if(_228!=null){ -MochiKit.Signal.signal(this,"onclick",_228); -} -}; -PlotKit.CanvasRenderer.prototype.onmouseover=function(e){ -var _229=this._resolveObject(e); -var _230=this._createEventObject(_229,e); -if(_230!=null){ -signal(this,"onmouseover",_230); -} -}; -PlotKit.CanvasRenderer.prototype.onmouseout=function(e){ -var _231=this._resolveObject(e); -var _232=this._createEventObject(_231,e); -if(_232==null){ -signal(this,"onmouseout",e); -}else{ -signal(this,"onmouseout",_232); -} -}; -PlotKit.CanvasRenderer.prototype.onmousemove=function(e){ -var _233=this._resolveObject(e); -var _234=this._createEventObject(_233,e); -if((_233==null)&&(this.event_isinside==null)){ -return; -} -if((_233!=null)&&(this.event_isinside==null)){ -signal(this,"onmouseover",_234); -} -if((_233==null)&&(this.event_isinside!=null)){ -signal(this,"onmouseout",_234); -} -if((_233!=null)&&(this.event_isinside!=null)){ -signal(this,"onmousemove",_234); -} -this.event_isinside=_233; -}; -PlotKit.CanvasRenderer.isSupported=function(_235){ -var _236=null; -try{ -if(MochiKit.Base.isUndefinedOrNull(_235)){ -_236=MochiKit.DOM.CANVAS({}); -}else{ -_236=MochiKit.DOM.getElement(_235); -} -var _237=_236.getContext("2d"); -} -catch(e){ -var ie=navigator.appVersion.match(/MSIE (\d\.\d)/); -var _239=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1); -if((!ie)||(ie[1]<6)||(_239)){ -return false; -} -return true; -} -return true; -}; -PlotKit.Canvas={}; -PlotKit.Canvas.CanvasRenderer=PlotKit.CanvasRenderer; -PlotKit.Canvas.EXPORT=["CanvasRenderer"]; -PlotKit.Canvas.EXPORT_OK=["CanvasRenderer"]; -PlotKit.Canvas.__new__=function(){ -var m=MochiKit.Base; -m.nameFunctions(this); -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -}; -PlotKit.Canvas.__new__(); -MochiKit.Base._exportSymbols(this,PlotKit.Canvas); -try{ -if(typeof (PlotKit.Layout)=="undefined"){ -throw ""; -} -} -catch(e){ -throw "PlotKit depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.Layout"; -} -PlotKit.SVGRenderer=function(_240,_241,_242){ -if(arguments.length>0){ -this.__init__(_240,_241,_242); -} -}; -PlotKit.SVGRenderer.NAME="PlotKit.SVGRenderer"; -PlotKit.SVGRenderer.VERSION=PlotKit.VERSION; -PlotKit.SVGRenderer.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -PlotKit.SVGRenderer.toString=function(){ -return this.__repr__(); -}; -PlotKit.SVGRenderer.SVGNS="http://www.w3.org/2000/svg"; -PlotKit.SVGRenderer.prototype.__init__=function(_243,_244,_245){ -var _246=MochiKit.Base.isUndefinedOrNull; -this.options={"drawBackground":true,"backgroundColor":Color.whiteColor(),"padding":{left:30,right:30,top:5,bottom:10},"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[1]),"strokeColor":Color.whiteColor(),"strokeColorTransform":"asStrokeColor","strokeWidth":0.5,"shouldFill":true,"shouldStroke":true,"drawXAxis":true,"drawYAxis":true,"axisLineColor":Color.blackColor(),"axisLineWidth":0.5,"axisTickSize":3,"axisLabelColor":Color.blackColor(),"axisLabelFont":"Arial","axisLabelFontSize":9,"axisLabelWidth":50,"axisLabelUseDiv":true,"pieRadius":0.4,"enableEvents":true}; -MochiKit.Base.update(this.options,_245?_245:{}); -this.layout=_244; -this.element=MochiKit.DOM.getElement(_243); -this.container=this.element.parentNode; -this.height=parseInt(this.element.getAttribute("height")); -this.width=parseInt(this.element.getAttribute("width")); -this.document=document; -this.root=this.element; -try{ -this.document=this.element.getSVGDocument(); -this.root=_246(this.document.documentElement)?this.element:this.document.documentElement; -} -catch(e){ -} -this.element.style.zIndex=1; -if(_246(this.element)){ -throw "SVGRenderer() - passed SVG object is not found"; -} -if(_246(this.container)||this.container.nodeName.toLowerCase()!="div"){ -throw "SVGRenderer() - No DIV's around the SVG."; -} -this.xlabels=new Array(); -this.ylabels=new Array(); -this.defs=this.createSVGElement("defs"); -this.area={x:this.options.padding.left,y:this.options.padding.top,w:this.width-this.options.padding.left-this.options.padding.right,h:this.height-this.options.padding.top-this.options.padding.bottom}; -MochiKit.DOM.updateNodeAttributes(this.container,{"style":{"position":"relative","width":this.width+"px"}}); -}; -PlotKit.SVGRenderer.prototype.render=function(){ -if(this.options.drawBackground){ -this._renderBackground(); -} -if(this.layout.style=="bar"){ -this._renderBarChart(); -this._renderBarAxis(); -}else{ -if(this.layout.style=="pie"){ -this._renderPieChart(); -this._renderPieAxis(); -}else{ -if(this.layout.style=="line"){ -this._renderLineChart(); -this._renderLineAxis(); -} -} -} -}; -PlotKit.SVGRenderer.prototype._renderBarOrLine=function(data,_247,_248,_249){ -var _250=this.options.colorScheme.length; -var _251=this.options.colorScheme; -var _252=MochiKit.Base.keys(this.layout.datasets); -var _253=_252.length; -for(var i=0;i<_253;i++){ -var _254=_252[i]; -var _255=new Array(); -var _256=_251[i%_250]; -if(this.options.shouldFill){ -_255["fill"]=_256.toRGBString(); -}else{ -_255["fill"]="none"; -} -if(this.options.shouldStroke&&(this.options.strokeColor||this.options.strokeColorTransform)){ -if(this.options.strokeColor){ -_255["stroke"]=this.options.strokeColor.toRGBString(); -}else{ -if(this.options.strokeColorTransform){ -_255["stroke"]=_256[this.options.strokeColorTransform]().toRGBString(); -} -} -_255["strokeWidth"]=this.options.strokeWidth; -} -if(_248){ -_248(_255); -} -var _257=function(obj){ -if(obj.name==_254){ -_247(_255,obj); -} -}; -MochiKit.Iter.forEach(data,bind(_257,this)); -if(_249){ -_249(_255); -} -} -}; -PlotKit.SVGRenderer.prototype._renderBarChart=function(){ -var bind=MochiKit.Base.bind; -var _258=function(_259,bar){ -var x=this.area.w*bar.x+this.area.x; -var y=this.area.h*bar.y+this.area.y; -var w=this.area.w*bar.w; -var h=this.area.h*bar.h; -this._drawRect(x,y,w,h,_259); -}; -this._renderBarOrLine(this.layout.bars,bind(_258,this)); -}; -PlotKit.SVGRenderer.prototype._renderLineChart=function(){ -var bind=MochiKit.Base.bind; -var _260=function(_261,_262){ -this._tempPointsBuffer+=(this.area.w*_262.x+this.area.x)+","+(this.area.h*_262.y+this.area.y)+" "; -}; -var _263=function(_264){ -this._tempPointsBuffer=""; -this._tempPointsBuffer+=(this.area.x)+","+(this.area.y+this.area.h)+" "; -}; -var _265=function(_266){ -this._tempPointsBuffer+=(this.area.w+this.area.x)+","+(this.area.h+this.area.y); -_266["points"]=this._tempPointsBuffer; -var elem=this.createSVGElement("polygon",_266); -this.root.appendChild(elem); -}; -this._renderBarOrLine(this.layout.points,bind(_260,this),bind(_263,this),bind(_265,this)); -}; -PlotKit.SVGRenderer.prototype._renderPieChart=function(){ -var _268=this.options.colorScheme.length; -var _269=this.layout.slices; -var _270=this.area.x+this.area.w*0.5; -var _271=this.area.y+this.area.h*0.5; -var _272=Math.min(this.area.w*this.options.pieRadius,this.area.h*this.options.pieRadius); -if(_269.length==1&&(Math.abs(_269[0].startAngle)-Math.abs(_269[0].endAngle)<0.1)){ -var _273={"cx":_270,"cy":_271,"r":_272}; -var _274=this.options.colorScheme[0]; -if(this.options.shouldFill){ -_273["fill"]=_274.toRGBString(); -}else{ -_273["fill"]="none"; -} -if(this.options.shouldStroke&&(this.options.strokeColor||this.options.strokeColorTransform)){ -if(this.options.strokeColor){ -_273["stroke"]=this.options.strokeColor.toRGBString(); -}else{ -if(this.options.strokeColorTransform){ -_273["stroke"]=_274[this.options.strokeColorTransform]().toRGBString(); -} -} -_273["style"]="stroke-width: "+this.options.strokeWidth; -} -this.root.appendChild(this.createSVGElement("circle",_273)); -return; -} -for(var i=0;i<_269.length;i++){ -var _273=new Array(); -var _274=this.options.colorScheme[i%_268]; -if(this.options.shouldFill){ -_273["fill"]=_274.toRGBString(); -}else{ -_273["fill"]="none"; -} -if(this.options.shouldStroke&&(this.options.strokeColor||this.options.strokeColorTransform)){ -if(this.options.strokeColor){ -_273["stroke"]=this.options.strokeColor.toRGBString(); -}else{ -if(this.options.strokeColorTransform){ -_273["stroke"]=_274[this.options.strokeColorTransform]().toRGBString(); -} -} -_273["style"]="stroke-width:"+this.options.strokeWidth; -} -var _275=0; -if(Math.abs(_269[i].endAngle-_269[i].startAngle)>Math.PI){ -_275=1; -} -var x1=Math.cos(_269[i].startAngle-Math.PI/2)*_272; -var y1=Math.sin(_269[i].startAngle-Math.PI/2)*_272; -var x2=Math.cos(_269[i].endAngle-Math.PI/2)*_272; -var y2=Math.sin(_269[i].endAngle-Math.PI/2)*_272; -var rx=x2-x1; -var ry=y2-y1; -var _282="M"+_270+","+_271+" "; -_282+="l"+x1+","+y1+" "; -_282+="a"+_272+","+_272+" 0 "+_275+",1 "+rx+","+ry+" z"; -_273["d"]=_282; -var elem=this.createSVGElement("path",_273); -this.root.appendChild(elem); -} -}; -PlotKit.SVGRenderer.prototype._renderBarAxis=function(){ -this._renderAxis(); -}; -PlotKit.SVGRenderer.prototype._renderLineAxis=function(){ -this._renderAxis(); -}; -PlotKit.SVGRenderer.prototype._renderAxis=function(){ -if(!this.options.drawXAxis&&!this.options.drawYAxis){ -return; -} -var _283={"style":{"position":"absolute","textAlign":"center","fontSize":this.options.axisLabelFontSize+"px","zIndex":10,"color":this.options.axisLabelColor.toRGBString(),"width":this.options.axisLabelWidth+"px","overflow":"hidden"}}; -var _284={"stroke":this.options.axisLineColor.toRGBString(),"strokeWidth":this.options.axisLineWidth}; -if(this.options.drawYAxis){ -if(this.layout.yticks){ -var _285=function(tick){ -var x=this.area.x; -var y=this.area.y+tick[0]*this.area.h; -this._drawLine(x,y,x-3,y,_284); -if(this.options.axisLabelUseDiv){ -var _286=DIV(_283,tick[1]); -_286.style.top=(y-this.options.axisLabelFontSize)+"px"; -_286.style.left=(x-this.options.padding.left+this.options.axisTickSize)+"px"; -_286.style.textAlign="left"; -_286.style.width=(this.options.padding.left-3)+"px"; -MochiKit.DOM.appendChildNodes(this.container,_286); -this.ylabels.push(_286); -}else{ -var _287={y:y+3,x:(x-this.options.padding.left+3),width:(this.options.padding.left-this.options.axisTickSize)+"px",height:(this.options.axisLabelFontSize+3)+"px",fontFamily:"Arial",fontSize:this.options.axisLabelFontSize+"px",fill:this.options.axisLabelColor.toRGBString()}; -var _286=this.createSVGElement("text",_287); -_286.appendChild(this.document.createTextNode(tick[1])); -this.root.appendChild(_286); -} -}; -MochiKit.Iter.forEach(this.layout.yticks,bind(_285,this)); -} -this._drawLine(this.area.x,this.area.y,this.area.x,this.area.y+this.area.h,_284); -} -if(this.options.drawXAxis){ -if(this.layout.xticks){ -var _285=function(tick){ -var x=this.area.x+tick[0]*this.area.w; -var y=this.area.y+this.area.h; -this._drawLine(x,y,x,y+this.options.axisTickSize,_284); -if(this.options.axisLabelUseDiv){ -var _288=DIV(_283,tick[1]); -_288.style.top=(y+this.options.axisTickSize)+"px"; -_288.style.left=(x-this.options.axisLabelWidth/2)+"px"; -_288.style.textAlign="center"; -_288.style.width=this.options.axisLabelWidth+"px"; -MochiKit.DOM.appendChildNodes(this.container,_288); -this.xlabels.push(_288); -}else{ -var _289={y:(y+this.options.axisTickSize+this.options.axisLabelFontSize),x:x-3,width:this.options.axisLabelWidth+"px",height:(this.options.axisLabelFontSize+3)+"px",fontFamily:"Arial",fontSize:this.options.axisLabelFontSize+"px",fill:this.options.axisLabelColor.toRGBString(),textAnchor:"middle"}; -var _288=this.createSVGElement("text",_289); -_288.appendChild(this.document.createTextNode(tick[1])); -this.root.appendChild(_288); -} -}; -MochiKit.Iter.forEach(this.layout.xticks,bind(_285,this)); -} -this._drawLine(this.area.x,this.area.y+this.area.h,this.area.x+this.area.w,this.area.y+this.area.h,_284); -} -}; -PlotKit.SVGRenderer.prototype._renderPieAxis=function(){ -if(this.layout.xticks){ -var _290=new Array(); -for(var i=0;iMath.PI*2){ -_297=_297-Math.PI*2; -}else{ -if(_297<0){ -_297=_297+Math.PI*2; -} -} -var _298=_291+Math.sin(_297)*(_293+10); -var _299=_292-Math.cos(_297)*(_293+10); -var _300={"position":"absolute","zIndex":11,"width":_294+"px","fontSize":this.options.axisLabelFontSize+"px","overflow":"hidden","color":this.options.axisLabelColor.toHexString()}; -var _301={"width":_294+"px","fontSize":this.options.axisLabelFontSize+"px","height":(this.options.axisLabelFontSize+3)+"px","fill":this.options.axisLabelColor.toRGBString()}; -if(_297<=Math.PI*0.5){ -MochiKit.Base.update(_300,{"textAlign":"left","verticalAlign":"top","left":_298+"px","top":(_299-this.options.axisLabelFontSize)+"px"}); -MochiKit.Base.update(_301,{"x":_298,"y":(_299-this.options.axisLabelFontSize),"textAnchor":"left"}); -}else{ -if((_297>Math.PI*0.5)&&(_297<=Math.PI)){ -MochiKit.Base.update(_300,{"textAlign":"left","verticalAlign":"bottom","left":_298+"px","top":_299+"px"}); -MochiKit.Base.update(_301,{"textAnchor":"left","x":_298,"y":_299}); -}else{ -if((_297>Math.PI)&&(_297<=Math.PI*1.5)){ -MochiKit.Base.update(_300,{"textAlign":"right","verticalAlign":"bottom","left":_298+"px","top":_299+"px"}); -MochiKit.Base.update(_301,{"textAnchor":"right","x":_298-_294,"y":_299}); -}else{ -MochiKit.Base.update(_300,{"textAlign":"left","verticalAlign":"bottom","left":_298+"px","top":_299+"px"}); -MochiKit.Base.update(_301,{"textAnchor":"left","x":_298-_294,"y":_299-this.options.axisLabelFontSize}); -} -} -} -if(this.options.axisLabelUseDiv){ -var _302=DIV({"style":_300},this.layout.xticks[i][1]); -this.xlabels.push(_302); -MochiKit.DOM.appendChildNodes(this.container,_302); -}else{ -var _302=this.createSVGElement("text",_301); -_302.appendChild(this.document.createTextNode(this.layout.xticks[i][1])); -this.root.appendChild(_302); -} -} -} -}; -PlotKit.SVGRenderer.prototype._renderBackground=function(){ -var opts={"stroke":"none","fill":this.options.backgroundColor.toRGBString()}; -this._drawRect(0,0,this.width,this.height,opts); -}; -PlotKit.SVGRenderer.prototype._drawRect=function(x,y,w,h,_304){ -var _305={x:x+"px",y:y+"px",width:w+"px",height:h+"px"}; -if(_304){ -MochiKit.Base.update(_305,_304); -} -var elem=this.createSVGElement("rect",_305); -this.root.appendChild(elem); -}; -PlotKit.SVGRenderer.prototype._drawLine=function(x1,y1,x2,y2,_306){ -var _307={x1:x1+"px",y1:y1+"px",x2:x2+"px",y2:y2+"px"}; -if(_306){ -MochiKit.Base.update(_307,_306); -} -var elem=this.createSVGElement("line",_307); -this.root.appendChild(elem); -}; -PlotKit.SVGRenderer.prototype.clear=function(){ -while(this.element.firstChild){ -this.element.removeChild(this.element.firstChild); -} -if(this.options.axisLabelUseDiv){ -for(var i=0;i=6)&&(!_313)){ -var _314=_312["width"]?_312["width"]:"100"; -var _315=_312["height"]?_312["height"]:"100"; -var eid=_312["id"]?_312["id"]:"notunique"; -var html=""; -var _318=document.createElement(html); -var _319=_318.getSVGDocument().createElementNS(PlotKit.SVGRenderer.SVGNS,"svg"); -_319.setAttribute("width",_314); -_319.setAttribute("height",_315); -_318.getSVGDocument().appendChild(_319); -return _318; -}else{ -return PlotKit.SVGRenderer.prototype.createSVGElement("svg",_312); -} -}; -PlotKit.SVGRenderer.isSupported=function(){ -var _320=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1); -var _321=navigator.appVersion.match(/MSIE (\d\.\d)/); -var _322=navigator.userAgent.match(/AppleWebKit\/(\d+)/); -var _323=navigator.userAgent.match(/Opera\/(\d*\.\d*)/); -var _324=navigator.userAgent.match(/rv:(\d*\.\d*).*Gecko/); -var _325="http://www.w3.org/TR/SVG11/feature#SVG"; -if(_321&&(_321[1]>=6)&&!_320){ -return document.implementation.hasFeature(_325,"1.1"); -} -if(_323&&(_323[1]>8.9)){ -return true; -} -if(_324&&(_324>1.7)){ -return true; -} -return false; -}; -PlotKit.SVG={}; -PlotKit.SVG.SVGRenderer=PlotKit.SVGRenderer; -PlotKit.SVG.EXPORT=["SVGRenderer"]; -PlotKit.SVG.EXPORT_OK=["SVGRenderer"]; -PlotKit.SVG.__new__=function(){ -var m=MochiKit.Base; -m.nameFunctions(this); -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -}; -PlotKit.SVG.__new__(); -MochiKit.Base._exportSymbols(this,PlotKit.SVG); -try{ -if(typeof (PlotKit.CanvasRenderer)=="undefined"){ -throw ""; -} -} -catch(e){ -throw "SweetCanvas depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.{Layout, Canvas}"; -} -if(typeof (PlotKit.SweetCanvasRenderer)=="undefined"){ -PlotKit.SweetCanvasRenderer={}; -} -PlotKit.SweetCanvasRenderer=function(_326,_327,_328){ -if(arguments.length>0){ -this.__init__(_326,_327,_328); -} -}; -PlotKit.SweetCanvasRenderer.NAME="PlotKit.SweetCanvasRenderer"; -PlotKit.SweetCanvasRenderer.VERSION=PlotKit.VERSION; -PlotKit.SweetCanvasRenderer.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -PlotKit.SweetCanvasRenderer.toString=function(){ -return this.__repr__(); -}; -PlotKit.SweetCanvasRenderer.prototype=new PlotKit.CanvasRenderer(); -PlotKit.SweetCanvasRenderer.prototype.constructor=PlotKit.SweetCanvasRenderer; -PlotKit.SweetCanvasRenderer.__super__=PlotKit.CanvasRenderer.prototype; -PlotKit.SweetCanvasRenderer.prototype.__init__=function(el,_330,opts){ -var _331=PlotKit.Base.officeBlue(); -MochiKit.Base.update(_331,opts); -PlotKit.SweetCanvasRenderer.__super__.__init__.call(this,el,_330,_331); -}; -PlotKit.SweetCanvasRenderer.prototype._renderBarChart=function(){ -var bind=MochiKit.Base.bind; -var _332=Color.blackColor().colorWithAlpha(0.1).toRGBString(); -var _333=function(_334,x,y,w,h){ -_334.fillStyle=_332; -_334.fillRect(x-2,y-2,w+4,h+2); -_334.fillStyle=_332; -_334.fillRect(x-1,y-1,w+2,h+1); -}; -var _335=this.options.colorScheme.length; -var _336=this.options.colorScheme; -var _337=PlotKit.Base.keys(this.layout.datasets); -var _338=_337.length; -var _339=function(name){ -for(var i=0;i<_338;i++){ -if(name==_337[i]){ -return _336[i%_335]; -} -} -return _336[0]; -}; -var _340=function(_341,bar){ -var x=this.area.w*bar.x+this.area.x; -var y=this.area.h*bar.y+this.area.y; -var w=this.area.w*bar.w; -var h=this.area.h*bar.h; -if((w<1)||(h<1)){ -return; -} -_341.save(); -_341.shadowBlur=5; -_341.shadowColor=Color.fromHexString("#888888").toRGBString(); -if(this.isIE){ -_341.save(); -_341.fillStyle="#cccccc"; -_341.fillRect(x-2,y-2,w+4,h+2); -_341.restore(); -}else{ -_333(_341,x,y,w,h); -} -if(this.options.shouldFill){ -_341.fillStyle=_339(bar.name).toRGBString(); -_341.fillRect(x,y,w,h); -} -_341.shadowBlur=0; -_341.strokeStyle=Color.whiteColor().toRGBString(); -_341.lineWidth=2; -if(this.options.shouldStroke){ -_341.strokeRect(x,y,w,h); -} -_341.restore(); -}; -this._renderBarChartWrap(this.layout.bars,bind(_340,this)); -}; -PlotKit.SweetCanvasRenderer.prototype._renderLineChart=function(){ -var _342=this.element.getContext("2d"); -var _343=this.options.colorScheme.length; -var _344=this.options.colorScheme; -var _345=PlotKit.Base.keys(this.layout.datasets); -var _346=_345.length; -var bind=MochiKit.Base.bind; -for(var i=0;i<_346;i++){ -var _347=_345[i]; -var _348=_344[i%_343]; -var _349=this.options.strokeColorTransform; -_342.save(); -var _350=function(ctx){ -ctx.beginPath(); -ctx.moveTo(this.area.x,this.area.y+this.area.h); -var _351=function(ctx_,_352){ -if(_352.name==_347){ -ctx_.lineTo(this.area.w*_352.x+this.area.x,this.area.h*_352.y+this.area.y); -} -}; -MochiKit.Iter.forEach(this.layout.points,partial(_351,ctx),this); -ctx.lineTo(this.area.w+this.area.x,this.area.h+this.area.y); -ctx.lineTo(this.area.x,this.area.y+this.area.h); -ctx.closePath(); -}; -if(this.options.shouldFill){ -_342.save(); -if(this.isIE){ -_342.fillStyle="#cccccc"; -}else{ -_342.fillStyle=Color.blackColor().colorWithAlpha(0.2).toRGBString(); -} -_342.translate(-1,-2); -bind(_350,this)(_342); -if(this.options.shouldFill){ -_342.fill(); -} -_342.restore(); -} -_342.shadowBlur=5; -_342.shadowColor=Color.fromHexString("#888888").toRGBString(); -_342.fillStyle=_348.toRGBString(); -_342.lineWidth=2; -_342.strokeStyle=Color.whiteColor().toRGBString(); -if(this.options.shouldFill){ -bind(_350,this)(_342); -_342.fill(); -} -if(this.options.shouldStroke){ -bind(_350,this)(_342); -_342.stroke(); -} -_342.restore(); -} -}; -PlotKit.SweetCanvasRenderer.prototype._renderPieChart=function(){ -var _353=this.element.getContext("2d"); -var _354=this.options.colorScheme.length; -var _355=this.layout.slices; -var _356=this.area.x+this.area.w*0.5; -var _357=this.area.y+this.area.h*0.5; -var _358=Math.min(this.area.w*this.options.pieRadius,this.area.h*this.options.pieRadius); -if(this.isIE){ -_356=parseInt(_356); -_357=parseInt(_357); -_358=parseInt(_358); -} -if(!this.isIE){ -_353.save(); -var _359=Color.blackColor().colorWithAlpha(0.2); -_353.fillStyle=_359.toRGBString(); -_353.shadowBlur=5; -_353.shadowColor=Color.fromHexString("#888888").toRGBString(); -_353.translate(1,1); -_353.beginPath(); -_353.moveTo(_356,_357); -_353.arc(_356,_357,_358+2,0,Math.PI*2,false); -_353.closePath(); -_353.fill(); -_353.restore(); -} -_353.save(); -_353.strokeStyle=Color.whiteColor().toRGBString(); -_353.lineWidth=2; -for(var i=0;i<_355.length;i++){ -var _360=this.options.colorScheme[i%_354]; -_353.fillStyle=_360.toRGBString(); -var _361=function(){ -_353.beginPath(); -_353.moveTo(_356,_357); -_353.arc(_356,_357,_358,_355[i].startAngle-Math.PI/2,_355[i].endAngle-Math.PI/2,false); -_353.lineTo(_356,_357); -_353.closePath(); -}; -if(Math.abs(_355[i].startAngle-_355[i].endAngle)>0.0001){ -if(this.options.shouldFill){ -_361(); -_353.fill(); -} -if(this.options.shouldStroke){ -_361(); -_353.stroke(); -} -} -} -_353.restore(); -}; -PlotKit.SweetCanvasRenderer.prototype._renderBackground=function(){ -var _362=this.element.getContext("2d"); -if(this.layout.style=="bar"||this.layout.style=="line"){ -_362.save(); -_362.fillStyle=this.options.backgroundColor.toRGBString(); -_362.fillRect(this.area.x,this.area.y,this.area.w,this.area.h); -_362.strokeStyle=this.options.axisLineColor.toRGBString(); -_362.lineWidth=1; -var _363=this.layout.yticks; -var _364=false; -if(this.layout.style=="bar"&&this.layout.options.barOrientation=="horizontal"){ -_363=this.layout.xticks; -_364=true; -} -for(var i=0;i<_363.length;i++){ -var x1=0; -var y1=0; -var x2=0; -var y2=0; -if(_364){ -x1=_363[i][0]*this.area.w+this.area.x; -y1=this.area.y; -x2=x1; -y2=y1+this.area.h; -}else{ -x1=this.area.x; -y1=_363[i][0]*this.area.h+this.area.y; -x2=x1+this.area.w; -y2=y1; -} -_362.beginPath(); -_362.moveTo(x1,y1); -_362.lineTo(x2,y2); -_362.closePath(); -_362.stroke(); -} -_362.restore(); -}else{ -PlotKit.SweetCanvasRenderer.__super__._renderBackground.call(this); -} -}; -PlotKit.SweetCanvas={}; -PlotKit.SweetCanvas.SweetCanvasRenderer=PlotKit.SweetCanvasRenderer; -PlotKit.SweetCanvas.EXPORT=["SweetCanvasRenderer"]; -PlotKit.SweetCanvas.EXPORT_OK=["SweetCanvasRenderer"]; -PlotKit.SweetCanvas.__new__=function(){ -var m=MochiKit.Base; -m.nameFunctions(this); -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -}; -PlotKit.SweetCanvas.__new__(); -MochiKit.Base._exportSymbols(this,PlotKit.SweetCanvas); -try{ -if(typeof (PlotKit.SVGRenderer)=="undefined"){ -throw ""; -} -} -catch(e){ -throw "SweetSVG depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.{Layout, SVG}"; -} -if(typeof (PlotKit.SweetSVGRenderer)=="undefined"){ -PlotKit.SweetSVGRenderer={}; -} -PlotKit.SweetSVGRenderer=function(_365,_366,_367){ -if(arguments.length>0){ -this.__init__(_365,_366,_367); -} -}; -PlotKit.SweetSVGRenderer.NAME="PlotKit.SweetSVGRenderer"; -PlotKit.SweetSVGRenderer.VERSION=PlotKit.VERSION; -PlotKit.SweetSVGRenderer.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -PlotKit.SweetSVGRenderer.toString=function(){ -return this.__repr__(); -}; -PlotKit.SweetSVGRenderer.prototype=new PlotKit.SVGRenderer(); -PlotKit.SweetSVGRenderer.prototype.constructor=PlotKit.SweetSVGRenderer; -PlotKit.SweetSVGRenderer.__super__=PlotKit.SVGRenderer.prototype; -PlotKit.SweetSVGRenderer.prototype.__init__=function(_368,_369,_370){ -var _371=PlotKit.Base.officeBlue(); -MochiKit.Base.update(_371,_370); -PlotKit.SweetSVGRenderer.__super__.__init__.call(this,_368,_369,_371); -}; -PlotKit.SweetSVGRenderer.prototype._addDropShadowFilter=function(){ -var _372=this.createSVGElement("filter",{x:0,y:0,"id":"dropShadow"}); -var _373=this.createSVGElement("feOffset",{"in":"SourceGraphic","dx":0,"dy":0,"result":"topCopy"}); -var blur=this.createSVGElement("feGaussianBlur",{"in":"SourceAlpha","StdDeviation":2,"result":"shadow"}); -var _375=this.createSVGElement("feOffset",{"in":"shadow","dx":-1,"dy":-2,"result":"movedShadow"}); -var _376=this.createSVGElement("feMerge"); -var _377=this.createSVGElement("feMergeNode",{"in":"topCopy"}); -var _378=this.createSVGElement("feMergeNode",{"in":"movedShadow"}); -_376.appendChild(_377); -_376.appendChild(_378); -_372.appendChild(_373); -_372.appendChild(blur); -_372.appendChild(_375); -_372.appendChild(_376); -this.defs.appendChild(_372); -}; -PlotKit.SweetSVGRenderer.prototype._renderBarChart=function(){ -var bind=MochiKit.Base.bind; -var _379=Color.blackColor().toRGBString(); -var _380="fill:"+_379+";fill-opacity:0.15"; -var _381="stroke-width: 2.0; stroke:"+Color.whiteColor().toRGBString(); -var _382=function(_383,bar){ -var x=this.area.w*bar.x+this.area.x; -var y=this.area.h*bar.y+this.area.y; -var w=this.area.w*bar.w; -var h=this.area.h*bar.h; -if((w<1)||(h<1)){ -return; -} -_383["style"]=_381; -this._drawRect(x-2,y-1,w+4,h+2,{"style":_380}); -this._drawRect(x,y,w,h,_383); -}; -this._renderBarOrLine(this.layout.bars,bind(_382,this)); -}; -PlotKit.SweetSVGRenderer.prototype._renderLineChart=function(){ -var bind=MochiKit.Base.bind; -var _384=Color.blackColor().toRGBString(); -var _385="fill:"+_384+";fill-opacity:0.15"; -var _386="stroke-width: 2.0; stroke:"+Color.whiteColor().toRGBString(); -var _387=function(_388,_389){ -this._tempPointsBuffer+=(this.area.w*_389.x+this.area.x)+","+(this.area.h*_389.y+this.area.y)+" "; -}; -var _390=function(_391){ -this._tempPointsBuffer=""; -this._tempPointsBuffer+=(this.area.x)+","+(this.area.y+this.area.h)+" "; -}; -var _392=function(_393){ -this._tempPointsBuffer+=(this.area.w+this.area.x)+","+(this.area.h+this.area.y); -_393["points"]=this._tempPointsBuffer; -_393["stroke"]="none"; -_393["transform"]="translate(-2, -1)"; -_393["style"]=_385; -var _394=this.createSVGElement("polygon",_393); -this.root.appendChild(_394); -_393["transform"]=""; -_393["style"]=_386; -var elem=this.createSVGElement("polygon",_393); -this.root.appendChild(elem); -}; -this._renderBarOrLine(this.layout.points,bind(_387,this),bind(_390,this),bind(_392,this)); -}; -PlotKit.SweetSVGRenderer.prototype._renderPieChart=function(){ -var _395=this.area.x+this.area.w*0.5; -var _396=this.area.y+this.area.h*0.5; -var _397=Color.blackColor().toRGBString(); -var _398=Math.min(this.area.w*this.options.pieRadius,this.area.h*this.options.pieRadius); -var _399="fill:"+_397+";fill-opacity:0.15"; -var _400=this.createSVGElement("circle",{"style":_399,"cx":_395+1,"cy":_396+1,"r":_398+1}); -this.root.appendChild(_400); -PlotKit.SweetSVGRenderer.__super__._renderPieChart.call(this); -}; -PlotKit.SweetSVGRenderer.prototype._renderBackground=function(){ -var _401={"fill":this.options.backgroundColor.toRGBString(),"stroke":"none"}; -if(this.layout.style=="bar"||this.layout.style=="line"){ -this._drawRect(this.area.x,this.area.y,this.area.w,this.area.h,_401); -var _402=this.layout.yticks; -var _403=false; -if(this.layout.style=="bar"&&this.layout.options.barOrientation=="horizontal"){ -_402=this.layout.xticks; -_403=true; -} -for(var i=0;i<_402.length;i++){ -var x=0; -var y=0; -var w=0; -var h=0; -if(_403){ -x=_402[i][0]*this.area.w+this.area.x; -y=this.area.y; -w=1; -h=this.area.w; -}else{ -x=this.area.x; -y=_402[i][0]*this.area.h+this.area.y; -w=this.area.w; -h=1; -} -this._drawRect(x,y,w,h,{"fill":this.options.axisLineColor.toRGBString()}); -} -}else{ -PlotKit.SweetSVGRenderer.__super__._renderBackground.call(this); -} -}; -PlotKit.SweetSVG={}; -PlotKit.SweetSVG.SweetSVGRenderer=PlotKit.SweetSVGRenderer; -PlotKit.SweetSVG.EXPORT=["SweetSVGRenderer"]; -PlotKit.SweetSVG.EXPORT_OK=["SweetSVGRenderer"]; -PlotKit.SweetSVG.__new__=function(){ -var m=MochiKit.Base; -m.nameFunctions(this); -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -}; -PlotKit.SweetSVG.__new__(); -MochiKit.Base._exportSymbols(this,PlotKit.SweetSVG); -try{ -if(typeof (PlotKit.CanvasRenderer)=="undefined"){ -throw ""; -} -} -catch(e){ -throw "PlotKit.EasyPlot depends on all of PlotKit's components"; -} -if(typeof (PlotKit.EasyPlot)=="undefined"){ -PlotKit.EasyPlot={}; -} -PlotKit.EasyPlot.NAME="PlotKit.EasyPlot"; -PlotKit.EasyPlot.VERSION=PlotKit.VERSION; -PlotKit.EasyPlot.__repr__=function(){ -return "["+this.NAME+" "+this.VERSION+"]"; -}; -PlotKit.EasyPlot.toString=function(){ -return this.__repr__(); -}; -PlotKit.EasyPlot=function(_404,_405,_406,_407){ -this.layout=new Layout(_404,_405); -this.divElem=_406; -this.width=parseInt(_406.getAttribute("width")); -this.height=parseInt(_406.getAttribute("height")); -this.deferredCount=0; -if(this.width<1){ -this.width=this.divElem.width?this.divElem.width:300; -} -if(this.height<1){ -this.height=this.divElem.height?this.divElem.height:300; -} -if(isArrayLike(_407)){ -for(var i=0;i<_407.length;i++){ -if(typeof (_407[i])=="string"){ -this.deferredCount++; -var d=MochiKit.Async.doSimpleXMLHttpRequest(_407[i]); -d.addCallback(MochiKit.Base.bind(PlotKit.EasyPlot.onDataLoaded,this)); -}else{ -if(isArrayLike(_407[i])){ -this.layout.addDataset("data-"+i,_407[i]); -} -} -} -}else{ -if(!isUndefinedOrNull(_407)){ -throw "Passed datasources are not Array like"; -} -} -if(CanvasRenderer.isSupported()){ -this.element=CANVAS({"id":this.divElem.getAttribute("id")+"-canvas","width":this.width,"height":this.height},""); -this.divElem.appendChild(this.element); -this.renderer=new SweetCanvasRenderer(this.element,this.layout,_405); -}else{ -if(SVGRenderer.isSupported()){ -this.element=SVGRenderer.SVG({"id":this.divElem.getAttribute("id")+"-svg","width":this.width,"height":this.height,"version":"1.1","baseProfile":"full"},""); -this.divElem.appendChild(this.element); -this.renderer=new SweetSVGRenderer(this.element,this.layout,_405); -} -} -if((this.deferredCount==0)&&(PlotKit.Base.keys(this.layout.datasets).length>0)){ -this.layout.evaluate(); -this.renderer.clear(); -this.renderer.render(); -} -}; -PlotKit.EasyPlot.onDataLoaded=function(_409){ -var _410=new Array(); -var _411=_409.responseText.split("\n"); -for(var i=0;i<_411.length;i++){ -var _412=MochiKit.Format.strip(_411[i]); -if((_412.length>1)&&(_412.charAt(0)!="#")){ -_410.push(_412.split(",")); -} -} -this.layout.addDataset("data-ajax-"+this.deferredCount,_410); -this.deferredCount--; -if((this.deferredCount==0)&&(PlotKit.Base.keys(this.layout.datasets).length>0)){ -this.layout.evaluate(); -this.renderer.clear(); -this.renderer.render(); -} -}; -PlotKit.EasyPlot.prototype.reload=function(){ -this.layout.evaluate(); -this.renderer.clear(); -this.renderer.render(); -}; -PlotKit.EasyPlotModule={}; -PlotKit.EasyPlotModule.EasyPlot=PlotKit.EasyPlot; -PlotKit.EasyPlotModule.EXPORT=["EasyPlot"]; -PlotKit.EasyPlotModule.EXPORT_OK=[]; -PlotKit.EasyPlotModule.__new__=function(){ -var m=MochiKit.Base; -m.nameFunctions(this); -this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; -}; -PlotKit.EasyPlotModule.__new__(); -MochiKit.Base._exportSymbols(this,PlotKit.EasyPlotModule); - - diff --git a/applications/luci-livestats/luasrc/controller/livestats.lua b/applications/luci-livestats/luasrc/controller/livestats.lua deleted file mode 100644 index 618c2c50a..000000000 --- a/applications/luci-livestats/luasrc/controller/livestats.lua +++ /dev/null @@ -1,31 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2008 Steven Barth -Copyright 2008 Jo-Philipp Wich - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ -]]-- - -module("luci.controller.livestats", package.seeall) - -function index() - require("luci.i18n") - luci.i18n.loadc("livestats") - local i18n = luci.i18n.translate - - entry( {"admin", "status", "livestats"}, alias("admin", "status", "livestats", "wifistat"), i18n("Realtime Status"), 90 ).i18n = "livestats" - entry( {"admin", "status", "livestats", "wifistat"}, template("livestats/wireless"), i18n("Wireless"), 10 ) - entry( {"admin", "status", "livestats", "trafstat"}, template("livestats/traffic"), i18n("Traffic"), 20 ) - entry( {"admin", "status", "livestats", "loadavg"}, template("livestats/loadavg"), i18n("System Load"), 30 ) - - entry( {"mini", "network", "wifistat"}, template("livestats/wireless"), i18n("Realtime Wireless Status"), 90 ).i18n = "livestats" - entry( {"mini", "network", "trafstat"}, template("livestats/traffic"), i18n("Realtime Traffic Status"), 91 ).i18n = "livestats" - entry( {"mini", "system", "loadavg"}, template("livestats/loadavg"), i18n("Realtime Load Status"), 92 ).i18n = "livestats" -end diff --git a/applications/luci-livestats/luasrc/view/livestats/loadavg.htm b/applications/luci-livestats/luasrc/view/livestats/loadavg.htm deleted file mode 100644 index 1f45f988d..000000000 --- a/applications/luci-livestats/luasrc/view/livestats/loadavg.htm +++ /dev/null @@ -1,33 +0,0 @@ -<%+header%> - - - - - - - - - - -
-<%+footer%> diff --git a/applications/luci-livestats/luasrc/view/livestats/traffic.htm b/applications/luci-livestats/luasrc/view/livestats/traffic.htm deleted file mode 100644 index 420ceb905..000000000 --- a/applications/luci-livestats/luasrc/view/livestats/traffic.htm +++ /dev/null @@ -1,66 +0,0 @@ -<%+header%> - - - - - - - - -<% - local interfaces = { } - local ifnames = {} - local uci = luci.model.uci.cursor_state() - - uci:foreach("network", "interface", - function(s) - if s.ifname ~= "lo" then - table.insert( interfaces, - "'" .. ( s.ifname or s['.name'] ) .. "'" - ) - ifnames[s.ifname or s['.name']] = s['.name'] - end - end - ) --%> - - - -
- -<%+footer%> diff --git a/applications/luci-livestats/luasrc/view/livestats/wireless.htm b/applications/luci-livestats/luasrc/view/livestats/wireless.htm deleted file mode 100644 index e675cfa37..000000000 --- a/applications/luci-livestats/luasrc/view/livestats/wireless.htm +++ /dev/null @@ -1,43 +0,0 @@ -<%+header%> - - - - - - - - - - -
- -<%+footer%> diff --git a/contrib/package/luci/Makefile b/contrib/package/luci/Makefile index cf6e71e63..86a6fef65 100644 --- a/contrib/package/luci/Makefile +++ b/contrib/package/luci/Makefile @@ -395,9 +395,6 @@ $(eval $(call application,tinyproxy,Tinyproxy - HTTP(S)-Proxy configuration,\ $(eval $(call application,initmgr,LuCI Initscript Management,\ +luci-mod-admin-full)) -$(eval $(call application,livestats,LuCI Realtime Statistics,\ - +luci-mod-rpc)) - $(eval $(call application,polipo,LuCI Support for the Polipo Proxy,\ +PACKAGE_luci-app-polipo:polipo)) -- 2.25.1