Best JavaScript code snippet using fast-check-monorepo
jquery.flot.min.js
Source:jquery.flot.min.js
1/* Javascript plotting library for jQuery, v. 0.7.2 *3 * Released under the MIT license by IOLA, December 2007.4 *5 */6(function(b) { b.color = {};7 b.color.make = function(d, e, g, f) { var c = {};8 c.r = d || 0;9 c.g = e || 0;10 c.b = g || 0;11 c.a = f != null ? f : 1;12 c.add = function(h, j) { for (var k = 0; k < h.length; ++k) { c[h.charAt(k)] += j } return c.normalize() };13 c.scale = function(h, j) { for (var k = 0; k < h.length; ++k) { c[h.charAt(k)] *= j } return c.normalize() };14 c.toString = function() { if (c.a >= 1) { return "rgb(" + [c.r, c.g, c.b].join(",") + ")" } else { return "rgba(" + [c.r, c.g, c.b, c.a].join(",") + ")" } };15 c.normalize = function() {16 function h(k, j, l) { return j < k ? k : (j > l ? l : j) } c.r = h(0, parseInt(c.r), 255);17 c.g = h(0, parseInt(c.g), 255);18 c.b = h(0, parseInt(c.b), 255);19 c.a = h(0, c.a, 1); return c };20 c.clone = function() { return b.color.make(c.r, c.b, c.g, c.a) }; return c.normalize() };21 b.color.extract = function(d, e) { var c;22 do { c = d.css(e).toLowerCase(); if (c != "" && c != "transparent") { break } d = d.parent() } while (!b.nodeName(d.get(0), "body")); if (c == "rgba(0, 0, 0, 0)") { c = "transparent" } return b.color.parse(c) };23 b.color.parse = function(c) { var d, f = b.color.make; if (d = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c)) { return f(parseInt(d[1], 10), parseInt(d[2], 10), parseInt(d[3], 10)) } if (d = /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(c)) { return f(parseInt(d[1], 10), parseInt(d[2], 10), parseInt(d[3], 10), parseFloat(d[4])) } if (d = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c)) { return f(parseFloat(d[1]) * 2.55, parseFloat(d[2]) * 2.55, parseFloat(d[3]) * 2.55) } if (d = /rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(c)) { return f(parseFloat(d[1]) * 2.55, parseFloat(d[2]) * 2.55, parseFloat(d[3]) * 2.55, parseFloat(d[4])) } if (d = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c)) { return f(parseInt(d[1], 16), parseInt(d[2], 16), parseInt(d[3], 16)) } if (d = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c)) { return f(parseInt(d[1] + d[1], 16), parseInt(d[2] + d[2], 16), parseInt(d[3] + d[3], 16)) } var e = b.trim(c).toLowerCase(); if (e == "transparent") { return f(255, 255, 255, 0) } else { d = a[e] || [0, 0, 0]; return f(d[0], d[1], d[2]) } }; var a = { aqua: [0, 255, 255], azure: [240, 255, 255], beige: [245, 245, 220], black: [0, 0, 0], blue: [0, 0, 255], brown: [165, 42, 42], cyan: [0, 255, 255], darkblue: [0, 0, 139], darkcyan: [0, 139, 139], darkgrey: [169, 169, 169], darkgreen: [0, 100, 0], darkkhaki: [189, 183, 107], darkmagenta: [139, 0, 139], darkolivegreen: [85, 107, 47], darkorange: [255, 140, 0], darkorchid: [153, 50, 204], darkred: [139, 0, 0], darksalmon: [233, 150, 122], darkviolet: [148, 0, 211], fuchsia: [255, 0, 255], gold: [255, 215, 0], green: [0, 128, 0], indigo: [75, 0, 130], khaki: [240, 230, 140], lightblue: [173, 216, 230], lightcyan: [224, 255, 255], lightgreen: [144, 238, 144], lightgrey: [211, 211, 211], lightpink: [255, 182, 193], lightyellow: [255, 255, 224], lime: [0, 255, 0], magenta: [255, 0, 255], maroon: [128, 0, 0], navy: [0, 0, 128], olive: [128, 128, 0], orange: [255, 165, 0], pink: [255, 192, 203], purple: [128, 0, 128], violet: [128, 0, 128], red: [255, 0, 0], silver: [192, 192, 192], white: [255, 255, 255], yellow: [255, 255, 0] } })(jQuery);24(function(c) {25 function b(av, ai, J, af) { var Q = [],26 O = { colors: ["#488c13", "#da4b0f", "#e9b104", "#97080e", "#1b55c0"], legend: { show: true, noColumns: 1, labelFormatter: null, labelBoxBorderColor: "#ccc", container: null, position: "ne", margin: 5, backgroundColor: null, backgroundOpacity: 0.85 }, xaxis: { show: null, position: "bottom", mode: null, color: null, tickColor: null, transform: null, inverseTransform: null, min: null, max: null, autoscaleMargin: null, ticks: null, tickFormatter: null, labelWidth: null, labelHeight: null, reserveSpace: null, tickLength: null, alignTicksWithAxis: null, tickDecimals: null, tickSize: null, minTickSize: null, monthNames: null, timeformat: null, twelveHourClock: false }, yaxis: { autoscaleMargin: 0.02, position: "left" }, xaxes: [], yaxes: [], series: { points: { show: false, radius: 3, lineWidth: 2, fill: true, fillColor: "#ffffff", symbol: "circle" }, lines: { lineWidth: 2, fill: false, fillColor: null, steps: false }, bars: { show: false, lineWidth: 2, barWidth: 1, fill: true, fillColor: null, align: "left", horizontal: false }, shadowSize: 3 }, grid: { show: true, aboveData: false, color: "#545454", backgroundColor: null, borderColor: "#cdcdcd", tickColor: "#ebebeb", labelMargin: 5, axisMargin: 8, borderWidth: 1, minBorderMargin: null, markings: null, markingsColor: "#f4f4f4", markingsLineWidth: 2, clickable: false, hoverable: false, autoHighlight: true, mouseActiveRadius: 10 }, hooks: {} },27 az = null,28 ad = null,29 y = null,30 H = null,31 A = null,32 p = [],33 aw = [],34 q = { left: 0, right: 0, top: 0, bottom: 0 },35 G = 0,36 I = 0,37 h = 0,38 w = 0,39 ak = { processOptions: [], processRawData: [], processDatapoints: [], drawSeries: [], draw: [], bindEvents: [], drawOverlay: [], shutdown: [] },40 aq = this;41 aq.setData = aj;42 aq.setupGrid = t;43 aq.draw = W;44 aq.getPlaceholder = function() { return av };45 aq.getCanvas = function() { return az };46 aq.getPlotOffset = function() { return q };47 aq.width = function() { return h };48 aq.height = function() { return w };49 aq.offset = function() { var aB = y.offset();50 aB.left += q.left;51 aB.top += q.top; return aB };52 aq.getData = function() { return Q };53 aq.getAxes = function() { var aC = {},54 aB;55 c.each(p.concat(aw), function(aD, aE) { if (aE) { aC[aE.direction + (aE.n != 1 ? aE.n : "") + "axis"] = aE } }); return aC };56 aq.getXAxes = function() { return p };57 aq.getYAxes = function() { return aw };58 aq.c2p = C;59 aq.p2c = ar;60 aq.getOptions = function() { return O };61 aq.highlight = x;62 aq.unhighlight = T;63 aq.triggerRedrawOverlay = f;64 aq.pointOffset = function(aB) { return { left: parseInt(p[aA(aB, "x") - 1].p2c(+aB.x) + q.left), top: parseInt(aw[aA(aB, "y") - 1].p2c(+aB.y) + q.top) } };65 aq.shutdown = ag;66 aq.resize = function() { B();67 g(az);68 g(ad) };69 aq.hooks = ak;70 F(aq);71 Z(J);72 X();73 aj(ai);74 t();75 W();76 ah();77 function an(aD, aB) { aB = [aq].concat(aB); for (var aC = 0; aC < aD.length; ++aC) { aD[aC].apply(this, aB) } }78 function F() { for (var aB = 0; aB < af.length; ++aB) { var aC = af[aB];79 aC.init(aq); if (aC.options) { c.extend(true, O, aC.options) } } }80 function Z(aC) { var aB;81 c.extend(true, O, aC); if (O.xaxis.color == null) { O.xaxis.color = O.grid.color } if (O.yaxis.color == null) { O.yaxis.color = O.grid.color } if (O.xaxis.tickColor == null) { O.xaxis.tickColor = O.grid.tickColor } if (O.yaxis.tickColor == null) { O.yaxis.tickColor = O.grid.tickColor } if (O.grid.borderColor == null) { O.grid.borderColor = O.grid.color } if (O.grid.tickColor == null) { O.grid.tickColor = c.color.parse(O.grid.color).scale("a", 0.22).toString() } for (aB = 0; aB < Math.max(1, O.xaxes.length); ++aB) { O.xaxes[aB] = c.extend(true, {}, O.xaxis, O.xaxes[aB]) } for (aB = 0; aB < Math.max(1, O.yaxes.length); ++aB) { O.yaxes[aB] = c.extend(true, {}, O.yaxis, O.yaxes[aB]) } if (O.xaxis.noTicks && O.xaxis.ticks == null) { O.xaxis.ticks = O.xaxis.noTicks } if (O.yaxis.noTicks && O.yaxis.ticks == null) { O.yaxis.ticks = O.yaxis.noTicks } if (O.x2axis) { O.xaxes[1] = c.extend(true, {}, O.xaxis, O.x2axis);82 O.xaxes[1].position = "top" } if (O.y2axis) { O.yaxes[1] = c.extend(true, {}, O.yaxis, O.y2axis);83 O.yaxes[1].position = "right" } if (O.grid.coloredAreas) { O.grid.markings = O.grid.coloredAreas } if (O.grid.coloredAreasColor) { O.grid.markingsColor = O.grid.coloredAreasColor } if (O.lines) { c.extend(true, O.series.lines, O.lines) } if (O.points) { c.extend(true, O.series.points, O.points) } if (O.bars) { c.extend(true, O.series.bars, O.bars) } if (O.shadowSize != null) { O.series.shadowSize = O.shadowSize } for (aB = 0; aB < O.xaxes.length; ++aB) { V(p, aB + 1).options = O.xaxes[aB] } for (aB = 0; aB < O.yaxes.length; ++aB) { V(aw, aB + 1).options = O.yaxes[aB] } for (var aD in ak) { if (O.hooks[aD] && O.hooks[aD].length) { ak[aD] = ak[aD].concat(O.hooks[aD]) } } an(ak.processOptions, [O]) }84 function aj(aB) { Q = Y(aB);85 ax();86 z() }87 function Y(aE) { var aC = []; for (var aB = 0; aB < aE.length; ++aB) { var aD = c.extend(true, {}, O.series); if (aE[aB].data != null) { aD.data = aE[aB].data;88 delete aE[aB].data;89 c.extend(true, aD, aE[aB]);90 aE[aB].data = aD.data } else { aD.data = aE[aB] } aC.push(aD) } return aC }91 function aA(aC, aD) { var aB = aC[aD + "axis"]; if (typeof aB == "object") { aB = aB.n } if (typeof aB != "number") { aB = 1 } return aB }92 function m() { return c.grep(p.concat(aw), function(aB) { return aB }) }93 function C(aE) { var aC = {},94 aB, aD; for (aB = 0; aB < p.length; ++aB) { aD = p[aB]; if (aD && aD.used) { aC["x" + aD.n] = aD.c2p(aE.left) } } for (aB = 0; aB < aw.length; ++aB) { aD = aw[aB]; if (aD && aD.used) { aC["y" + aD.n] = aD.c2p(aE.top) } } if (aC.x1 !== undefined) { aC.x = aC.x1 } if (aC.y1 !== undefined) { aC.y = aC.y1 } return aC }95 function ar(aF) { var aD = {},96 aC, aE, aB; for (aC = 0; aC < p.length; ++aC) { aE = p[aC]; if (aE && aE.used) { aB = "x" + aE.n; if (aF[aB] == null && aE.n == 1) { aB = "x" } if (aF[aB] != null) { aD.left = aE.p2c(aF[aB]); break } } } for (aC = 0; aC < aw.length; ++aC) { aE = aw[aC]; if (aE && aE.used) { aB = "y" + aE.n; if (aF[aB] == null && aE.n == 1) { aB = "y" } if (aF[aB] != null) { aD.top = aE.p2c(aF[aB]); break } } } return aD }97 function V(aC, aB) { if (!aC[aB - 1]) { aC[aB - 1] = { n: aB, direction: aC == p ? "x" : "y", options: c.extend(true, {}, aC == p ? O.xaxis : O.yaxis) } } return aC[aB - 1] }98 function ax() { var aG; var aM = Q.length,99 aB = [],100 aE = []; for (aG = 0; aG < Q.length; ++aG) { var aJ = Q[aG].color; if (aJ != null) {--aM; if (typeof aJ == "number") { aE.push(aJ) } else { aB.push(c.color.parse(Q[aG].color)) } } } for (aG = 0; aG < aE.length; ++aG) { aM = Math.max(aM, aE[aG] + 1) } var aC = [],101 aF = 0;102 aG = 0; while (aC.length < aM) { var aI; if (O.colors.length == aG) { aI = c.color.make(100, 100, 100) } else { aI = c.color.parse(O.colors[aG]) } var aD = aF % 2 == 1 ? -1 : 1;103 aI.scale("rgb", 1 + aD * Math.ceil(aF / 2) * 0.2);104 aC.push(aI);++aG; if (aG >= O.colors.length) { aG = 0;++aF } } var aH = 0,105 aN; for (aG = 0; aG < Q.length; ++aG) { aN = Q[aG]; if (aN.color == null) { aN.color = aC[aH].toString();++aH } else { if (typeof aN.color == "number") { aN.color = aC[aN.color].toString() } } if (aN.lines.show == null) { var aL, aK = true; for (aL in aN) { if (aN[aL] && aN[aL].show) { aK = false; break } } if (aK) { aN.lines.show = true } } aN.xaxis = V(p, aA(aN, "x"));106 aN.yaxis = V(aw, aA(aN, "y")) } }107 function z() { var aO = Number.POSITIVE_INFINITY,108 aI = Number.NEGATIVE_INFINITY,109 aB = Number.MAX_VALUE,110 aU, aS, aR, aN, aD, aJ, aT, aP, aH, aG, aC, a0, aX, aL;111 function aF(a3, a2, a1) { if (a2 < a3.datamin && a2 != -aB) { a3.datamin = a2 } if (a1 > a3.datamax && a1 != aB) { a3.datamax = a1 } } c.each(m(), function(a1, a2) { a2.datamin = aO;112 a2.datamax = aI;113 a2.used = false }); for (aU = 0; aU < Q.length; ++aU) { aJ = Q[aU];114 aJ.datapoints = { points: [] };115 an(ak.processRawData, [aJ, aJ.data, aJ.datapoints]) } for (aU = 0; aU < Q.length; ++aU) { aJ = Q[aU]; var aZ = aJ.data,116 aW = aJ.datapoints.format; if (!aW) { aW = [];117 aW.push({ x: true, number: true, required: true });118 aW.push({ y: true, number: true, required: true }); if (aJ.bars.show || (aJ.lines.show && aJ.lines.fill)) { aW.push({ y: true, number: true, required: false, defaultValue: 0 }); if (aJ.bars.horizontal) { delete aW[aW.length - 1].y;119 aW[aW.length - 1].x = true } } aJ.datapoints.format = aW } if (aJ.datapoints.pointsize != null) { continue } aJ.datapoints.pointsize = aW.length;120 aP = aJ.datapoints.pointsize;121 aT = aJ.datapoints.points;122 insertSteps = aJ.lines.show && aJ.lines.steps;123 aJ.xaxis.used = aJ.yaxis.used = true; for (aS = aR = 0; aS < aZ.length; ++aS, aR += aP) { aL = aZ[aS]; var aE = aL == null; if (!aE) { for (aN = 0; aN < aP; ++aN) { a0 = aL[aN];124 aX = aW[aN]; if (aX) { if (aX.number && a0 != null) { a0 = +a0; if (isNaN(a0)) { a0 = null } else { if (a0 == Infinity) { a0 = aB } else { if (a0 == -Infinity) { a0 = -aB } } } } if (a0 == null) { if (aX.required) { aE = true } if (aX.defaultValue != null) { a0 = aX.defaultValue } } } aT[aR + aN] = a0 } } if (aE) { for (aN = 0; aN < aP; ++aN) { a0 = aT[aR + aN]; if (a0 != null) { aX = aW[aN]; if (aX.x) { aF(aJ.xaxis, a0, a0) } if (aX.y) { aF(aJ.yaxis, a0, a0) } } aT[aR + aN] = null } } else { if (insertSteps && aR > 0 && aT[aR - aP] != null && aT[aR - aP] != aT[aR] && aT[aR - aP + 1] != aT[aR + 1]) { for (aN = 0; aN < aP; ++aN) { aT[aR + aP + aN] = aT[aR + aN] } aT[aR + 1] = aT[aR - aP + 1];125 aR += aP } } } } for (aU = 0; aU < Q.length; ++aU) { aJ = Q[aU];126 an(ak.processDatapoints, [aJ, aJ.datapoints]) } for (aU = 0; aU < Q.length; ++aU) { aJ = Q[aU];127 aT = aJ.datapoints.points, aP = aJ.datapoints.pointsize; var aK = aO,128 aQ = aO,129 aM = aI,130 aV = aI; for (aS = 0; aS < aT.length; aS += aP) { if (aT[aS] == null) { continue } for (aN = 0; aN < aP; ++aN) { a0 = aT[aS + aN];131 aX = aW[aN]; if (!aX || a0 == aB || a0 == -aB) { continue } if (aX.x) { if (a0 < aK) { aK = a0 } if (a0 > aM) { aM = a0 } } if (aX.y) { if (a0 < aQ) { aQ = a0 } if (a0 > aV) { aV = a0 } } } } if (aJ.bars.show) { var aY = aJ.bars.align == "left" ? 0 : -aJ.bars.barWidth / 2; if (aJ.bars.horizontal) { aQ += aY;132 aV += aY + aJ.bars.barWidth } else { aK += aY;133 aM += aY + aJ.bars.barWidth } } aF(aJ.xaxis, aK, aM);134 aF(aJ.yaxis, aQ, aV) } c.each(m(), function(a1, a2) { if (a2.datamin == aO) { a2.datamin = null } if (a2.datamax == aI) { a2.datamax = null } }) }135 function j(aB, aC) { var aD = document.createElement("canvas");136 aD.className = aC;137 aD.width = G;138 aD.height = I; if (!aB) { c(aD).css({ position: "absolute", left: 0, top: 0 }) } c(aD).appendTo(av); if (!aD.getContext) { aD = window.G_vmlCanvasManager.initElement(aD) } aD.getContext("2d").save(); return aD }139 function B() { G = av.width();140 I = av.height(); if (G <= 0 || I <= 0) { throw "Invalid dimensions for plot, width = " + G + ", height = " + I } }141 function g(aC) { if (aC.width != G) { aC.width = G } if (aC.height != I) { aC.height = I } var aB = aC.getContext("2d");142 aB.restore();143 aB.save() }144 function X() { var aC, aB = av.children("canvas.base"),145 aD = av.children("canvas.overlay"); if (aB.length == 0 || aD == 0) { av.html("");146 av.css({ padding: 0 }); if (av.css("position") == "static") { av.css("position", "relative") } B();147 az = j(true, "base");148 ad = j(false, "overlay");149 aC = false } else { az = aB.get(0);150 ad = aD.get(0);151 aC = true } H = az.getContext("2d");152 A = ad.getContext("2d");153 y = c([ad, az]); if (aC) { av.data("plot").shutdown();154 aq.resize();155 A.clearRect(0, 0, G, I);156 y.unbind();157 av.children().not([az, ad]).remove() } av.data("plot", aq) }158 function ah() { if (O.grid.hoverable) { y.mousemove(aa);159 y.mouseleave(l) } if (O.grid.clickable) { y.click(R) } an(ak.bindEvents, [y]) }160 function ag() { if (M) { clearTimeout(M) } y.unbind("mousemove", aa);161 y.unbind("mouseleave", l);162 y.unbind("click", R);163 an(ak.shutdown, [y]) }164 function r(aG) {165 function aC(aH) { return aH } var aF, aB, aD = aG.options.transform || aC,166 aE = aG.options.inverseTransform; if (aG.direction == "x") { aF = aG.scale = h / Math.abs(aD(aG.max) - aD(aG.min));167 aB = Math.min(aD(aG.max), aD(aG.min)) } else { aF = aG.scale = w / Math.abs(aD(aG.max) - aD(aG.min));168 aF = -aF;169 aB = Math.max(aD(aG.max), aD(aG.min)) } if (aD == aC) { aG.p2c = function(aH) { return (aH - aB) * aF } } else { aG.p2c = function(aH) { return (aD(aH) - aB) * aF } } if (!aE) { aG.c2p = function(aH) { return aB + aH / aF } } else { aG.c2p = function(aH) { return aE(aB + aH / aF) } } }170 function L(aD) { var aB = aD.options,171 aF, aJ = aD.ticks || [],172 aI = [],173 aE, aK = aB.labelWidth,174 aG = aB.labelHeight,175 aC;176 function aH(aM, aL) { return c('<div style="position:absolute;top:-10000px;' + aL + 'font-size:smaller"><div class="' + aD.direction + "Axis " + aD.direction + aD.n + 'Axis">' + aM.join("") + "</div></div>").appendTo(av) } if (aD.direction == "x") { if (aK == null) { aK = Math.floor(G / (aJ.length > 0 ? aJ.length : 1)) } if (aG == null) { aI = []; for (aF = 0; aF < aJ.length; ++aF) { aE = aJ[aF].label; if (aE) { aI.push('<div class="tickLabel" style="float:left;width:' + aK + 'px">' + aE + "</div>") } } if (aI.length > 0) { aI.push('<div style="clear:left"></div>');177 aC = aH(aI, "width:10000px;");178 aG = aC.height();179 aC.remove() } } } else { if (aK == null || aG == null) { for (aF = 0; aF < aJ.length; ++aF) { aE = aJ[aF].label; if (aE) { aI.push('<div class="tickLabel">' + aE + "</div>") } } if (aI.length > 0) { aC = aH(aI, ""); if (aK == null) { aK = aC.children().width() } if (aG == null) { aG = aC.find("div.tickLabel").height() } aC.remove() } } } if (aK == null) { aK = 0 } if (aG == null) { aG = 0 } aD.labelWidth = aK;180 aD.labelHeight = aG }181 function au(aD) { var aC = aD.labelWidth,182 aL = aD.labelHeight,183 aH = aD.options.position,184 aF = aD.options.tickLength,185 aG = O.grid.axisMargin,186 aJ = O.grid.labelMargin,187 aK = aD.direction == "x" ? p : aw,188 aE; var aB = c.grep(aK, function(aN) { return aN && aN.options.position == aH && aN.reserveSpace }); if (c.inArray(aD, aB) == aB.length - 1) { aG = 0 } if (aF == null) { aF = "full" } var aI = c.grep(aK, function(aN) { return aN && aN.reserveSpace }); var aM = c.inArray(aD, aI) == 0; if (!aM && aF == "full") { aF = 5 } if (!isNaN(+aF)) { aJ += +aF } if (aD.direction == "x") { aL += aJ; if (aH == "bottom") { q.bottom += aL + aG;189 aD.box = { top: I - q.bottom, height: aL } } else { aD.box = { top: q.top + aG, height: aL };190 q.top += aL + aG } } else { aC += aJ; if (aH == "left") { aD.box = { left: q.left + aG, width: aC };191 q.left += aC + aG } else { q.right += aC + aG;192 aD.box = { left: G - q.right, width: aC } } } aD.position = aH;193 aD.tickLength = aF;194 aD.box.padding = aJ;195 aD.innermost = aM }196 function U(aB) { if (aB.direction == "x") { aB.box.left = q.left;197 aB.box.width = h } else { aB.box.top = q.top;198 aB.box.height = w } }199 function t() { var aC, aE = m();200 c.each(aE, function(aF, aG) { aG.show = aG.options.show; if (aG.show == null) { aG.show = aG.used } aG.reserveSpace = aG.show || aG.options.reserveSpace;201 n(aG) });202 allocatedAxes = c.grep(aE, function(aF) { return aF.reserveSpace });203 q.left = q.right = q.top = q.bottom = 0; if (O.grid.show) { c.each(allocatedAxes, function(aF, aG) { S(aG);204 P(aG);205 ap(aG, aG.ticks);206 L(aG) }); for (aC = allocatedAxes.length - 1; aC >= 0; --aC) { au(allocatedAxes[aC]) } var aD = O.grid.minBorderMargin; if (aD == null) { aD = 0; for (aC = 0; aC < Q.length; ++aC) { aD = Math.max(aD, Q[aC].points.radius + Q[aC].points.lineWidth / 2) } } for (var aB in q) { q[aB] += O.grid.borderWidth;207 q[aB] = Math.max(aD, q[aB]) } } h = G - q.left - q.right;208 w = I - q.bottom - q.top;209 c.each(aE, function(aF, aG) { r(aG) }); if (O.grid.show) { c.each(allocatedAxes, function(aF, aG) { U(aG) });210 k() } o() }211 function n(aE) { var aF = aE.options,212 aD = +(aF.min != null ? aF.min : aE.datamin),213 aB = +(aF.max != null ? aF.max : aE.datamax),214 aH = aB - aD; if (aH == 0) { var aC = aB == 0 ? 1 : 0.01; if (aF.min == null) { aD -= aC } if (aF.max == null || aF.min != null) { aB += aC } } else { var aG = aF.autoscaleMargin; if (aG != null) { if (aF.min == null) { aD -= aH * aG; if (aD < 0 && aE.datamin != null && aE.datamin >= 0) { aD = 0 } } if (aF.max == null) { aB += aH * aG; if (aB > 0 && aE.datamax != null && aE.datamax <= 0) { aB = 0 } } } } aE.min = aD;215 aE.max = aB }216 function S(aG) { var aM = aG.options; var aH; if (typeof aM.ticks == "number" && aM.ticks > 0) { aH = aM.ticks } else { aH = 0.3 * Math.sqrt(aG.direction == "x" ? G : I) } var aT = (aG.max - aG.min) / aH,217 aO, aB, aN, aR, aS, aQ, aI; if (aM.mode == "time") { var aJ = { second: 1000, minute: 60 * 1000, hour: 60 * 60 * 1000, day: 24 * 60 * 60 * 1000, month: 30 * 24 * 60 * 60 * 1000, year: 365.2425 * 24 * 60 * 60 * 1000 }; var aK = [218 [1, "second"],219 [2, "second"],220 [5, "second"],221 [10, "second"],222 [30, "second"],223 [1, "minute"],224 [2, "minute"],225 [5, "minute"],226 [10, "minute"],227 [30, "minute"],228 [1, "hour"],229 [2, "hour"],230 [4, "hour"],231 [8, "hour"],232 [12, "hour"],233 [1, "day"],234 [2, "day"],235 [3, "day"],236 [0.25, "month"],237 [0.5, "month"],238 [1, "month"],239 [2, "month"],240 [3, "month"],241 [6, "month"],242 [1, "year"]243 ]; var aC = 0; if (aM.minTickSize != null) { if (typeof aM.tickSize == "number") { aC = aM.tickSize } else { aC = aM.minTickSize[0] * aJ[aM.minTickSize[1]] } } for (var aS = 0; aS < aK.length - 1; ++aS) { if (aT < (aK[aS][0] * aJ[aK[aS][1]] + aK[aS + 1][0] * aJ[aK[aS + 1][1]]) / 2 && aK[aS][0] * aJ[aK[aS][1]] >= aC) { break } } aO = aK[aS][0];244 aN = aK[aS][1]; if (aN == "year") { aQ = Math.pow(10, Math.floor(Math.log(aT / aJ.year) / Math.LN10));245 aI = (aT / aJ.year) / aQ; if (aI < 1.5) { aO = 1 } else { if (aI < 3) { aO = 2 } else { if (aI < 7.5) { aO = 5 } else { aO = 10 } } } aO *= aQ } aG.tickSize = aM.tickSize || [aO, aN];246 aB = function(aX) { var a2 = [],247 a0 = aX.tickSize[0],248 a3 = aX.tickSize[1],249 a1 = new Date(aX.min); var aW = a0 * aJ[a3]; if (a3 == "second") { a1.setUTCSeconds(a(a1.getUTCSeconds(), a0)) } if (a3 == "minute") { a1.setUTCMinutes(a(a1.getUTCMinutes(), a0)) } if (a3 == "hour") { a1.setUTCHours(a(a1.getUTCHours(), a0)) } if (a3 == "month") { a1.setUTCMonth(a(a1.getUTCMonth(), a0)) } if (a3 == "year") { a1.setUTCFullYear(a(a1.getUTCFullYear(), a0)) } a1.setUTCMilliseconds(0); if (aW >= aJ.minute) { a1.setUTCSeconds(0) } if (aW >= aJ.hour) { a1.setUTCMinutes(0) } if (aW >= aJ.day) { a1.setUTCHours(0) } if (aW >= aJ.day * 4) { a1.setUTCDate(1) } if (aW >= aJ.year) { a1.setUTCMonth(0) } var a5 = 0,250 a4 = Number.NaN,251 aY;252 do { aY = a4;253 a4 = a1.getTime();254 a2.push(a4); if (a3 == "month") { if (a0 < 1) { a1.setUTCDate(1); var aV = a1.getTime();255 a1.setUTCMonth(a1.getUTCMonth() + 1); var aZ = a1.getTime();256 a1.setTime(a4 + a5 * aJ.hour + (aZ - aV) * a0);257 a5 = a1.getUTCHours();258 a1.setUTCHours(0) } else { a1.setUTCMonth(a1.getUTCMonth() + a0) } } else { if (a3 == "year") { a1.setUTCFullYear(a1.getUTCFullYear() + a0) } else { a1.setTime(a4 + aW) } } } while (a4 < aX.max && a4 != aY); return a2 };259 aR = function(aV, aY) { var a0 = new Date(aV); if (aM.timeformat != null) { return c.plot.formatDate(a0, aM.timeformat, aM.monthNames) } var aW = aY.tickSize[0] * aJ[aY.tickSize[1]]; var aX = aY.max - aY.min; var aZ = (aM.twelveHourClock) ? " %p" : ""; if (aW < aJ.minute) { fmt = "%h:%M:%S" + aZ } else { if (aW < aJ.day) { if (aX < 2 * aJ.day) { fmt = "%h:%M" + aZ } else { fmt = "%b %d %h:%M" + aZ } } else { if (aW < aJ.month) { fmt = "%b %d" } else { if (aW < aJ.year) { if (aX < aJ.year) { fmt = "%b" } else { fmt = "%b %y" } } else { fmt = "%y" } } } } return c.plot.formatDate(a0, fmt, aM.monthNames) } } else { var aU = aM.tickDecimals; var aP = -Math.floor(Math.log(aT) / Math.LN10); if (aU != null && aP > aU) { aP = aU } aQ = Math.pow(10, -aP);260 aI = aT / aQ; if (aI < 1.5) { aO = 1 } else { if (aI < 3) { aO = 2; if (aI > 2.25 && (aU == null || aP + 1 <= aU)) { aO = 2.5;++aP } } else { if (aI < 7.5) { aO = 5 } else { aO = 10 } } } aO *= aQ; if (aM.minTickSize != null && aO < aM.minTickSize) { aO = aM.minTickSize } aG.tickDecimals = Math.max(0, aU != null ? aU : aP);261 aG.tickSize = aM.tickSize || aO;262 aB = function(aX) { var aZ = []; var a0 = a(aX.min, aX.tickSize),263 aW = 0,264 aV = Number.NaN,265 aY;266 do { aY = aV;267 aV = a0 + aW * aX.tickSize;268 aZ.push(aV);++aW } while (aV < aX.max && aV != aY); return aZ };269 aR = function(aV, aW) { return aV.toFixed(aW.tickDecimals) } } if (aM.alignTicksWithAxis != null) { var aF = (aG.direction == "x" ? p : aw)[aM.alignTicksWithAxis - 1]; if (aF && aF.used && aF != aG) { var aL = aB(aG); if (aL.length > 0) { if (aM.min == null) { aG.min = Math.min(aG.min, aL[0]) } if (aM.max == null && aL.length > 1) { aG.max = Math.max(aG.max, aL[aL.length - 1]) } } aB = function(aX) { var aY = [],270 aV, aW; for (aW = 0; aW < aF.ticks.length; ++aW) { aV = (aF.ticks[aW].v - aF.min) / (aF.max - aF.min);271 aV = aX.min + aV * (aX.max - aX.min);272 aY.push(aV) } return aY }; if (aG.mode != "time" && aM.tickDecimals == null) { var aE = Math.max(0, -Math.floor(Math.log(aT) / Math.LN10) + 1),273 aD = aB(aG); if (!(aD.length > 1 && /\..*0$/.test((aD[1] - aD[0]).toFixed(aE)))) { aG.tickDecimals = aE } } } } aG.tickGenerator = aB; if (c.isFunction(aM.tickFormatter)) { aG.tickFormatter = function(aV, aW) { return "" + aM.tickFormatter(aV, aW) } } else { aG.tickFormatter = aR } }274 function P(aF) { var aH = aF.options.ticks,275 aG = []; if (aH == null || (typeof aH == "number" && aH > 0)) { aG = aF.tickGenerator(aF) } else { if (aH) { if (c.isFunction(aH)) { aG = aH({ min: aF.min, max: aF.max }) } else { aG = aH } } } var aE, aB;276 aF.ticks = []; for (aE = 0; aE < aG.length; ++aE) { var aC = null; var aD = aG[aE]; if (typeof aD == "object") { aB = +aD[0]; if (aD.length > 1) { aC = aD[1] } } else { aB = +aD } if (aC == null) { aC = aF.tickFormatter(aB, aF) } if (!isNaN(aB)) { aF.ticks.push({ v: aB, label: aC }) } } }277 function ap(aB, aC) { if (aB.options.autoscaleMargin && aC.length > 0) { if (aB.options.min == null) { aB.min = Math.min(aB.min, aC[0].v) } if (aB.options.max == null && aC.length > 1) { aB.max = Math.max(aB.max, aC[aC.length - 1].v) } } }278 function W() { H.clearRect(0, 0, G, I); var aC = O.grid; if (aC.show && aC.backgroundColor) { N() } if (aC.show && !aC.aboveData) { ac() } for (var aB = 0; aB < Q.length; ++aB) { an(ak.drawSeries, [H, Q[aB]]);279 d(Q[aB]) } an(ak.draw, [H]); if (aC.show && aC.aboveData) { ac() } }280 function D(aB, aI) { var aE, aH, aG, aD, aF = m(); for (i = 0; i < aF.length; ++i) { aE = aF[i]; if (aE.direction == aI) { aD = aI + aE.n + "axis"; if (!aB[aD] && aE.n == 1) { aD = aI + "axis" } if (aB[aD]) { aH = aB[aD].from;281 aG = aB[aD].to; break } } } if (!aB[aD]) { aE = aI == "x" ? p[0] : aw[0];282 aH = aB[aI + "1"];283 aG = aB[aI + "2"] } if (aH != null && aG != null && aH > aG) { var aC = aH;284 aH = aG;285 aG = aC } return { from: aH, to: aG, axis: aE } }286 function N() { H.save();287 H.translate(q.left, q.top);288 H.fillStyle = am(O.grid.backgroundColor, w, 0, "rgba(255, 255, 255, 0)");289 H.fillRect(0, 0, h, w);290 H.restore() }291 function ac() { var aF;292 H.save();293 H.translate(q.left, q.top); var aH = O.grid.markings; if (aH) { if (c.isFunction(aH)) { var aK = aq.getAxes();294 aK.xmin = aK.xaxis.min;295 aK.xmax = aK.xaxis.max;296 aK.ymin = aK.yaxis.min;297 aK.ymax = aK.yaxis.max;298 aH = aH(aK) } for (aF = 0; aF < aH.length; ++aF) { var aD = aH[aF],299 aC = D(aD, "x"),300 aI = D(aD, "y"); if (aC.from == null) { aC.from = aC.axis.min } if (aC.to == null) { aC.to = aC.axis.max } if (aI.from == null) { aI.from = aI.axis.min } if (aI.to == null) { aI.to = aI.axis.max } if (aC.to < aC.axis.min || aC.from > aC.axis.max || aI.to < aI.axis.min || aI.from > aI.axis.max) { continue } aC.from = Math.max(aC.from, aC.axis.min);301 aC.to = Math.min(aC.to, aC.axis.max);302 aI.from = Math.max(aI.from, aI.axis.min);303 aI.to = Math.min(aI.to, aI.axis.max); if (aC.from == aC.to && aI.from == aI.to) { continue } aC.from = aC.axis.p2c(aC.from);304 aC.to = aC.axis.p2c(aC.to);305 aI.from = aI.axis.p2c(aI.from);306 aI.to = aI.axis.p2c(aI.to); if (aC.from == aC.to || aI.from == aI.to) { H.beginPath();307 H.strokeStyle = aD.color || O.grid.markingsColor;308 H.lineWidth = aD.lineWidth || O.grid.markingsLineWidth;309 H.moveTo(aC.from, aI.from);310 H.lineTo(aC.to, aI.to);311 H.stroke() } else { H.fillStyle = aD.color || O.grid.markingsColor;312 H.fillRect(aC.from, aI.to, aC.to - aC.from, aI.from - aI.to) } } } var aK = m(),313 aM = O.grid.borderWidth; for (var aE = 0; aE < aK.length; ++aE) { var aB = aK[aE],314 aG = aB.box,315 aQ = aB.tickLength,316 aN, aL, aP, aJ; if (!aB.show || aB.ticks.length == 0) { continue } H.strokeStyle = aB.options.tickColor || c.color.parse(aB.options.color).scale("a", 0.22).toString();317 H.lineWidth = 1; if (aB.direction == "x") { aN = 0; if (aQ == "full") { aL = (aB.position == "top" ? 0 : w) } else { aL = aG.top - q.top + (aB.position == "top" ? aG.height : 0) } } else { aL = 0; if (aQ == "full") { aN = (aB.position == "left" ? 0 : h) } else { aN = aG.left - q.left + (aB.position == "left" ? aG.width : 0) } } if (!aB.innermost) { H.beginPath();318 aP = aJ = 0; if (aB.direction == "x") { aP = h } else { aJ = w } if (H.lineWidth == 1) { aN = Math.floor(aN) + 0.5;319 aL = Math.floor(aL) + 0.5 } H.moveTo(aN, aL);320 H.lineTo(aN + aP, aL + aJ);321 H.stroke() } H.beginPath(); for (aF = 0; aF < aB.ticks.length; ++aF) { var aO = aB.ticks[aF].v;322 aP = aJ = 0; if (aO < aB.min || aO > aB.max || (aQ == "full" && aM > 0 && (aO == aB.min || aO == aB.max))) { continue } if (aB.direction == "x") { aN = aB.p2c(aO);323 aJ = aQ == "full" ? -w : aQ; if (aB.position == "top") { aJ = -aJ } } else { aL = aB.p2c(aO);324 aP = aQ == "full" ? -h : aQ; if (aB.position == "left") { aP = -aP } } if (H.lineWidth == 1) { if (aB.direction == "x") { aN = Math.floor(aN) + 0.5 } else { aL = Math.floor(aL) + 0.5 } } H.moveTo(aN, aL);325 H.lineTo(aN + aP, aL + aJ) } H.stroke() } if (aM) { H.lineWidth = aM;326 H.strokeStyle = O.grid.borderColor;327 H.strokeRect(-aM / 2, -aM / 2, h + aM, w + aM) } H.restore() }328 function k() { av.find(".tickLabels").remove(); var aG = ['<div class="tickLabels" style="font-size:smaller">']; var aJ = m(); for (var aD = 0; aD < aJ.length; ++aD) { var aC = aJ[aD],329 aF = aC.box; if (!aC.show) { continue } aG.push('<div class="' + aC.direction + "Axis " + aC.direction + aC.n + 'Axis" style="color:' + aC.options.color + '">'); for (var aE = 0; aE < aC.ticks.length; ++aE) { var aH = aC.ticks[aE]; if (!aH.label || aH.v < aC.min || aH.v > aC.max) { continue } var aK = {},330 aI; if (aC.direction == "x") { aI = "center";331 aK.left = Math.round(q.left + aC.p2c(aH.v) - aC.labelWidth / 2); if (aC.position == "bottom") { aK.top = aF.top + aF.padding } else { aK.bottom = I - (aF.top + aF.height - aF.padding) } } else { aK.top = Math.round(q.top + aC.p2c(aH.v) - aC.labelHeight / 2); if (aC.position == "left") { aK.right = G - (aF.left + aF.width - aF.padding);332 aI = "right" } else { aK.left = aF.left + aF.padding;333 aI = "left" } } aK.width = aC.labelWidth; var aB = ["position:absolute", "text-align:" + aI]; for (var aL in aK) { aB.push(aL + ":" + aK[aL] + "px") } aG.push('<div class="tickLabel" style="' + aB.join(";") + '">' + aH.label + "</div>") } aG.push("</div>") } aG.push("</div>");334 av.append(aG.join("")) }335 function d(aB) { if (aB.lines.show) { at(aB) } if (aB.bars.show) { e(aB) } if (aB.points.show) { ao(aB) } }336 function at(aE) {337 function aD(aP, aQ, aI, aU, aT) { var aV = aP.points,338 aJ = aP.pointsize,339 aN = null,340 aM = null;341 H.beginPath(); for (var aO = aJ; aO < aV.length; aO += aJ) { var aL = aV[aO - aJ],342 aS = aV[aO - aJ + 1],343 aK = aV[aO],344 aR = aV[aO + 1]; if (aL == null || aK == null) { continue } if (aS <= aR && aS < aT.min) { if (aR < aT.min) { continue } aL = (aT.min - aS) / (aR - aS) * (aK - aL) + aL;345 aS = aT.min } else { if (aR <= aS && aR < aT.min) { if (aS < aT.min) { continue } aK = (aT.min - aS) / (aR - aS) * (aK - aL) + aL;346 aR = aT.min } } if (aS >= aR && aS > aT.max) { if (aR > aT.max) { continue } aL = (aT.max - aS) / (aR - aS) * (aK - aL) + aL;347 aS = aT.max } else { if (aR >= aS && aR > aT.max) { if (aS > aT.max) { continue } aK = (aT.max - aS) / (aR - aS) * (aK - aL) + aL;348 aR = aT.max } } if (aL <= aK && aL < aU.min) { if (aK < aU.min) { continue } aS = (aU.min - aL) / (aK - aL) * (aR - aS) + aS;349 aL = aU.min } else { if (aK <= aL && aK < aU.min) { if (aL < aU.min) { continue } aR = (aU.min - aL) / (aK - aL) * (aR - aS) + aS;350 aK = aU.min } } if (aL >= aK && aL > aU.max) { if (aK > aU.max) { continue } aS = (aU.max - aL) / (aK - aL) * (aR - aS) + aS;351 aL = aU.max } else { if (aK >= aL && aK > aU.max) { if (aL > aU.max) { continue } aR = (aU.max - aL) / (aK - aL) * (aR - aS) + aS;352 aK = aU.max } } if (aL != aN || aS != aM) { H.moveTo(aU.p2c(aL) + aQ, aT.p2c(aS) + aI) } aN = aK;353 aM = aR;354 H.lineTo(aU.p2c(aK) + aQ, aT.p2c(aR) + aI) } H.stroke() }355 function aF(aI, aQ, aP) { var aW = aI.points,356 aV = aI.pointsize,357 aN = Math.min(Math.max(0, aP.min), aP.max),358 aX = 0,359 aU, aT = false,360 aM = 1,361 aL = 0,362 aR = 0; while (true) { if (aV > 0 && aX > aW.length + aV) { break } aX += aV; var aZ = aW[aX - aV],363 aK = aW[aX - aV + aM],364 aY = aW[aX],365 aJ = aW[aX + aM]; if (aT) { if (aV > 0 && aZ != null && aY == null) { aR = aX;366 aV = -aV;367 aM = 2; continue } if (aV < 0 && aX == aL + aV) { H.fill();368 aT = false;369 aV = -aV;370 aM = 1;371 aX = aL = aR + aV; continue } } if (aZ == null || aY == null) { continue } if (aZ <= aY && aZ < aQ.min) { if (aY < aQ.min) { continue } aK = (aQ.min - aZ) / (aY - aZ) * (aJ - aK) + aK;372 aZ = aQ.min } else { if (aY <= aZ && aY < aQ.min) { if (aZ < aQ.min) { continue } aJ = (aQ.min - aZ) / (aY - aZ) * (aJ - aK) + aK;373 aY = aQ.min } } if (aZ >= aY && aZ > aQ.max) { if (aY > aQ.max) { continue } aK = (aQ.max - aZ) / (aY - aZ) * (aJ - aK) + aK;374 aZ = aQ.max } else { if (aY >= aZ && aY > aQ.max) { if (aZ > aQ.max) { continue } aJ = (aQ.max - aZ) / (aY - aZ) * (aJ - aK) + aK;375 aY = aQ.max } } if (!aT) { H.beginPath();376 H.moveTo(aQ.p2c(aZ), aP.p2c(aN));377 aT = true } if (aK >= aP.max && aJ >= aP.max) { H.lineTo(aQ.p2c(aZ), aP.p2c(aP.max));378 H.lineTo(aQ.p2c(aY), aP.p2c(aP.max)); continue } else { if (aK <= aP.min && aJ <= aP.min) { H.lineTo(aQ.p2c(aZ), aP.p2c(aP.min));379 H.lineTo(aQ.p2c(aY), aP.p2c(aP.min)); continue } } var aO = aZ,380 aS = aY; if (aK <= aJ && aK < aP.min && aJ >= aP.min) { aZ = (aP.min - aK) / (aJ - aK) * (aY - aZ) + aZ;381 aK = aP.min } else { if (aJ <= aK && aJ < aP.min && aK >= aP.min) { aY = (aP.min - aK) / (aJ - aK) * (aY - aZ) + aZ;382 aJ = aP.min } } if (aK >= aJ && aK > aP.max && aJ <= aP.max) { aZ = (aP.max - aK) / (aJ - aK) * (aY - aZ) + aZ;383 aK = aP.max } else { if (aJ >= aK && aJ > aP.max && aK <= aP.max) { aY = (aP.max - aK) / (aJ - aK) * (aY - aZ) + aZ;384 aJ = aP.max } } if (aZ != aO) { H.lineTo(aQ.p2c(aO), aP.p2c(aK)) } H.lineTo(aQ.p2c(aZ), aP.p2c(aK));385 H.lineTo(aQ.p2c(aY), aP.p2c(aJ)); if (aY != aS) { H.lineTo(aQ.p2c(aY), aP.p2c(aJ));386 H.lineTo(aQ.p2c(aS), aP.p2c(aJ)) } } } H.save();387 H.translate(q.left, q.top);388 H.lineJoin = "round"; var aG = aE.lines.lineWidth,389 aB = aE.shadowSize; if (aG > 0 && aB > 0) { H.lineWidth = aB;390 H.strokeStyle = "rgba(0,0,0,0.1)"; var aH = Math.PI / 18;391 aD(aE.datapoints, Math.sin(aH) * (aG / 2 + aB / 2), Math.cos(aH) * (aG / 2 + aB / 2), aE.xaxis, aE.yaxis);392 H.lineWidth = aB / 2;393 aD(aE.datapoints, Math.sin(aH) * (aG / 2 + aB / 4), Math.cos(aH) * (aG / 2 + aB / 4), aE.xaxis, aE.yaxis) } H.lineWidth = aG;394 H.strokeStyle = aE.color; var aC = ae(aE.lines, aE.color, 0, w); if (aC) { H.fillStyle = aC;395 aF(aE.datapoints, aE.xaxis, aE.yaxis) } if (aG > 0) { aD(aE.datapoints, 0, 0, aE.xaxis, aE.yaxis) } H.restore() }396 function ao(aE) {397 function aH(aN, aM, aU, aK, aS, aT, aQ, aJ) { var aR = aN.points,398 aI = aN.pointsize; for (var aL = 0; aL < aR.length; aL += aI) { var aP = aR[aL],399 aO = aR[aL + 1]; if (aP == null || aP < aT.min || aP > aT.max || aO < aQ.min || aO > aQ.max) { continue } H.beginPath();400 aP = aT.p2c(aP);401 aO = aQ.p2c(aO) + aK; if (aJ == "circle") { H.arc(aP, aO, aM, 0, aS ? Math.PI : Math.PI * 2, false) } else { aJ(H, aP, aO, aM, aS) } H.closePath(); if (aU) { H.fillStyle = aU;402 H.fill() } H.stroke() } } H.save();403 H.translate(q.left, q.top); var aG = aE.points.lineWidth,404 aC = aE.shadowSize,405 aB = aE.points.radius,406 aF = aE.points.symbol; if (aG > 0 && aC > 0) { var aD = aC / 2;407 H.lineWidth = aD;408 H.strokeStyle = "rgba(0,0,0,0.1)";409 aH(aE.datapoints, aB, null, aD + aD / 2, true, aE.xaxis, aE.yaxis, aF);410 H.strokeStyle = "rgba(0,0,0,0.2)";411 aH(aE.datapoints, aB, null, aD / 2, true, aE.xaxis, aE.yaxis, aF) } H.lineWidth = aG;412 H.strokeStyle = aE.color;413 aH(aE.datapoints, aB, ae(aE.points, aE.color), 0, false, aE.xaxis, aE.yaxis, aF);414 H.restore() }415 function E(aN, aM, aV, aI, aQ, aF, aD, aL, aK, aU, aR, aC) { var aE, aT, aJ, aP, aG, aB, aO, aH, aS; if (aR) { aH = aB = aO = true;416 aG = false;417 aE = aV;418 aT = aN;419 aP = aM + aI;420 aJ = aM + aQ; if (aT < aE) { aS = aT;421 aT = aE;422 aE = aS;423 aG = true;424 aB = false } } else { aG = aB = aO = true;425 aH = false;426 aE = aN + aI;427 aT = aN + aQ;428 aJ = aV;429 aP = aM; if (aP < aJ) { aS = aP;430 aP = aJ;431 aJ = aS;432 aH = true;433 aO = false } } if (aT < aL.min || aE > aL.max || aP < aK.min || aJ > aK.max) { return } if (aE < aL.min) { aE = aL.min;434 aG = false } if (aT > aL.max) { aT = aL.max;435 aB = false } if (aJ < aK.min) { aJ = aK.min;436 aH = false } if (aP > aK.max) { aP = aK.max;437 aO = false } aE = aL.p2c(aE);438 aJ = aK.p2c(aJ);439 aT = aL.p2c(aT);440 aP = aK.p2c(aP); if (aD) { aU.beginPath();441 aU.moveTo(aE, aJ);442 aU.lineTo(aE, aP);443 aU.lineTo(aT, aP);444 aU.lineTo(aT, aJ);445 aU.fillStyle = aD(aJ, aP);446 aU.fill() } if (aC > 0 && (aG || aB || aO || aH)) { aU.beginPath();447 aU.moveTo(aE, aJ + aF); if (aG) { aU.lineTo(aE, aP + aF) } else { aU.moveTo(aE, aP + aF) } if (aO) { aU.lineTo(aT, aP + aF) } else { aU.moveTo(aT, aP + aF) } if (aB) { aU.lineTo(aT, aJ + aF) } else { aU.moveTo(aT, aJ + aF) } if (aH) { aU.lineTo(aE, aJ + aF) } else { aU.moveTo(aE, aJ + aF) } aU.stroke() } }448 function e(aD) {449 function aC(aJ, aI, aL, aG, aK, aN, aM) { var aO = aJ.points,450 aF = aJ.pointsize; for (var aH = 0; aH < aO.length; aH += aF) { if (aO[aH] == null) { continue } E(aO[aH], aO[aH + 1], aO[aH + 2], aI, aL, aG, aK, aN, aM, H, aD.bars.horizontal, aD.bars.lineWidth) } } H.save();451 H.translate(q.left, q.top);452 H.lineWidth = aD.bars.lineWidth;453 H.strokeStyle = aD.color; var aB = aD.bars.align == "left" ? 0 : -aD.bars.barWidth / 2; var aE = aD.bars.fill ? function(aF, aG) { return ae(aD.bars, aD.color, aF, aG) } : null;454 aC(aD.datapoints, aB, aB + aD.bars.barWidth, 0, aE, aD.xaxis, aD.yaxis);455 H.restore() }456 function ae(aD, aB, aC, aF) { var aE = aD.fill; if (!aE) { return null } if (aD.fillColor) { return am(aD.fillColor, aC, aF, aB) } var aG = c.color.parse(aB);457 aG.a = typeof aE == "number" ? aE : 0.4;458 aG.normalize(); return aG.toString() }459 function o() { av.find(".legend").remove(); if (!O.legend.show) { return } var aH = [],460 aF = false,461 aN = O.legend.labelFormatter,462 aM, aJ; for (var aE = 0; aE < Q.length; ++aE) { aM = Q[aE];463 aJ = aM.label; if (!aJ) { continue } if (aE % O.legend.noColumns == 0) { if (aF) { aH.push("</tr>") } aH.push("<tr>");464 aF = true } if (aN) { aJ = aN(aJ, aM) } aH.push('<td class="legendColorBox"><div style="border:1px solid ' + O.legend.labelBoxBorderColor + ';padding:1px"><div style="width:4px;height:0;border:5px solid ' + aM.color + ';overflow:hidden"></div></div></td><td class="legendLabel">' + aJ + "</td>") } if (aF) { aH.push("</tr>") } if (aH.length == 0) { return } var aL = '<table style="font-size:smaller;color:' + O.grid.color + '">' + aH.join("") + "</table>"; if (O.legend.container != null) { c(O.legend.container).html(aL) } else { var aI = "",465 aC = O.legend.position,466 aD = O.legend.margin; if (aD[0] == null) { aD = [aD, aD] } if (aC.charAt(0) == "n") { aI += "top:" + (aD[1] + q.top) + "px;" } else { if (aC.charAt(0) == "s") { aI += "bottom:" + (aD[1] + q.bottom) + "px;" } } if (aC.charAt(1) == "e") { aI += "right:" + (aD[0] + q.right) + "px;" } else { if (aC.charAt(1) == "w") { aI += "left:" + (aD[0] + q.left) + "px;" } } var aK = c('<div class="legend">' + aL.replace('style="', 'style="position:absolute;' + aI + ";") + "</div>").appendTo(av); if (O.legend.backgroundOpacity != 0) { var aG = O.legend.backgroundColor; if (aG == null) { aG = O.grid.backgroundColor; if (aG && typeof aG == "string") { aG = c.color.parse(aG) } else { aG = c.color.extract(aK, "background-color") } aG.a = 1;467 aG = aG.toString() } var aB = aK.children();468 c('<div style="position:absolute;width:' + aB.width() + "px;height:" + aB.height() + "px;" + aI + "background-color:" + aG + ';"> </div>').prependTo(aK).css("opacity", O.legend.backgroundOpacity) } } } var ab = [],469 M = null;470 function K(aI, aG, aD) { var aO = O.grid.mouseActiveRadius,471 a0 = aO * aO + 1,472 aY = null,473 aR = false,474 aW, aU; for (aW = Q.length - 1; aW >= 0; --aW) { if (!aD(Q[aW])) { continue } var aP = Q[aW],475 aH = aP.xaxis,476 aF = aP.yaxis,477 aV = aP.datapoints.points,478 aT = aP.datapoints.pointsize,479 aQ = aH.c2p(aI),480 aN = aF.c2p(aG),481 aC = aO / aH.scale,482 aB = aO / aF.scale; if (aH.options.inverseTransform) { aC = Number.MAX_VALUE } if (aF.options.inverseTransform) { aB = Number.MAX_VALUE } if (aP.lines.show || aP.points.show) { for (aU = 0; aU < aV.length; aU += aT) { var aK = aV[aU],483 aJ = aV[aU + 1]; if (aK == null) { continue } if (aK - aQ > aC || aK - aQ < -aC || aJ - aN > aB || aJ - aN < -aB) { continue } var aM = Math.abs(aH.p2c(aK) - aI),484 aL = Math.abs(aF.p2c(aJ) - aG),485 aS = aM * aM + aL * aL; if (aS < a0) { a0 = aS;486 aY = [aW, aU / aT] } } } if (aP.bars.show && !aY) { var aE = aP.bars.align == "left" ? 0 : -aP.bars.barWidth / 2,487 aX = aE + aP.bars.barWidth; for (aU = 0; aU < aV.length; aU += aT) { var aK = aV[aU],488 aJ = aV[aU + 1],489 aZ = aV[aU + 2]; if (aK == null) { continue } if (Q[aW].bars.horizontal ? (aQ <= Math.max(aZ, aK) && aQ >= Math.min(aZ, aK) && aN >= aJ + aE && aN <= aJ + aX) : (aQ >= aK + aE && aQ <= aK + aX && aN >= Math.min(aZ, aJ) && aN <= Math.max(aZ, aJ))) { aY = [aW, aU / aT] } } } } if (aY) { aW = aY[0];490 aU = aY[1];491 aT = Q[aW].datapoints.pointsize; return { datapoint: Q[aW].datapoints.points.slice(aU * aT, (aU + 1) * aT), dataIndex: aU, series: Q[aW], seriesIndex: aW } } return null }492 function aa(aB) { if (O.grid.hoverable) { u("plothover", aB, function(aC) { return aC.hoverable != false }) } }493 function l(aB) { if (O.grid.hoverable) { u("plothover", aB, function(aC) { return false }) } }494 function R(aB) { u("plotclick", aB, function(aC) { return aC.clickable != false }) }495 function u(aC, aB, aD) { var aE = y.offset(),496 aH = aB.pageX - aE.left - q.left,497 aF = aB.pageY - aE.top - q.top,498 aJ = C({ left: aH, top: aF });499 aJ.pageX = aB.pageX;500 aJ.pageY = aB.pageY; var aK = K(aH, aF, aD); if (aK) { aK.pageX = parseInt(aK.series.xaxis.p2c(aK.datapoint[0]) + aE.left + q.left);501 aK.pageY = parseInt(aK.series.yaxis.p2c(aK.datapoint[1]) + aE.top + q.top) } if (O.grid.autoHighlight) { for (var aG = 0; aG < ab.length; ++aG) { var aI = ab[aG]; if (aI.auto == aC && !(aK && aI.series == aK.series && aI.point[0] == aK.datapoint[0] && aI.point[1] == aK.datapoint[1])) { T(aI.series, aI.point) } } if (aK) { x(aK.series, aK.datapoint, aC) } } av.trigger(aC, [aJ, aK]) }502 function f() { if (!M) { M = setTimeout(s, 30) } }503 function s() { M = null;504 A.save();505 A.clearRect(0, 0, G, I);506 A.translate(q.left, q.top); var aC, aB; for (aC = 0; aC < ab.length; ++aC) { aB = ab[aC]; if (aB.series.bars.show) { v(aB.series, aB.point) } else { ay(aB.series, aB.point) } } A.restore();507 an(ak.drawOverlay, [A]) }508 function x(aD, aB, aF) { if (typeof aD == "number") { aD = Q[aD] } if (typeof aB == "number") { var aE = aD.datapoints.pointsize;509 aB = aD.datapoints.points.slice(aE * aB, aE * (aB + 1)) } var aC = al(aD, aB); if (aC == -1) { ab.push({ series: aD, point: aB, auto: aF });510 f() } else { if (!aF) { ab[aC].auto = false } } }511 function T(aD, aB) { if (aD == null && aB == null) { ab = [];512 f() } if (typeof aD == "number") { aD = Q[aD] } if (typeof aB == "number") { aB = aD.data[aB] } var aC = al(aD, aB); if (aC != -1) { ab.splice(aC, 1);513 f() } }514 function al(aD, aE) { for (var aB = 0; aB < ab.length; ++aB) { var aC = ab[aB]; if (aC.series == aD && aC.point[0] == aE[0] && aC.point[1] == aE[1]) { return aB } } return -1 }515 function ay(aE, aD) { var aC = aD[0],516 aI = aD[1],517 aH = aE.xaxis,518 aG = aE.yaxis; if (aC < aH.min || aC > aH.max || aI < aG.min || aI > aG.max) { return } var aF = aE.points.radius + aE.points.lineWidth / 2;519 A.lineWidth = aF;520 A.strokeStyle = c.color.parse(aE.color).scale("a", 0.5).toString(); var aB = 1.5 * aF,521 aC = aH.p2c(aC),522 aI = aG.p2c(aI);523 A.beginPath(); if (aE.points.symbol == "circle") { A.arc(aC, aI, aB, 0, 2 * Math.PI, false) } else { aE.points.symbol(A, aC, aI, aB, false) } A.closePath();524 A.stroke() }525 function v(aE, aB) { A.lineWidth = aE.bars.lineWidth;526 A.strokeStyle = c.color.parse(aE.color).scale("a", 0.5).toString(); var aD = c.color.parse(aE.color).scale("a", 0.5).toString(); var aC = aE.bars.align == "left" ? 0 : -aE.bars.barWidth / 2;527 E(aB[0], aB[1], aB[2] || 0, aC, aC + aE.bars.barWidth, 0, function() { return aD }, aE.xaxis, aE.yaxis, A, aE.bars.horizontal, aE.bars.lineWidth) }528 function am(aJ, aB, aH, aC) { if (typeof aJ == "string") { return aJ } else { var aI = H.createLinearGradient(0, aH, 0, aB); for (var aE = 0, aD = aJ.colors.length; aE < aD; ++aE) { var aF = aJ.colors[aE]; if (typeof aF != "string") { var aG = c.color.parse(aC); if (aF.brightness != null) { aG = aG.scale("rgb", aF.brightness) } if (aF.opacity != null) { aG.a *= aF.opacity } aF = aG.toString() } aI.addColorStop(aE / (aD - 1), aF) } return aI } } } c.plot = function(g, e, d) { var f = new b(c(g), e, d, c.plot.plugins); return f };529 c.plot.version = "0.7";530 c.plot.plugins = [];531 c.plot.formatDate = function(l, f, h) { var o = function(d) { d = "" + d; return d.length == 1 ? "0" + d : d }; var e = []; var p = false,532 j = false; var n = l.getUTCHours(); var k = n < 12; if (h == null) { h = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] } if (f.search(/%p|%P/) != -1) { if (n > 12) { n = n - 12 } else { if (n == 0) { n = 12 } } } for (var g = 0; g < f.length; ++g) { var m = f.charAt(g); if (p) { switch (m) {533 case "h":534 m = "" + n; break;535 case "H":536 m = o(n); break;537 case "M":538 m = o(l.getUTCMinutes()); break;539 case "S":540 m = o(l.getUTCSeconds()); break;541 case "d":542 m = "" + l.getUTCDate(); break;543 case "m":544 m = "" + (l.getUTCMonth() + 1); break;545 case "y":546 m = "" + l.getUTCFullYear(); break;547 case "b":548 m = "" + h[l.getUTCMonth()]; break;549 case "p":550 m = (k) ? ("am") : ("pm"); break;551 case "P":552 m = (k) ? ("AM") : ("PM"); break;553 case "0":554 m = "";555 j = true; break } if (m && j) { m = o(m);556 j = false } e.push(m); if (!j) { p = false } } else { if (m == "%") { p = true } else { e.push(m) } } } return e.join("") };...
encrypt.js
Source:encrypt.js
...437 }438 aB.t = this.t - aC;439 aB.clamp()440 }441 function ab(z, aB) {442 var aA = 0, aC = 0, t = Math.min(z.t, this.t);443 while (aA < t) {444 aC += this[aA] - z[aA];445 aB[aA++] = aC & this.DM;446 aC >>= this.DB447 }448 if (z.t < this.t) {449 aC -= z.s;450 while (aA < this.t) {451 aC += this[aA];452 aB[aA++] = aC & this.DM;453 aC >>= this.DB454 }455 aC += this.s...
swfobject.js
Source:swfobject.js
...212 w(Y, true);213 if (ab) {214 aa.success = true;215 aa.ref = z(Y);216 ab(aa)217 }218 } else {219 if (o[af].expressInstall && A()) {220 var ai = {};221 ai.data = o[af].expressInstall;222 ai.width = ae.getAttribute("width") || "0";223 ai.height = ae.getAttribute("height") || "0";224 if (ae.getAttribute("class")) {225 ai.styleclass = ae.getAttribute("class")226 }227 if (ae.getAttribute("align")) {228 ai.align = ae.getAttribute("align")229 }230 var ah = {};231 var X = ae.getElementsByTagName("param");232 var ac = X.length;233 for (var ad = 0; ad < ac; ad++) {234 if (X[ad].getAttribute("name").toLowerCase() != "movie") {235 ah[X[ad].getAttribute("name")] = X[ad].getAttribute("value")236 }237 }238 P(ai, ah, Y, ab)239 } else {240 p(ae);241 if (ab) {242 ab(aa)243 }244 }245 }246 }247 } else {248 w(Y, true);249 if (ab) {250 var Z = z(Y);251 if (Z && typeof Z.SetVariable != D) {252 aa.success = true;253 aa.ref = Z254 }255 ab(aa)256 }257 }258 }259 }260 }261 function z(aa) {262 var X = null;263 var Y = c(aa);264 if (Y && Y.nodeName == "OBJECT") {265 if (typeof Y.SetVariable != D) {266 X = Y267 } else {268 var Z = Y.getElementsByTagName(r)[0];269 if (Z) {...
editablenode.js
Source:editablenode.js
1/* bender-tags: editor,unit,dom,range */2( function() {3 'use strict';4 var tests = {5 'rangeGetNextEditableNode': function( html, childIndex, startOffset, previous ) {6 var ct = new CKEDITOR.dom.element( 'div' );7 ct.setHtml( html );8 var start = ct.findOne( '#s' ),9 rangeStart = childIndex === false ? start : start.getChild( childIndex );10 var range = new CKEDITOR.dom.range( ct );11 range.setStart( rangeStart, startOffset );12 range.collapse( true );13 var next = range[ previous ? 'getPreviousEditableNode' : 'getNextEditableNode' ]();14 if ( !next )15 return null;16 if ( next.type == CKEDITOR.NODE_TEXT )17 return next.getText();18 return next.getName() + ( next.$.id ? '#' + next.$.id : '' );19 },20 'test getNextEditableNode - 1': function() {21 assert.areSame( 'ab', this.rangeGetNextEditableNode( '<p id="s">ab</p>', 0, 1 ) ); // a^b22 },23 'test getNextEditableNode - 2': function() {24 assert.areSame( 'ab', this.rangeGetNextEditableNode( '<p id="s">ab</p>', 0, 0 ) ); // ^ab (text)25 },26 'test getNextEditableNode - 3': function() {27 assert.areSame( 'ab', this.rangeGetNextEditableNode( '<p id="s">ab</p>', false, 0 ) ); // ^ab (el)28 },29 'test getNextEditableNode - 4': function() {30 // ab^<br> (text)31 assert.areSame( !CKEDITOR.env.needsBrFiller ? 'br' : 'cd', this.rangeGetNextEditableNode( '<p id="s">ab<br></p><p>cd</p>', 0, 2 ) );32 },33 'test getNextEditableNode - 5': function() {34 // ab^35 assert.areSame( 'br', this.rangeGetNextEditableNode( '<p id="s">ab</p><p><br></p><p>cd</p>', 0, 2 ) );36 },37 'test getNextEditableNode - 6': function() {38 // ab^39 assert.areSame( !CKEDITOR.env.needsBrFiller ? 'p#e' : 'cd', this.rangeGetNextEditableNode( '<p id="s">ab</p><p id="e"></p><p>cd</p>', 0, 2 ) );40 },41 'test getNextEditableNode - 7': function() {42 // ab^43 assert.areSame( 'cd', this.rangeGetNextEditableNode( '<p id="s">ab</p><ul><li>cd</li></ul>', 0, 2 ) );44 },45 'test getNextEditableNode - 8': function() {46 // ab^47 assert.areSame( 'br', this.rangeGetNextEditableNode( '<p id="s">ab</p><ul><li><br></li></ul>', 0, 2 ) );48 },49 'test getNextEditableNode - 9': function() {50 // ab^51 assert.areSame( 'cd', this.rangeGetNextEditableNode( '<p id="s">ab</p><table><tbody><tr><td>cd</td></tr></tbody></table>', 0, 2 ) );52 },53 'test getNextEditableNode - 10': function() {54 // ab^55 assert.areSame( 'i', this.rangeGetNextEditableNode( '<p id="s">ab<i contenteditable="false">cd</i></p>', 0, 2 ) );56 },57 'test getNextEditableNode - 11a': function() {58 // ab^59 assert.areSame( 'div', this.rangeGetNextEditableNode( '<p id="s">ab</p><div contenteditable="false">cd</div>', 0, 2 ) );60 },61 'test getNextEditableNode - 11b': function() {62 // ab^63 assert.areSame( 'ul', this.rangeGetNextEditableNode( '<p id="s">ab</p><ul contenteditable="false"><li>cd</li></ul>', 0, 2 ) );64 },65 'test getNextEditableNode - 12': function() {66 // ab^<bookmark>67 assert.areSame( 'cd', this.rangeGetNextEditableNode( '<p id="s">ab<span data-cke-bookmark="1"></span></p><p>cd</p>', 0, 2 ) );68 },69 'test getNextEditableNode - 13': function() {70 if ( CKEDITOR.env.needsBrFiller )71 assert.ignore();72 // <p>^</p>73 assert.areSame( 'cd', this.rangeGetNextEditableNode( '<p id="s"></p><p>cd</p>', false, 0 ) );74 },75 'test getNextEditableNode - 13a': function() {76 if ( !CKEDITOR.env.needsBrFiller )77 assert.ignore();78 // <p>^<br></p>79 assert.areSame( 'cd', this.rangeGetNextEditableNode( '<p id="s"><br></p><p>cd</p>', false, 0 ) );80 },81 'test getNextEditableNode - 13b': function() {82 if ( !CKEDITOR.env.needsBrFiller )83 assert.ignore();84 // <p>^<bookmark><br></p>85 assert.areSame( 'cd', this.rangeGetNextEditableNode( '<p id="s"><span data-cke-bookmark="1"></span><br></p><p>cd</p>', false, 0 ) );86 },87 'test getNextEditableNode - 13c': function() {88 if ( !CKEDITOR.env.needsBrFiller )89 assert.ignore();90 // <p>^ <br></p>91 assert.areSame( 'cd', this.rangeGetNextEditableNode( '<p id="s"> <br></p><p>cd</p>', false, 0 ) );92 },93 'test getNextEditableNode - 14': function() {94 // ab^95 assert.areSame( !CKEDITOR.env.needsBrFiller ? 'li#e' : 'cd', this.rangeGetNextEditableNode( '<p id="s">ab</p><ul><li id="e"></li><li>cd</li></ul>', 0, 2 ) );96 },97 'test getNextEditableNode - 15': function() {98 // ab^99 assert.areSame( !CKEDITOR.env.needsBrFiller ? 'div' : 'cd', this.rangeGetNextEditableNode( '<p id="s">ab</p>\n <div> </div><p>cd</p>', 0, 2 ) );100 },101 'test getNextEditableNode - 16': function() {102 // ab^103 assert.areSame( null, this.rangeGetNextEditableNode( '<p id="s">ab</p>', 0, 2 ) );104 },105 'test getNextEditableNode - 17a': function() {106 // <table>^<tr>107 assert.areSame( 'ab', this.rangeGetNextEditableNode( '<table id="s"><tr><td>ab</td></tr></table>', false, 0 ) );108 },109 'test getNextEditableNode - 17b': function() {110 if ( !CKEDITOR.env.needsBrFiller )111 assert.ignore();112 // <table>^<tr>113 assert.areSame( 'br', this.rangeGetNextEditableNode( '<table id="s"><tr><td><br></td><td>ab</td></tr></table>', false, 0 ) );114 },115 // Similarly to tests 14 and 15.116 'test getNextEditableNode - 17c': function() {117 var expected = CKEDITOR.env.needsBrFiller ? 'ab' : 'td';118 // <table>^<tr>119 assert.areSame( expected, this.rangeGetNextEditableNode( '<table id="s"><tr><td></td><th>ab</th></tr></table>', false, 0 ) );120 },121 'test getPreviousEditableNode - 1': function() {122 // ab^123 assert.areSame( 'ab', this.rangeGetNextEditableNode( '<p id="s">ab</p>', 0, 2 , true ) );124 }125 };126 bender.test( tests );...
pref-editdirectories.js
Source:pref-editdirectories.js
1/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */2/* This Source Code Form is subject to the terms of the Mozilla Public3 * License, v. 2.0. If a copy of the MPL was not distributed with this4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */5Components.utils.import("resource://gre/modules/Services.jsm");6Components.utils.import("resource:///modules/mailServices.js");7// Listener to refresh the list items if something changes. In all these8// cases we just rebuild the list as it is easier than searching/adding in the9// correct places an would be an infrequent operation.10var gAddressBookAbListener = {11 onItemAdded: function(parentDir, item) {12 if (item instanceof Components.interfaces.nsIAbDirectory) {13 fillDirectoryList();14 }15 },16 onItemRemoved: function(parentDir, item) {17 if (item instanceof Components.interfaces.nsIAbDirectory) {18 fillDirectoryList();19 }20 },21 onItemPropertyChanged: function(item, property, oldValue, newValue) {22 if (item instanceof Components.interfaces.nsIAbDirectory) {23 fillDirectoryList();24 }25 }26};27function onInitEditDirectories()28{29 // For AbDeleteDirectory in abCommon.js30 gAddressBookBundle = document.getElementById("bundle_addressBook");31 // If the pref is locked disable the "Add" button32 if (Services.prefs.prefIsLocked("ldap_2.disable_button_add"))33 document.getElementById("addButton").setAttribute('disabled', true);34 // Fill out the directory list35 fillDirectoryList();36 const nsIAbListener = Components.interfaces.nsIAbListener;37 // Add a listener so we can update correctly if the list should change38 MailServices.ab.addAddressBookListener(gAddressBookAbListener,39 nsIAbListener.itemAdded |40 nsIAbListener.directoryRemoved |41 nsIAbListener.itemChanged);42}43function onUninitEditDirectories()44{45 MailServices.ab.removeAddressBookListener(gAddressBookAbListener);46}47function fillDirectoryList()48{49 var abList = document.getElementById("directoriesList");50 // Empty out anything in the list51 while (abList.hasChildNodes())52 abList.lastChild.remove();53 // Init the address book list54 let directories = MailServices.ab.directories;55 let holdingArray = [];56 while (directories && directories.hasMoreElements()) {57 let ab = directories.getNext();58 if (ab instanceof Components.interfaces.nsIAbDirectory && ab.isRemote)59 holdingArray.push(ab);60 }61 holdingArray.sort(function (a, b) { return a.dirName.localeCompare(b.dirName); });62 holdingArray.forEach(function (ab) {63 var item = document.createElement('listitem');64 item.setAttribute("label", ab.dirName);65 item.setAttribute("value", ab.URI);66 abList.appendChild(item);67 });68}69function selectDirectory()70{71 var abList = document.getElementById("directoriesList");72 var editButton = document.getElementById("editButton");73 var removeButton = document.getElementById("removeButton");74 if (abList && abList.selectedItem) {75 editButton.removeAttribute("disabled");76 // If the disable delete button pref for the selected directory is set,77 // disable the delete button for that directory.78 let disable = false;79 let ab = MailServices.ab.getDirectory(abList.value);80 try {81 disable = Services.prefs.getBoolPref(ab.dirPrefId + ".disable_delete");82 }83 catch(ex){84 // If this preference is not set, it's ok.85 }86 if (disable)87 removeButton.setAttribute("disabled", true);88 else89 removeButton.removeAttribute("disabled");90 }91 else {92 editButton.setAttribute("disabled", true);93 removeButton.setAttribute("disabled", true);94 }95}96function dblClickDirectory(event)97{98 // We only care about left click events.99 if (event.button != 0)100 return;101 editDirectory();102}103function editDirectory()104{105 var abList = document.getElementById("directoriesList");106 if (abList && abList.selectedItem) {107 let abURI = abList.value;108 let ab = MailServices.ab.getDirectory(abURI);109 window.openDialog(ab.propertiesChromeURI, "editDirectory",110 "chrome,modal=yes,resizable=no",111 { selectedDirectory: ab });112 }113}114function removeDirectory()115{116 var abList = document.getElementById("directoriesList");117 if (abList && abList.selectedItem)118 AbDeleteDirectory(abList.value);...
test-buffer-arraybuffer.js
Source:test-buffer-arraybuffer.js
1'use strict';2var Buffer = require('../../').Buffer;3var assert = require('assert');4var Buffer = require('../../').Buffer;5var LENGTH = 16;6var ab = new ArrayBuffer(LENGTH);7var dv = new DataView(ab);8var ui = new Uint8Array(ab);9var buf = Buffer.from(ab);10assert.ok(buf instanceof Buffer);11// For backwards compatibility of old .parent property test that if buf is not12// a slice then .parent should be undefined.13assert.equal(buf.parent, undefined);14assert.equal(buf.buffer, ab);15assert.equal(buf.length, ab.byteLength);16buf.fill(0xC);17for (var i = 0; i < LENGTH; i++) {18 assert.equal(ui[i], 0xC);19 ui[i] = 0xF;20 assert.equal(buf[i], 0xF);21}22buf.writeUInt32LE(0xF00, 0);23buf.writeUInt32BE(0xB47, 4);24buf.writeDoubleLE(3.1415, 8);25assert.equal(dv.getUint32(0, true), 0xF00);26assert.equal(dv.getUint32(4), 0xB47);27assert.equal(dv.getFloat64(8, true), 3.1415);28// Now test protecting users from doing stupid things29assert.throws(function() {30 function AB() { }31 Object.setPrototypeOf(AB, ArrayBuffer);32 Object.setPrototypeOf(AB.prototype, ArrayBuffer.prototype);33 Buffer.from(new AB());34}, TypeError);35// write{Double,Float}{LE,BE} with noAssert should not crash, cf. #376636var b = Buffer.allocUnsafe(1);37b.writeFloatLE(11.11, 0, true);38b.writeFloatBE(11.11, 0, true);39b.writeDoubleLE(11.11, 0, true);40b.writeDoubleBE(11.11, 0, true);41// Test the byteOffset and length arguments42{43 var ab = new Uint8Array(5);44 ab[0] = 1;45 ab[1] = 2;46 ab[2] = 3;47 ab[3] = 4;48 ab[4] = 5;49 var buf = Buffer.from(ab.buffer, 1, 3);50 assert.equal(buf.length, 3);51 assert.equal(buf[0], 2);52 assert.equal(buf[1], 3);53 assert.equal(buf[2], 4);54 buf[0] = 9;55 assert.equal(ab[1], 9);56 assert.throws(() => Buffer.from(ab.buffer, 6), (err) => {57 assert(err instanceof RangeError);58 assert(/'offset' is out of bounds/.test(err.message));59 return true;60 });61 assert.throws(() => Buffer.from(ab.buffer, 3, 6), (err) => {62 assert(err instanceof RangeError);63 assert(/'length' is out of bounds/.test(err.message));64 return true;65 });66}67// Test the deprecated Buffer() version also68{69 var ab = new Uint8Array(5);70 ab[0] = 1;71 ab[1] = 2;72 ab[2] = 3;73 ab[3] = 4;74 ab[4] = 5;75 var buf = Buffer(ab.buffer, 1, 3);76 assert.equal(buf.length, 3);77 assert.equal(buf[0], 2);78 assert.equal(buf[1], 3);79 assert.equal(buf[2], 4);80 buf[0] = 9;81 assert.equal(ab[1], 9);82 assert.throws(() => Buffer(ab.buffer, 6), (err) => {83 assert(err instanceof RangeError);84 assert(/'offset' is out of bounds/.test(err.message));85 return true;86 });87 assert.throws(() => Buffer(ab.buffer, 3, 6), (err) => {88 assert(err instanceof RangeError);89 assert(/'length' is out of bounds/.test(err.message));90 return true;91 });...
legacyModule.js
Source:legacyModule.js
1dojo.provide("i18nTest.legacyModule");2dojo.requireLocalization("i18nTest", "amdBundle");3dojo.requireLocalization("i18nTest", "legacyBundle");4i18nTest.legacyModule = function(){5 var legacyBundle = dojo.i18n.getLocalization("i18nTest", "legacyBundle"),6 amdBundle = dojo.i18n.getLocalization("i18nTest", "amdBundle"),7 result = [];8 if(amdBundle.rootValueOnly!="rootValueOnly"){9 result.push('amdBundle.rootValueOnly!="rootValueOnly"');10 }11 switch(dojo.locale){12 case "ab":13 case "ab-cd":14 if(amdBundle.amdBundle!="amdBundle-ab"){15 result.push('amdBundle.amdBundle!="amdBundle-ab"');16 }17 if(amdBundle.abValueOnly!="abValueOnly"){18 result.push('amdBundle.abValueOnly!="abValueOnly"');19 }20 break;21 case "ab-cd-ef":22 if(amdBundle.amdBundle!="amdBundle-ab-cd-ef"){23 result.push('amdBundle.amdBundle!="amdBundle-ab-cd-ef"');24 }25 if(amdBundle.abValueOnly!="abValueOnly"){26 result.push('amdBundle.abValueOnly!="abValueOnly"');27 }28 if(amdBundle.abCdEfValueOnly!="abCdEfValueOnly"){29 result.push('amdBundle.abCdEfValueOnly!="abCdEfValueOnly"');30 }31 break;32 default:33 if(amdBundle.amdBundle!="amdBundle"){34 result.push('amdBundle.amdBundle!="amdBundle"');35 }36 }37 if(legacyBundle.rootValueOnly!="rootValueOnly"){38 result.push('legacyBundle.rootValueOnly!="rootValueOnly"');39 }40 switch(dojo.locale){41 case "ab":42 case "ab-cd":43 if(legacyBundle.legacyBundle!="legacyBundle-ab"){44 result.push('legacyBundle.legacyBundle!="legacyBundle-ab"');45 }46 if(legacyBundle.abValueOnly!="abValueOnly"){47 result.push('legacyBundle.abValueOnly!="abValueOnly"');48 }49 break;50 case "ab-cd-ef":51 if(legacyBundle.legacyBundle!="legacyBundle-ab-cd-ef"){52 result.push('legacyBundle.legacyBundle!="legacyBundle-ab-cd-ef"');53 }54 if(legacyBundle.abValueOnly!="abValueOnly"){55 result.push('legacyBundle.abValueOnly!="abValueOnly"');56 }57 if(legacyBundle.abCdEfValueOnly!="abCdEfValueOnly"){58 result.push('legacyBundle.abCdEfValueOnly!="abCdEfValueOnly"');59 }60 break;61 default:62 if(legacyBundle.legacyBundle!="legacyBundle"){63 result.push('legacyBundle.legacyBundle!="legacyBundle"');64 }65 }66 var i18n= require("dojo/i18n");67 for(var p in i18n._cache) console.log(p);68 return result.length==0 ? true : result.join(";");...
7.2-1.js
Source:7.2-1.js
1/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */2/* This Source Code Form is subject to the terms of the Mozilla Public3 * License, v. 2.0. If a copy of the MPL was not distributed with this4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */5/**6 File Name: 7.2-1.js7 ECMA Section: 7.2 Line Terminators8 Description: - readability9 - separate tokens10 - may occur between any two tokens11 - cannot occur within any token, not even a string12 - affect the process of automatic semicolon insertion.13 white space characters are:14 unicode name formal name string representation15 \u000A line feed <LF> \n16 \u000D carriage return <CR> \r17 Author: christine@netscape.com18 Date: 11 september 199719*/20var SECTION = "7.2-1";21var VERSION = "ECMA_1";22startTest();23var TITLE = "Line Terminators";24writeHeaderToLog( SECTION + " "+ TITLE);25new TestCase( SECTION, "var a\nb = 5; ab=10;ab;", 10, eval("var a\nb = 5; ab=10;ab") );26new TestCase( SECTION, "var a\nb = 5; ab=10;b;", 5, eval("var a\nb = 5; ab=10;b") );27new TestCase( SECTION, "var a\rb = 5; ab=10;ab;", 10, eval("var a\rb = 5; ab=10;ab") );28new TestCase( SECTION, "var a\rb = 5; ab=10;b;", 5, eval("var a\rb = 5; ab=10;b") );29new TestCase( SECTION, "var a\r\nb = 5; ab=10;ab;", 10, eval("var a\r\nb = 5; ab=10;ab") );30new TestCase( SECTION, "var a\r\nb = 5; ab=10;b;", 5, eval("var a\r\nb = 5; ab=10;b") );...
Using AI Code Generation
1const fc = require('fast-check');2const { ab } = require('fast-check-monorepo');3fc.assert(4 fc.property(fc.integer(), fc.integer(), (a, b) => {5 return a + b === ab(a, b);6 })7);8{9 "dependencies": {10 }11}12Could you please share a bit more information about your project? (package.json, yarn.lock or package-lock.json, etc.)
Using AI Code Generation
1const { ab } = require('fast-check-monorepo');2const { ab } = require('fast-check');3const { ab } = require('fast-check-monorepo');4const { ab } = require('fast-check');5const { ab } = require('fast-check-monorepo');6const { ab } = require('fast-check');7const { ab } = require('fast-check-monorepo');8const { ab } = require('fast-check');9const { ab } = require('fast-check-monorepo');10const { ab } = require('fast-check');11const { ab } = require('fast-check-monorepo');12const { ab } = require('fast-check');13const { ab } = require('fast-check-monorepo');14const { ab } = require('fast-check');15const { ab } = require('fast-check-monorepo');16const { ab } = require('fast-check');17const { ab } = require('fast-check-monorepo');18const { ab } = require('fast-check');19const { ab } = require('fast-check-monorepo');20const { ab } = require('fast-check');21const { ab } = require('fast-check-monorepo');22const { ab } = require('fast-check');
Using AI Code Generation
1const { ab } = require('fast-check')2const { property } = require('fast-check')3const { a, b } = require('fast-check')4const { property } = require('fast-check')5const { a } = require('fast-check')6const { property } = require('fast-check')7const { b } = require('fast-check')8const { property } = require('fast-check')9const { ab } = require('fast-check')10const { property } = require('fast-check')11const { a } = require('fast-check')12const { property } = require('fast-check')13const { b } = require('fast-check')14const { property } = require('fast-check')15const { a } = require('fast-check')16const { property } = require('fast-check')17const { b } = require('fast-check')18const { property } = require('fast-check')19const { ab } = require('fast-check')20const { property } = require('fast-check')21const { a } = require('fast-check')22const { property } = require('fast-check')23const { b } = require('fast-check')24const { property } = require('fast-check')25const { ab } = require('fast-check')26const { property } = require('fast-check')27const { a } = require('fast-check')28const { property } = require('fast-check')29const { b } = require('fast-check')30const { property } = require('fast-check')31const { ab } = require('fast-check')32const { property } = require('fast-check')33const { a } = require('
Using AI Code Generation
1const { ab } = require('fast-check-monorepo');2const { property } = require('fast-check');3property(ab, ([a, b]) => {4 return a + b === b + a;5});6{7 "dependencies": {8 }9}10{11 "dependencies": {12 }13}14module.exports = {15 ab: () => {16 return { a: 1, b: 2 };17 }18};19Falsified after 1 tests (1 shrinks) with the following falsifying values:20[ { a: -1, b: 2 }, { a: 1, b: 2 } ]21Falsified after 1 tests (1 shrinks) with the following falsifying values:22[ { a: -1, b: 2 }, { a: 1, b: 2 } ]23Falsified after 1 tests (1 shrinks) with the following falsifying values:24[ { a: 1, b: 2 }, { a: -1, b: 2 } ]25Falsified after 1 tests (1 shrinks) with the following falsifying values:26[ { a: 1, b: 2 }, { a: -1, b: 2 } ]
Using AI Code Generation
1import { ab } from 'fast-check-monorepo';2ab();3import { ab } from 'fast-check-monorepo';4describe('ab', () => {5 it('should return ab', () => {6 expect(ab()).toBe('ab');7 });8});9import { ab } from 'fast-check-monorepo';10describe('ab', () => {11 it('should return ab', () => {12 expect(ab()).toBe('ab');13 });14});15import { ab } from 'fast-check-monorepo';16describe('ab', () => {17 it('should return ab', () => {18 expect(ab()).toBe('ab');19 });20});21import { ab } from 'fast-check-monorepo';22describe('ab', () => {23 it('should return ab', () => {24 expect(ab()).toBe('ab');25 });26});27import { ab } from 'fast-check-monorepo';28describe('ab', () => {29 it('should return ab', () => {30 expect(ab()).toBe('ab');31 });32});33import { ab } from 'fast-check-monorepo';34describe('ab', () => {35 it('should return ab', () => {36 expect(ab()).toBe('ab');37 });38});39import { ab } from 'fast-check-monorepo';40describe('ab', () => {41 it('should return ab', () => {42 expect(ab()).toBe('ab');43 });44});45import { ab } from 'fast-check-monorepo';46describe('ab', () => {47 it('should return ab', () => {48 expect(ab()).toBe('ab');49 });50});51import { ab } from 'fast-check-monorepo';52describe('ab', () => {53 it('should return ab', () => {54 expect(ab()).toBe('ab');55 });56});57import { ab } from 'fast-check-monorepo';58describe('ab', () => {59 it('should return ab', () => {60 expect(ab()).toBe('ab');61 });62});63import { ab } from 'fast
Using AI Code Generation
1const { ab } = require('fast-check-monorepo');2const { property } = require('fast-check');3property(ab, ([a, b]) => {4 return a + b === b + a;5});6const { a, b } = require('fast-check-monorepo');7const { property } = require('fast-check');8property(a, b, (a, b) => {9 return a + b === b + a;10});
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!