2021-05-22 06:50:39 +00:00
|
|
|
(function($,document,window,Raphael,undefined){function jQueryPluginFactory($,name,methods,getters){getters=getters instanceof Array?getters:[];var getters_obj={};for(var i=0;i<getters.length;i++){getters_obj[getters[i]]=true}var Plugin=function(element){this.element=element};Plugin.prototype=methods;$.fn[name]=function(){var args=arguments;var returnValue=this;this.each(function(){var $this=$(this);var plugin=$this.data("plugin-"+name);if(!plugin){plugin=new Plugin($this);$this.data("plugin-"+name,plugin);if(plugin._init){plugin._init.apply(plugin,args)}}else if(typeof args[0]=="string"&&args[0].charAt(0)!="_"&&typeof plugin[args[0]]=="function"){var methodArgs=Array.prototype.slice.call(args,1);var r=plugin[args[0]].apply(plugin,methodArgs);if(args[0]in getters_obj){returnValue=r}}});return returnValue}}var WIDTH=930,HEIGHT=630,LABELS_WIDTH=70;var defaults={stateStyles:{fill:"#333",stroke:"#666","stroke-width":1,"stroke-linejoin":"round",scale:[1,1]},stateHoverStyles:{fill:"#33c",stroke:"#000",scale:[1.1,1.1]},stateHoverAnimation:500,stateSpecificStyles:{},stateSpecificHoverStyles:{},click:null,mouseover:null,mouseout:null,clickState:{},mouseoverState:{},mouseoutState:{},showLabels:true,labelWidth:20,labelHeight:15,labelGap:6,labelRadius:3,labelBackingStyles:{fill:"#333",stroke:"#666","stroke-width":1,"stroke-linejoin":"round",scale:[1,1]},labelBackingHoverStyles:{fill:"#33c",stroke:"#000"},stateSpecificLabelBackingStyles:{},stateSpecificLabelBackingHoverStyles:{},labelTextStyles:{fill:"#fff",stroke:"none","font-weight":300,"stroke-width":0,"font-size":"10px"},labelTextHoverStyles:{},stateSpecificLabelTextStyles:{},stateSpecificLabelTextHoverStyles:{},includeTerritories:[],terrBoxX:702,terrBoxY:510};var methods={_init:function(options){this.options={};$.extend(true,this.options,defaults,options);var width=this.element.width();var height=this.element.height();var xscale=this.element.width()/WIDTH;var yscale=this.element.height()/HEIGHT;this.scale=Math.min(xscale,yscale);this.labelAreaWidth=Math.ceil(LABELS_WIDTH/this.scale);var paperWidthWithLabels=WIDTH+Math.max(0,this.labelAreaWidth-LABELS_WIDTH);this.paper=Raphael(this.element.get(0),paperWidthWithLabels,HEIGHT);this.paper.setSize(width,height);this.paper.setViewBox(0,0,paperWidthWithLabels,HEIGHT,false);if(this.options.labelTextStyles["font-size"]){this.options.labelTextStyles["font-size"]=this._scaleFontSize(this.options.labelTextStyles["font-size"])}this.stateHitAreas={};this.stateShapes={};this.bboxesForStateShapes={};this.topShape=null;this._initCreateStates();this.labelShapes={};this.labelTexts={};this.labelHitAreas={};if(this.options.showLabels){this._initCreateLabels()}},_scaleFontSize:function(font_size){if(font_size){font_size=parseInt(font_size)/this.scale+"px"}return font_size},_initCreateStates:function(){var attr=this.options.stateStyles;var R=this.paper;var paths={HI:"M 233.08751,519.30948 L 235.02744,515.75293 L 237.2907,515.42961 L 237.61402,516.23791 L 235.51242,519.30948 z M 243.27217,515.59127 L 249.4153,518.17784 L 251.51689,517.85452 L 253.1335,513.97465 L 252.48686,510.57977 L 248.28366,510.09479 L 244.24213,511.87306 z M 273.9878,525.61427 L 277.706,531.11074 L 280.13092,530.78742 L 281.26255,530.30244 L 282.7175,531.59573 L 286.43571,531.43407 L 287.40568,529.97912 L 284.49577,528.20085 L 282.55584,524.48263 L 280.45424,520.92609 L 274.63444,523.83599 z M 294.19545,534.50564 L 295.48874,532.5657 L 300.17691,533.53566 L 300.82356,533.05068 L 306.96668,533.69732 L 306.64336,534.99062 L 304.05678,536.44556 L 299.69193,536.12224 z M 299.53027,539.67879 L 301.47021,543.55866 L 304.54176,542.42703 L 304.86509,540.81041 L 303.24848,538.70882 L 299.53027,538.3855 z M 306.4817,538.54716 L 308.74496,535.63726 L 313.43313,538.06218 L 317.79798,539.19381 L 322.16284,541.94205 L 322.16284,543.88198 L 318.6063,545.66026 L 313.75645,546.63022 L 311.33154,545.17527 z M 323.13281,554.06663 L 324.74942,552.77335 L 328.14431,554.38997 L 335.74238,557.94651 L 339.13727,560.0481 L 340.75387,562.47302 L 342.69381,566.83787 L 346.73534,569.42445 L 346.41202,570.71
|