From 294061b1ede82751c77b007332b83ae8e9a033b6 Mon Sep 17 00:00:00 2001 From: techfg Date: Sat, 20 Feb 2021 22:33:04 -0800 Subject: [PATCH] Release v1.5.4 --- CHANGELOG.md | 7 + README.md | 10 +- bower.json | 2 +- dist/jquery.imagemapster.js | 155 +++++++++++++--------- dist/jquery.imagemapster.min.js | 4 +- dist/jquery.imagemapster.min.js.map | 2 +- dist/jquery.imagemapster.zepto.js | 155 +++++++++++++--------- dist/jquery.imagemapster.zepto.min.js | 4 +- dist/jquery.imagemapster.zepto.min.js.map | 2 +- package-lock.json | 2 +- package.json | 2 +- 11 files changed, 209 insertions(+), 136 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e9eb09..6ebdf92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,13 @@ - Make callback data structures consistent - Improve docs +## Version 1.5.4 - 2021.02.20 +- [Issue 83](https://github.com/jamietre/ImageMapster/issues/83) Fix boundlist sync with selected state +- [Issue 377](https://github.com/jamietre/ImageMapster/issues/377) onConfigured not called after rebind +- [Issue 378](https://github.com/jamietre/ImageMapster/issues/378) drawn areas do not match selected state after rebind +- [Issue 380](https://github.com/jamietre/ImageMapster/issues/380) onGetList not called when isSelectable !== true +- [Issue 381](https://github.com/jamietre/ImageMapster/issues/381) tests not waiting for onConfigured before continuing + ## Version 1.5.3 - 2021.02.14 - [Issue 374](https://github.com/jamietre/ImageMapster/issues/374) Uncaught RangeError: Maximum call stack size exceeded when includeKeys has circular reference diff --git a/README.md b/README.md index 0cbfa83..ef9f79a 100644 --- a/README.md +++ b/README.md @@ -158,7 +158,7 @@ ImageMapster includes several examples. To view the examples: ## Zepto Compatibility -As of ImageMapster v1.3.2, ImageMapster contains full support for Zepto v1.2.0. The latest Zepto compatible version of ImageMapster is [1.5.3](https://github.com/jamietre/ImageMapster/releases/tag/v1.5.3). +As of ImageMapster v1.3.2, ImageMapster contains full support for Zepto v1.2.0. The latest Zepto compatible version of ImageMapster is [1.5.4](https://github.com/jamietre/ImageMapster/releases/tag/v1.5.4). Prior to ImageMapster v1.3.2 and with any version of Zepto except v1.2.0, ImageMapster is unlikely to work as expected. In the early versions of ImageMapster, Zepto support was maintained, however due to changes in Zepto, as of v1.2.5 of ImageMapster, support for Zepto compatability was not maintained as it required too much effort and pushing ImageMapster forward with jQuery was the priority. @@ -177,8 +177,8 @@ To use ImageMapster >= v1.3.2 < 2.0.0 with Zepto v.1.2.0, Zepto must contain the :warning: **_As of ImageMapster v1.3.0, if targeting ES5 browers, you must include a Promise polyfill such as [es6-promise](https://www.npmjs.com/package/es6-promise). See [Issue 341](https://github.com/jamietre/ImageMapster/issues/341) for details._** -1. [jsDelivr](https://www.jsdelivr.com/package/npm/imagemapster?version=1.5.3) - https://www.jsdelivr.com/package/npm/imagemapster?version=1.5.3 -2. [cdnjs](https://cdnjs.com/libraries/imagemapster/1.5.3) - https://cdnjs.com/libraries/imagemapster/1.5.3 +1. [jsDelivr](https://www.jsdelivr.com/package/npm/imagemapster?version=1.5.4) - https://www.jsdelivr.com/package/npm/imagemapster?version=1.5.4 +2. [cdnjs](https://cdnjs.com/libraries/imagemapster/1.5.4) - https://cdnjs.com/libraries/imagemapster/1.5.4 Use `jquery.imagemapster.zepto.min.js` @@ -194,7 +194,7 @@ Use `jquery.imagemapster.zepto.min.js` > ``` @@ -207,7 +207,7 @@ Using `webpack` and `zepto-modules` as an example: #### Install from NPM ```sh -npm install zepto-modules imagemapster@1.5.3 --save +npm install zepto-modules imagemapster@1.5.4 --save ``` #### src/yourzepto.js diff --git a/bower.json b/bower.json index d665471..47b3a07 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ImageMapster", - "version": "1.5.3", + "version": "1.5.4", "homepage": "https://github.com/jamietre/ImageMapster", "description": "jQuery plugin that activates areas in HTML imagemaps with support for highlighting, selecting, tooltips, resizing and more", "main": "dist/jquery.imagemapster.min.js", diff --git a/dist/jquery.imagemapster.js b/dist/jquery.imagemapster.js index 0056b1a..dd1a75d 100644 --- a/dist/jquery.imagemapster.js +++ b/dist/jquery.imagemapster.js @@ -1,5 +1,5 @@ /*! -* imagemapster - v1.5.3 - 2021-02-14 +* imagemapster - v1.5.4 - 2021-02-20 * https://github.com/jamietre/ImageMapster/ * Copyright (c) 2011 - 2021 James Treworgy * License: MIT @@ -99,15 +99,15 @@ } })(jQuery); -/* +/* core.js - ImageMapster core + ImageMapster core */ (function ($) { 'use strict'; - var mapster_version = '1.5.3'; + var mapster_version = '1.5.4'; // all public functions in $.mapster.impl are methods $.fn.mapster = function (method) { @@ -478,24 +478,6 @@ }); return result; }, - // Causes changes to the bound list based on the user action (select or deselect) - // area: the jQuery area object - // returns the matching elements from the bound list for the first area passed (normally only one should be passed, but - // a list can be passed - setBoundListProperties: function (opts, target, selected) { - target.each(function (_, e) { - if (opts.listSelectedClass) { - if (selected) { - $(e).addClass(opts.listSelectedClass); - } else { - $(e).removeClass(opts.listSelectedClass); - } - } - if (opts.listSelectedAttribute) { - $(e).prop(opts.listSelectedAttribute, selected); - } - }); - }, getMapDataIndex: function (obj) { var img, id; switch (obj.tagName && obj.tagName.toLowerCase()) { @@ -939,14 +921,7 @@ // Clean up after a group that applied to the same map function finishSetForMap(map_data) { $.each(area_list, function (_, el) { - var newState = setSelection(el); - if (map_data.options.boundList) { - m.setBoundListProperties( - map_data.options, - m.getBoundList(map_data.options, key_list), - newState - ); - } + setSelection(el); }); if (!selected) { map_data.removeSelectionFinish(); @@ -1026,6 +1001,7 @@ me.bindImages().then(function () { me.buildDataset(true); me.complete = true; + me.onConfigured(); }); //this.redrawSelections(); }, @@ -2410,10 +2386,6 @@ if (canChangeState) { ar.toggle(); } - - if (opts.boundList && opts.boundList.length > 0) { - m.setBoundListProperties(opts, list_target, ar.isSelected()); - } } mousedown.call(this, e); @@ -2735,6 +2707,63 @@ } }); }, + // Causes changes to the bound list based on the user action (select or deselect) + // area: the jQuery area object + // returns the matching elements from the bound list for the first area passed + // (normally only one should be passed, but a list can be passed) + setBoundListProperties: function (opts, target, selected) { + target.each(function (_, e) { + if (opts.listSelectedClass) { + if (selected) { + $(e).addClass(opts.listSelectedClass); + } else { + $(e).removeClass(opts.listSelectedClass); + } + } + if (opts.listSelectedAttribute) { + $(e).prop(opts.listSelectedAttribute, selected); + } + }); + }, + clearBoundListProperties: function (opts) { + var me = this; + if (!opts.boundList) { + return; + } + me.setBoundListProperties(opts, opts.boundList, false); + }, + refreshBoundList: function (opts) { + var me = this; + me.clearBoundListProperties(opts); + me.setBoundListProperties( + opts, + m.getBoundList(opts, me.getSelected()), + true + ); + }, + setBoundList: function (opts) { + var me = this, + sorted_list = me.data.slice(0), + sort_func; + if (opts.sortList) { + if (opts.sortList === 'desc') { + sort_func = function (a, b) { + return a === b ? 0 : a > b ? -1 : 1; + }; + } else { + sort_func = function (a, b) { + return a === b ? 0 : a < b ? -1 : 1; + }; + } + + sorted_list.sort(function (a, b) { + a = a.value; + b = b.value; + return sort_func(a, b); + }); + } + me.options.boundList = opts.onGetList.call(me.image, sorted_list); + }, ///called when images are done loading initialize: function () { var imgCopy, @@ -2746,8 +2775,6 @@ i, size, img, - sort_func, - sorted_list, scale, me = this, opts = me.options; @@ -2859,29 +2886,6 @@ u.setOpacity(me.images[1], 1); - if (opts.isSelectable && opts.onGetList) { - sorted_list = me.data.slice(0); - if (opts.sortList) { - if (opts.sortList === 'desc') { - sort_func = function (a, b) { - return a === b ? 0 : a > b ? -1 : 1; - }; - } else { - sort_func = function (a, b) { - return a === b ? 0 : a < b ? -1 : 1; - }; - } - - sorted_list.sort(function (a, b) { - a = a.value; - b = b.value; - return sort_func(a, b); - }); - } - - me.options.boundList = opts.onGetList.call(me.image, sorted_list); - } - me.complete = true; me.processCommandQueue(); @@ -2889,8 +2893,16 @@ me.configureAutoResize(); } + me.onConfigured(); + }, + + onConfigured: function () { + var me = this, + $img = $(me.image), + opts = me.options; + if (opts.onConfigured && typeof opts.onConfigured === 'function') { - opts.onConfigured.call(img, true); + opts.onConfigured.call($img, true); } }, @@ -2966,6 +2978,7 @@ if (rebind) { mapArea = me.mapAreas[$area.data('mapster') - 1]; mapArea.configure(curKey); + mapArea.areaDataXref = []; } else { mapArea = new m.MapArea(me, area, curKey); me.mapAreas.push(mapArea); @@ -3033,7 +3046,20 @@ // populate areas from config options me.setAreaOptions(opts.areas); - me.redrawSelections(); + if (opts.onGetList) { + me.setBoundList(opts); + } + + if (opts.boundList && opts.boundList.length > 0) { + me.refreshBoundList(opts); + } + + if (rebind) { + me.graphics.removeSelections(); + me.graphics.refreshSelections(); + } else { + me.redrawSelections(); + } }, processCommandQueue: function () { var cur, @@ -3407,6 +3433,13 @@ selected: state }); } + if (state_type === 'select' && this.owner.options.boundList) { + this.owner.setBoundListProperties( + this.owner.options, + m.getBoundList(this.owner.options, this.key), + state + ); + } }, // highlight this area diff --git a/dist/jquery.imagemapster.min.js b/dist/jquery.imagemapster.min.js index 137f07f..e43a2db 100644 --- a/dist/jquery.imagemapster.min.js +++ b/dist/jquery.imagemapster.min.js @@ -1,9 +1,9 @@ /*! -* imagemapster - v1.5.3 - 2021-02-14 +* imagemapster - v1.5.4 - 2021-02-20 * https://github.com/jamietre/ImageMapster/ * Copyright (c) 2011 - 2021 James Treworgy * License: MIT */ -!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(e,t){return void 0===t&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),a(t),t}:a(jQuery)}(function(jQuery){!function(a){"use strict";a.event&&a.event.special&&function(){var i,e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){return e=!0}});window.addEventListener("testPassive.mapster",function(){},t),window.removeEventListener("testPassive.mapster",function(){},t)}catch(e){}e&&(i=function(e,t,a){if(!e.includes("noPreventDefault"))return console.warn("non-passive events - listener not added"),!1;window.addEventListener(t,a,{passive:!0})},a.event.special.touchstart={setup:function(e,t,a){return i(t,"touchstart",a)}},a.event.special.touchend={setup:function(e,t,a){return i(t,"touchend",a)}})}()}(jQuery),function($){"use strict";var mapster_version="1.5.3",Aa,Ba,Ca;$.fn.mapster=function(e){var t=$.mapster.impl;return $.mapster.utils.isFunction(t[e])?t[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof e&&e?void $.error("Method "+e+" does not exist on jQuery.mapster"):t.bind.apply(this,arguments)},$.mapster={version:mapster_version,render_defaults:{isSelectable:!0,isDeselectable:!0,fade:!1,fadeDuration:150,fill:!0,fillColor:"000000",fillColorMask:"FFFFFF",fillOpacity:.7,highlight:!0,stroke:!1,strokeColor:"ff0000",strokeOpacity:1,strokeWidth:1,includeKeys:"",altImage:null,altImageId:null,altImages:{}},defaults:{clickNavigate:!1,navigateMode:"location",wrapClass:null,wrapCss:null,onGetList:null,sortList:!1,listenToList:!1,mapKey:"",mapValue:"",singleSelect:!1,listKey:"value",listSelectedAttribute:"selected",listSelectedClass:null,onClick:null,onMouseover:null,onMouseout:null,mouseoutDelay:0,onStateChange:null,boundList:null,onConfigured:null,configTimeout:3e4,noHrefIsMask:!0,scaleMap:!0,enableAutoResizeSupport:!1,autoResize:!1,autoResizeDelay:0,autoResizeDuration:0,onAutoResize:null,safeLoad:!1,areas:[]},shared_defaults:{render_highlight:{fade:!0},render_select:{fade:!1},staticState:null,selected:null},area_defaults:{includeKeys:"",isMask:!1},canvas_style:{position:"absolute",left:0,top:0,padding:0,border:0},hasCanvas:null,map_cache:[],hooks:{},addHook:function(e,t){this.hooks[e]=(this.hooks[e]||[]).push(t)},callHooks:function(e,a){$.each(this.hooks[e]||[],function(e,t){t.apply(a)})},utils:{when:{all:function(e){return Promise.all(e)},defer:function(){return new function(){this.promise=new Promise(function(e,t){this.resolve=e,this.reject=t}.bind(this)),this.then=this.promise.then.bind(this.promise),this.catch=this.promise.catch.bind(this.promise)}}},defer:function(){return this.when.defer()},subclass:function(a,i){function e(){var e=this,t=Array.prototype.slice.call(arguments,0);e.base=a.prototype,e.base.init=function(){a.prototype.constructor.apply(e,t)},i.apply(e,t)}return(e.prototype=new a).constructor=e},asArray:function(e){return e.constructor===Array?e:this.split(e)},split:function(e,t){for(var a,i=e.split(","),n=0;n=e.index;t--)m.map_cache[t].index--};function hasVml(){var e=$("
").appendTo("body");e.html('');var t=e[0].firstChild;t.style.behavior="url(#default#VML)";t=!t||"object"==typeof t.adj;return e.remove(),t}function namespaces(){return"object"==typeof document.namespaces?document.namespaces:null}function hasCanvas(){var e=namespaces();return(!e||!e.g_vml_)&&!!$("")[0].getContext}function merge_areas(a,e){var i,n=a.options.areas;e&&$.each(e,function(e,t){t&&t.key&&(0<=(i=u.indexOfProp(n,"key",t.key))?$.extend(n[i],t):n.push(t),(i=a.getDataForKey(t.key))&&$.extend(i.options,t))})}function merge_options(e,t){var a=u.updateProps({},t);delete a.areas,u.updateProps(e.options,a),merge_areas(e,t.areas),u.updateProps(e.area_options,e.options)}return me.get=function(e){var t=m.getMapData(this);if(!t||!t.complete)throw"Can't access data until binding complete.";return new m.Method(this,function(){return this.getSelected()},function(){return this.isSelected()},{name:"get",args:arguments,key:e,first:!0,allowAsync:!0,defaultReturn:""}).go()},me.data=function(e){return new m.Method(this,null,function(){return this},{name:"data",args:arguments,key:e}).go()},me.highlight=function(t){return new m.Method(this,function(){if(!1!==t){var e=this.highlightId;return 0<=e?this.data[e].key:null}this.ensureNoHighlight()},function(){this.highlight()},{name:"highlight",args:arguments,key:t,first:!0}).go()},me.keys=function(e,i){var n=[],a=m.getMapData(this);if(!a||!a.complete)throw"Can't access data until binding complete.";function o(e){var t,a=[];i?(t=e.areas(),$.each(t,function(e,t){a=a.concat(t.keys)})):a.push(e.key),$.each(a,function(e,t){$.inArray(t,n)<0&&n.push(t)})}return a&&a.complete?("string"==typeof e?i?o(a.getDataForKey(e)):n=[a.getKeysForGroup(e)]:(i=e,this.each(function(e,t){"AREA"===t.nodeName&&o(a.getDataForArea(t))})),n.join(",")):""},me.select=function(){me.set.call(this,!0)},me.deselect=function(){me.set.call(this,!1)},me.set=function(i,n,e){var o,s,r,c,l=e;function h(e){e&&$.inArray(e,c)<0&&(c.push(e),r+=(""===r?"":",")+e.key)}function p(a){$.each(c,function(e,t){t=function(e){var t=i;if(e){switch(i){case!0:e.select(l);break;case!1:e.deselect(!0);break;default:t=e.toggle(l)}return t}}(t);a.options.boundList&&m.setBoundListProperties(a.options,m.getBoundList(a.options,r),t)}),i||a.removeSelectionFinish()}return this.filter("img,area").each(function(e,t){var a;(s=m.getMapData(t))!==o&&(o&&p(o),c=[],r=""),s&&(a="","IMG"===t.nodeName.toUpperCase()?m.queueCommand(s,$(t),"set",[i,n,l])||(n instanceof Array?n.length&&(a=n.join(",")):a=n,a&&$.each(u.split(a),function(e,t){h(s.getDataForKey(t.toString())),o=s})):(l=n,m.queueCommand(s,$(t),"set",[i,l])||(h(s.getDataForArea(t)),o=s)))}),s&&p(s),this},me.unbind=function(e){return new m.Method(this,function(){this.clearEvents(),this.clearMapData(e),removeMap(this)},null,{name:"unbind",args:arguments}).go()},me.rebind=function(t){return new m.Method(this,function(){var e=this;e.complete=!1,e.configureOptions(t),e.bindImages().then(function(){e.buildDataset(!0),e.complete=!0})},null,{name:"rebind",args:arguments}).go()},me.get_options=function(e,t){var a=u.isBool(e)?e:t;return new m.Method(this,function(){var e=$.extend({},this.options);return a&&(e.render_select=u.updateProps({},m.render_defaults,e,e.render_select),e.render_highlight=u.updateProps({},m.render_defaults,e,e.render_highlight)),e},function(){return a?this.effectiveOptions():this.options},{name:"get_options",args:arguments,first:!0,allowAsync:!0,key:e}).go()},me.set_options=function(e){return new m.Method(this,function(){merge_options(this,e)},null,{name:"set_options",args:arguments}).go()},me.unload=function(){for(var e=m.map_cache.length-1;0<=e;e--)m.map_cache[e]&&me.unbind.call($(m.map_cache[e].image));me.graphics=null},me.snapshot=function(){return new m.Method(this,function(){$.each(this.data,function(e,t){t.selected=!1}),this.base_canvas=this.graphics.createVisibleCanvas(this),$(this.image).before(this.base_canvas)},null,{name:"snapshot"}).go()},me.state=function(){var a,i=null;return $(this).each(function(e,t){if("IMG"===t.nodeName)return(a=m.getMapData(t))&&(i=a.state()),!1}),i},me.bind=function(o){return this.each(function(e,t){var a,i=$(t),n=m.getMapData(t);if(n){if(me.unbind.apply(i),!n.complete)return!0;n=null}if(t=(a=this.getAttribute("usemap"))&&$('map[name="'+a.substr(1)+'"]'),!(i.is("img")&&a&&0')[0]},clearHighlight:function(){var e=this.map_data.overlay_canvas;e.getContext("2d").clearRect(0,0,e.width,e.height)},refreshSelections:function(){var e=this.map_data,t=e.base_canvas;e.base_canvas=this.createVisibleCanvas(e),h(e.base_canvas).hide(),h(t).before(e.base_canvas),e.redrawSelections(),h(e.base_canvas).show(),h(t).remove()}},o={renderShape:function(e,t,a){var i,n=this,o=e.coords(),s=n.elementName?'name="'+n.elementName+'" ':"",r=a?'class="'+a+'" ':"",c='',l=t.stroke?" strokeweight="+t.strokeWidth+' stroked="t" strokecolor="#'+t.strokeColor+'"':' stroked="f"',u=t.fill?' filled="t"':' filled="f"';switch(e.shape){case"rect":case"rectangle":i="'+c+"";break;case"poly":case"polygon":i="'+c+"";break;case"circ":case"circle":i="'+c+""}return e=h(i),h(n.canvas).append(e),e},render:function(){var a,i=this;return h.each(this.shapes,function(e,t){i.renderShape(t.mapArea,t.options)}),this.masks.length&&h.each(this.masks,function(e,t){a=c.updateProps({},t.options,{fillOpacity:1,fillColor:t.options.fillColorMask}),i.renderShape(t.mapArea,a,"mapster_mask")}),this.active=!1,this.canvas},createCanvasFor:function(e){var t=e.scaleInfo.width,e=e.scaleInfo.height;return h('')[0]},clearHighlight:function(){h(this.map_data.overlay_canvas).children().remove()},removeSelections:function(e){(0<=e?h(this.map_data.base_canvas).find('[name="static_'+e.toString()+'"]'):h(this.map_data.base_canvas).children()).remove()}},h.each(["renderShape","addAltImage","render","createCanvasFor","clearHighlight","removeSelections","refreshSelections"],function(e,t){var a;i[t]=(a=t,function(){return i[a]=(r.hasCanvas()?n:o)[a]||s,i[a].apply(this,arguments)})})}(jQuery),function(o){"use strict";var e=o.mapster,n=e.utils,t=[];e.MapImages=function(e){this.owner=e,this.clear()},e.MapImages.prototype={constructor:e.MapImages,slice:function(){return t.slice.apply(this,arguments)},splice:function(){return t.slice.apply(this.status,arguments),t.slice.apply(this,arguments)},complete:function(){return o.inArray(!1,this.status)<0},_add:function(e){e=t.push.call(this,e)-1;return this.status[e]=!1,e},indexOf:function(e){return n.indexOf(this,e)},clear:function(){var a=this;a.ids&&0").addClass("mapster_el").hide(),a=n._add(e[0]),e.on("load.mapster",function(e){n.imageLoaded.call(n,e)}).on("error.mapster",function(e){n.imageLoadError.call(n,e)}),e.attr("src",i)}else a=n._add(o(e)[0]);if(t){if(this[t])throw t+" is already used or is not available as an altImage alias.";n.ids.push(t),n[t]=n[a]}return a}},bind:function(){var t=this,a=t.owner.options.configTimeout/200,i=function(){for(var e=t.length;0
'),u.wrapClass&&(!0===u.wrapClass?a.addClass(o[0].className):a.addClass(u.wrapClass))),l.wrapper=a,l.scaleInfo=c=d.scaleMap(l.images[0],l.images[1],u.scaleMap),l.base_canvas=t=l.graphics.createVisibleCanvas(l),l.overlay_canvas=r=l.graphics.createVisibleCanvas(l),e=y(l.images[1]).addClass("mapster_el "+l.images[0].className).attr({id:null,usemap:null}),(n=d.size(l.images[0])).complete&&e.css({width:n.width,height:n.height}),l.buildDataset(),c=y.extend({display:"block",position:"relative",padding:0},!0===u.enableAutoResizeSupport?{}:{width:c.width,height:c.height}),u.wrapCss&&y.extend(c,u.wrapCss),o.parent()[0]!==l.wrapper[0]&&o.before(l.wrapper),a.css(c),y(l.images.slice(2)).hide(),i=1;iw&&t[1]>b)return v=t,!(s=!0)}),s||(v=[l,u])),v}}(jQuery),function(d){"use strict";var f=d.mapster,m=f.utils,e=f.MapArea.prototype;f.utils.getScaleInfo=function(e,t){var a;return t?.98<(a=e.width/t.width||e.height/t.height)&&a<1.02&&(a=1):(a=1,t=e),{scale:1!==a,scalePct:a,realWidth:t.width,realHeight:t.height,width:e.width,height:e.height,ratio:e.width/e.height}},f.utils.scaleMap=function(e,t,a){e=m.size(e),t=m.size(t,!0);if(!t.complete())throw"Another script, such as an extension, appears to be interfering with image loading. Please let us know about this.";return e.complete()||(e=t),this.getScaleInfo(e,a?t:null)},f.MapData.prototype.resize=function(t,a,i,n){var o,s,r,c,e,l=this;function u(e,t,a){f.hasCanvas()?(e.width=t,e.height=a):(d(e).width(t),d(e).height(a))}function h(){var e;u(l.overlay_canvas,t,a),0<=c&&((e=l.data[c]).tempOptions={fade:!1},l.getDataForKey(e.key).highlight(),e.tempOptions=null),u(l.base_canvas,t,a),l.redrawSelections(),l.currentAction="",m.isFunction(n)&&n(),l.processCommandQueue()}function p(){d(l.image).css(r),l.scaleInfo=m.getScaleInfo({width:t,height:a},{width:l.scaleInfo.realWidth,height:l.scaleInfo.realHeight}),d.each(l.data,function(e,t){d.each(t.areas(),function(e,t){t.resize()})})}n=n||i,l.scaleInfo.width===t&&l.scaleInfo.height===a||(c=l.highlightId,t||(e=a/l.scaleInfo.realHeight,t=Math.round(l.scaleInfo.realWidth*e)),a||(e=t/l.scaleInfo.realWidth,a=Math.round(l.scaleInfo.realHeight*e)),r={width:String(t)+"px",height:String(a)+"px"},f.hasCanvas()||d(l.base_canvas).children().remove(),e=d(l.wrapper).find(".mapster_el"),!0!==l.options.enableAutoResizeSupport&&(e=e.add(l.wrapper)),i?(s=[],l.currentAction="resizing",e.filter(":visible").each(function(e,t){o=m.defer(),s.push(o),d(t).animate(r,{duration:i,complete:o.resolve,easing:"linear"})}),e.filter(":hidden").css(r),o=m.defer(),s.push(o),m.when.all(s).then(h),p(),o.resolve()):(e.css(r),p(),h()))},f.MapData.prototype.autoResize=function(e,t){this.resize(d(this.wrapper).width(),null,e,t)},f.MapData.prototype.configureAutoResize=function(){var e=this,t=e.instanceEventNamespace();function a(){!0===e.options.autoResize&&e.autoResize(e.options.autoResizeDuration,e.options.onAutoResize)}d(e.image).on("load"+t,a),d(window).on("focus"+t,a),d(window).on("resize"+t,function(){e.autoResizeTimer&&clearTimeout(e.autoResizeTimer),e.autoResizeTimer=setTimeout(a,e.options.autoResizeDelay)}),d(window).on("readystatechange"+t,a),d(window.document).on("fullscreenchange"+t,a),a()},f.MapArea=m.subclass(f.MapArea,function(){this.base.init(),this.owner.scaleInfo.scale&&this.resize()}),e.coords=function(e,t){var a,i=[],n=e||this.owner.scaleInfo.scalePct,o=t||0;if(1===n&&0===t)return this.originalCoords;for(a=0;a',showToolTip:!1,toolTip:null,toolTipFade:!0,toolTipClose:["area-mouseout","image-mouseout","generic-mouseout"],onShowToolTip:null,onHideToolTip:null}),c.extend(e.area_defaults,{toolTip:null,toolTipClose:null}),e.MapData.prototype.clearToolTip=function(){this.activeToolTip&&(this.activeToolTip.stop().remove(),this.activeToolTip=null,this.activeToolTipID=null,l.ifFunction(this.options.onHideToolTip,this))},e.AreaData.prototype.showToolTip=function(e,t){var a,i,n,o=this,s=o.owner,r=o.effectiveOptions();if(t=t?c.extend({},t):{},e=e||r.toolTip,a=t.closeEvents||r.toolTipClose||s.options.toolTipClose||"tooltip-click",n=void 0!==t.template?t.template:s.options.toolTipContainer,t.closeEvents="string"==typeof a?a=l.split(a):a,t.fadeDuration=t.fadeDuration||(s.options.toolTipFade?s.options.fadeDuration||r.fadeDuration:0),i=o.area||c.map(o.areas(),function(e){return e.area}),s.activeToolTipID!==o.areaId){s.clearToolTip();var e=l.isFunction(e)?e({key:this.key,target:i}):e;if(e)return s.activeToolTip=e=u(e,n,t.css),s.activeToolTipID=o.areaId,n=function(){s.clearToolTip()},h(a,"area-click","click",c(s.map),null,n),h(a,"tooltip-click","click",e,null,n),h(a,"image-mouseout","mouseout",c(s.image),function(e){return e.relatedTarget&&"AREA"!==e.relatedTarget.nodeName&&e.relatedTarget!==o.area},n),h(a,"image-click","click",c(s.image),null,n),p(e,i,s.image,t.container,t),l.ifFunction(s.options.onShowToolTip,o.area,{toolTip:e,options:{},areaOptions:r,key:o.key,selected:o.isSelected()}),e}},e.impl.tooltip=function(s,r){return new e.Method(this,function(){var e,t,a,i,n,o=this;s?(n=(e=c(s))&&0=e.index;t--)m.map_cache[t].index--};function hasVml(){var e=$("
").appendTo("body");e.html('');var t=e[0].firstChild;t.style.behavior="url(#default#VML)";t=!t||"object"==typeof t.adj;return e.remove(),t}function namespaces(){return"object"==typeof document.namespaces?document.namespaces:null}function hasCanvas(){var e=namespaces();return(!e||!e.g_vml_)&&!!$("")[0].getContext}function merge_areas(a,e){var i,n=a.options.areas;e&&$.each(e,function(e,t){t&&t.key&&(0<=(i=u.indexOfProp(n,"key",t.key))?$.extend(n[i],t):n.push(t),(i=a.getDataForKey(t.key))&&$.extend(i.options,t))})}function merge_options(e,t){var a=u.updateProps({},t);delete a.areas,u.updateProps(e.options,a),merge_areas(e,t.areas),u.updateProps(e.area_options,e.options)}return me.get=function(e){var t=m.getMapData(this);if(!t||!t.complete)throw"Can't access data until binding complete.";return new m.Method(this,function(){return this.getSelected()},function(){return this.isSelected()},{name:"get",args:arguments,key:e,first:!0,allowAsync:!0,defaultReturn:""}).go()},me.data=function(e){return new m.Method(this,null,function(){return this},{name:"data",args:arguments,key:e}).go()},me.highlight=function(t){return new m.Method(this,function(){if(!1!==t){var e=this.highlightId;return 0<=e?this.data[e].key:null}this.ensureNoHighlight()},function(){this.highlight()},{name:"highlight",args:arguments,key:t,first:!0}).go()},me.keys=function(e,i){var n=[],a=m.getMapData(this);if(!a||!a.complete)throw"Can't access data until binding complete.";function o(e){var t,a=[];i?(t=e.areas(),$.each(t,function(e,t){a=a.concat(t.keys)})):a.push(e.key),$.each(a,function(e,t){$.inArray(t,n)<0&&n.push(t)})}return a&&a.complete?("string"==typeof e?i?o(a.getDataForKey(e)):n=[a.getKeysForGroup(e)]:(i=e,this.each(function(e,t){"AREA"===t.nodeName&&o(a.getDataForArea(t))})),n.join(",")):""},me.select=function(){me.set.call(this,!0)},me.deselect=function(){me.set.call(this,!1)},me.set=function(i,n,e){var o,s,r,c,l=e;function h(e){e&&$.inArray(e,c)<0&&(c.push(e),r+=(""===r?"":",")+e.key)}function p(e){$.each(c,function(e,t){!function(e){if(e){switch(i){case!0:e.select(l);break;case!1:e.deselect(!0);break;default:e.toggle(l)}}}(t)}),i||e.removeSelectionFinish()}return this.filter("img,area").each(function(e,t){var a;(s=m.getMapData(t))!==o&&(o&&p(o),c=[],r=""),s&&(a="","IMG"===t.nodeName.toUpperCase()?m.queueCommand(s,$(t),"set",[i,n,l])||(n instanceof Array?n.length&&(a=n.join(",")):a=n,a&&$.each(u.split(a),function(e,t){h(s.getDataForKey(t.toString())),o=s})):(l=n,m.queueCommand(s,$(t),"set",[i,l])||(h(s.getDataForArea(t)),o=s)))}),s&&p(s),this},me.unbind=function(e){return new m.Method(this,function(){this.clearEvents(),this.clearMapData(e),removeMap(this)},null,{name:"unbind",args:arguments}).go()},me.rebind=function(t){return new m.Method(this,function(){var e=this;e.complete=!1,e.configureOptions(t),e.bindImages().then(function(){e.buildDataset(!0),e.complete=!0,e.onConfigured()})},null,{name:"rebind",args:arguments}).go()},me.get_options=function(e,t){var a=u.isBool(e)?e:t;return new m.Method(this,function(){var e=$.extend({},this.options);return a&&(e.render_select=u.updateProps({},m.render_defaults,e,e.render_select),e.render_highlight=u.updateProps({},m.render_defaults,e,e.render_highlight)),e},function(){return a?this.effectiveOptions():this.options},{name:"get_options",args:arguments,first:!0,allowAsync:!0,key:e}).go()},me.set_options=function(e){return new m.Method(this,function(){merge_options(this,e)},null,{name:"set_options",args:arguments}).go()},me.unload=function(){for(var e=m.map_cache.length-1;0<=e;e--)m.map_cache[e]&&me.unbind.call($(m.map_cache[e].image));me.graphics=null},me.snapshot=function(){return new m.Method(this,function(){$.each(this.data,function(e,t){t.selected=!1}),this.base_canvas=this.graphics.createVisibleCanvas(this),$(this.image).before(this.base_canvas)},null,{name:"snapshot"}).go()},me.state=function(){var a,i=null;return $(this).each(function(e,t){if("IMG"===t.nodeName)return(a=m.getMapData(t))&&(i=a.state()),!1}),i},me.bind=function(o){return this.each(function(e,t){var a,i=$(t),n=m.getMapData(t);if(n){if(me.unbind.apply(i),!n.complete)return!0;n=null}if(t=(a=this.getAttribute("usemap"))&&$('map[name="'+a.substr(1)+'"]'),!(i.is("img")&&a&&0')[0]},clearHighlight:function(){var e=this.map_data.overlay_canvas;e.getContext("2d").clearRect(0,0,e.width,e.height)},refreshSelections:function(){var e=this.map_data,t=e.base_canvas;e.base_canvas=this.createVisibleCanvas(e),h(e.base_canvas).hide(),h(t).before(e.base_canvas),e.redrawSelections(),h(e.base_canvas).show(),h(t).remove()}},o={renderShape:function(e,t,a){var i,n=this,o=e.coords(),s=n.elementName?'name="'+n.elementName+'" ':"",r=a?'class="'+a+'" ':"",c='',l=t.stroke?" strokeweight="+t.strokeWidth+' stroked="t" strokecolor="#'+t.strokeColor+'"':' stroked="f"',u=t.fill?' filled="t"':' filled="f"';switch(e.shape){case"rect":case"rectangle":i="'+c+"";break;case"poly":case"polygon":i="'+c+"";break;case"circ":case"circle":i="'+c+""}return e=h(i),h(n.canvas).append(e),e},render:function(){var a,i=this;return h.each(this.shapes,function(e,t){i.renderShape(t.mapArea,t.options)}),this.masks.length&&h.each(this.masks,function(e,t){a=c.updateProps({},t.options,{fillOpacity:1,fillColor:t.options.fillColorMask}),i.renderShape(t.mapArea,a,"mapster_mask")}),this.active=!1,this.canvas},createCanvasFor:function(e){var t=e.scaleInfo.width,e=e.scaleInfo.height;return h('')[0]},clearHighlight:function(){h(this.map_data.overlay_canvas).children().remove()},removeSelections:function(e){(0<=e?h(this.map_data.base_canvas).find('[name="static_'+e.toString()+'"]'):h(this.map_data.base_canvas).children()).remove()}},h.each(["renderShape","addAltImage","render","createCanvasFor","clearHighlight","removeSelections","refreshSelections"],function(e,t){var a;i[t]=(a=t,function(){return i[a]=(r.hasCanvas()?n:o)[a]||s,i[a].apply(this,arguments)})})}(jQuery),function(o){"use strict";var e=o.mapster,n=e.utils,t=[];e.MapImages=function(e){this.owner=e,this.clear()},e.MapImages.prototype={constructor:e.MapImages,slice:function(){return t.slice.apply(this,arguments)},splice:function(){return t.slice.apply(this.status,arguments),t.slice.apply(this,arguments)},complete:function(){return o.inArray(!1,this.status)<0},_add:function(e){e=t.push.call(this,e)-1;return this.status[e]=!1,e},indexOf:function(e){return n.indexOf(this,e)},clear:function(){var a=this;a.ids&&0").addClass("mapster_el").hide(),a=n._add(e[0]),e.on("load.mapster",function(e){n.imageLoaded.call(n,e)}).on("error.mapster",function(e){n.imageLoadError.call(n,e)}),e.attr("src",i)}else a=n._add(o(e)[0]);if(t){if(this[t])throw t+" is already used or is not available as an altImage alias.";n.ids.push(t),n[t]=n[a]}return a}},bind:function(){var t=this,a=t.owner.options.configTimeout/200,i=function(){for(var e=t.length;0
'),l.wrapClass&&(!0===l.wrapClass?i.addClass(s[0].className):i.addClass(l.wrapClass))),c.wrapper=i,c.scaleInfo=r=d.scaleMap(c.images[0],c.images[1],l.scaleMap),c.base_canvas=t=c.graphics.createVisibleCanvas(c),c.overlay_canvas=a=c.graphics.createVisibleCanvas(c),e=y(c.images[1]).addClass("mapster_el "+c.images[0].className).attr({id:null,usemap:null}),(o=d.size(c.images[0])).complete&&e.css({width:o.width,height:o.height}),c.buildDataset(),r=y.extend({display:"block",position:"relative",padding:0},!0===l.enableAutoResizeSupport?{}:{width:r.width,height:r.height}),l.wrapCss&&y.extend(r,l.wrapCss),s.parent()[0]!==c.wrapper[0]&&s.before(c.wrapper),i.css(r),y(c.images.slice(2)).hide(),n=1;nw&&t[1]>b)return v=t,!(s=!0)}),s||(v=[l,u])),v}}(jQuery),function(d){"use strict";var f=d.mapster,m=f.utils,e=f.MapArea.prototype;f.utils.getScaleInfo=function(e,t){var a;return t?.98<(a=e.width/t.width||e.height/t.height)&&a<1.02&&(a=1):(a=1,t=e),{scale:1!==a,scalePct:a,realWidth:t.width,realHeight:t.height,width:e.width,height:e.height,ratio:e.width/e.height}},f.utils.scaleMap=function(e,t,a){e=m.size(e),t=m.size(t,!0);if(!t.complete())throw"Another script, such as an extension, appears to be interfering with image loading. Please let us know about this.";return e.complete()||(e=t),this.getScaleInfo(e,a?t:null)},f.MapData.prototype.resize=function(t,a,i,n){var o,s,r,c,e,l=this;function u(e,t,a){f.hasCanvas()?(e.width=t,e.height=a):(d(e).width(t),d(e).height(a))}function h(){var e;u(l.overlay_canvas,t,a),0<=c&&((e=l.data[c]).tempOptions={fade:!1},l.getDataForKey(e.key).highlight(),e.tempOptions=null),u(l.base_canvas,t,a),l.redrawSelections(),l.currentAction="",m.isFunction(n)&&n(),l.processCommandQueue()}function p(){d(l.image).css(r),l.scaleInfo=m.getScaleInfo({width:t,height:a},{width:l.scaleInfo.realWidth,height:l.scaleInfo.realHeight}),d.each(l.data,function(e,t){d.each(t.areas(),function(e,t){t.resize()})})}n=n||i,l.scaleInfo.width===t&&l.scaleInfo.height===a||(c=l.highlightId,t||(e=a/l.scaleInfo.realHeight,t=Math.round(l.scaleInfo.realWidth*e)),a||(e=t/l.scaleInfo.realWidth,a=Math.round(l.scaleInfo.realHeight*e)),r={width:String(t)+"px",height:String(a)+"px"},f.hasCanvas()||d(l.base_canvas).children().remove(),e=d(l.wrapper).find(".mapster_el"),!0!==l.options.enableAutoResizeSupport&&(e=e.add(l.wrapper)),i?(s=[],l.currentAction="resizing",e.filter(":visible").each(function(e,t){o=m.defer(),s.push(o),d(t).animate(r,{duration:i,complete:o.resolve,easing:"linear"})}),e.filter(":hidden").css(r),o=m.defer(),s.push(o),m.when.all(s).then(h),p(),o.resolve()):(e.css(r),p(),h()))},f.MapData.prototype.autoResize=function(e,t){this.resize(d(this.wrapper).width(),null,e,t)},f.MapData.prototype.configureAutoResize=function(){var e=this,t=e.instanceEventNamespace();function a(){!0===e.options.autoResize&&e.autoResize(e.options.autoResizeDuration,e.options.onAutoResize)}d(e.image).on("load"+t,a),d(window).on("focus"+t,a),d(window).on("resize"+t,function(){e.autoResizeTimer&&clearTimeout(e.autoResizeTimer),e.autoResizeTimer=setTimeout(a,e.options.autoResizeDelay)}),d(window).on("readystatechange"+t,a),d(window.document).on("fullscreenchange"+t,a),a()},f.MapArea=m.subclass(f.MapArea,function(){this.base.init(),this.owner.scaleInfo.scale&&this.resize()}),e.coords=function(e,t){var a,i=[],n=e||this.owner.scaleInfo.scalePct,o=t||0;if(1===n&&0===t)return this.originalCoords;for(a=0;a',showToolTip:!1,toolTip:null,toolTipFade:!0,toolTipClose:["area-mouseout","image-mouseout","generic-mouseout"],onShowToolTip:null,onHideToolTip:null}),c.extend(e.area_defaults,{toolTip:null,toolTipClose:null}),e.MapData.prototype.clearToolTip=function(){this.activeToolTip&&(this.activeToolTip.stop().remove(),this.activeToolTip=null,this.activeToolTipID=null,l.ifFunction(this.options.onHideToolTip,this))},e.AreaData.prototype.showToolTip=function(e,t){var a,i,n,o=this,s=o.owner,r=o.effectiveOptions();if(t=t?c.extend({},t):{},e=e||r.toolTip,a=t.closeEvents||r.toolTipClose||s.options.toolTipClose||"tooltip-click",n=void 0!==t.template?t.template:s.options.toolTipContainer,t.closeEvents="string"==typeof a?a=l.split(a):a,t.fadeDuration=t.fadeDuration||(s.options.toolTipFade?s.options.fadeDuration||r.fadeDuration:0),i=o.area||c.map(o.areas(),function(e){return e.area}),s.activeToolTipID!==o.areaId){s.clearToolTip();var e=l.isFunction(e)?e({key:this.key,target:i}):e;if(e)return s.activeToolTip=e=u(e,n,t.css),s.activeToolTipID=o.areaId,n=function(){s.clearToolTip()},h(a,"area-click","click",c(s.map),null,n),h(a,"tooltip-click","click",e,null,n),h(a,"image-mouseout","mouseout",c(s.image),function(e){return e.relatedTarget&&"AREA"!==e.relatedTarget.nodeName&&e.relatedTarget!==o.area},n),h(a,"image-click","click",c(s.image),null,n),p(e,i,s.image,t.container,t),l.ifFunction(s.options.onShowToolTip,o.area,{toolTip:e,options:{},areaOptions:r,key:o.key,selected:o.isSelected()}),e}},e.impl.tooltip=function(s,r){return new e.Method(this,function(){var e,t,a,i,n,o=this;s?(n=(e=c(s))&&0 0) { - m.setBoundListProperties(opts, list_target, ar.isSelected()); - } } mousedown.call(this, e); @@ -2761,6 +2733,63 @@ } }); }, + // Causes changes to the bound list based on the user action (select or deselect) + // area: the jQuery area object + // returns the matching elements from the bound list for the first area passed + // (normally only one should be passed, but a list can be passed) + setBoundListProperties: function (opts, target, selected) { + target.each(function (_, e) { + if (opts.listSelectedClass) { + if (selected) { + $(e).addClass(opts.listSelectedClass); + } else { + $(e).removeClass(opts.listSelectedClass); + } + } + if (opts.listSelectedAttribute) { + $(e).prop(opts.listSelectedAttribute, selected); + } + }); + }, + clearBoundListProperties: function (opts) { + var me = this; + if (!opts.boundList) { + return; + } + me.setBoundListProperties(opts, opts.boundList, false); + }, + refreshBoundList: function (opts) { + var me = this; + me.clearBoundListProperties(opts); + me.setBoundListProperties( + opts, + m.getBoundList(opts, me.getSelected()), + true + ); + }, + setBoundList: function (opts) { + var me = this, + sorted_list = me.data.slice(0), + sort_func; + if (opts.sortList) { + if (opts.sortList === 'desc') { + sort_func = function (a, b) { + return a === b ? 0 : a > b ? -1 : 1; + }; + } else { + sort_func = function (a, b) { + return a === b ? 0 : a < b ? -1 : 1; + }; + } + + sorted_list.sort(function (a, b) { + a = a.value; + b = b.value; + return sort_func(a, b); + }); + } + me.options.boundList = opts.onGetList.call(me.image, sorted_list); + }, ///called when images are done loading initialize: function () { var imgCopy, @@ -2772,8 +2801,6 @@ i, size, img, - sort_func, - sorted_list, scale, me = this, opts = me.options; @@ -2885,29 +2912,6 @@ u.setOpacity(me.images[1], 1); - if (opts.isSelectable && opts.onGetList) { - sorted_list = me.data.slice(0); - if (opts.sortList) { - if (opts.sortList === 'desc') { - sort_func = function (a, b) { - return a === b ? 0 : a > b ? -1 : 1; - }; - } else { - sort_func = function (a, b) { - return a === b ? 0 : a < b ? -1 : 1; - }; - } - - sorted_list.sort(function (a, b) { - a = a.value; - b = b.value; - return sort_func(a, b); - }); - } - - me.options.boundList = opts.onGetList.call(me.image, sorted_list); - } - me.complete = true; me.processCommandQueue(); @@ -2915,8 +2919,16 @@ me.configureAutoResize(); } + me.onConfigured(); + }, + + onConfigured: function () { + var me = this, + $img = $(me.image), + opts = me.options; + if (opts.onConfigured && typeof opts.onConfigured === 'function') { - opts.onConfigured.call(img, true); + opts.onConfigured.call($img, true); } }, @@ -2992,6 +3004,7 @@ if (rebind) { mapArea = me.mapAreas[$area.data('mapster') - 1]; mapArea.configure(curKey); + mapArea.areaDataXref = []; } else { mapArea = new m.MapArea(me, area, curKey); me.mapAreas.push(mapArea); @@ -3059,7 +3072,20 @@ // populate areas from config options me.setAreaOptions(opts.areas); - me.redrawSelections(); + if (opts.onGetList) { + me.setBoundList(opts); + } + + if (opts.boundList && opts.boundList.length > 0) { + me.refreshBoundList(opts); + } + + if (rebind) { + me.graphics.removeSelections(); + me.graphics.refreshSelections(); + } else { + me.redrawSelections(); + } }, processCommandQueue: function () { var cur, @@ -3433,6 +3459,13 @@ selected: state }); } + if (state_type === 'select' && this.owner.options.boundList) { + this.owner.setBoundListProperties( + this.owner.options, + m.getBoundList(this.owner.options, this.key), + state + ); + } }, // highlight this area diff --git a/dist/jquery.imagemapster.zepto.min.js b/dist/jquery.imagemapster.zepto.min.js index cfaa3d1..c7af2c9 100644 --- a/dist/jquery.imagemapster.zepto.min.js +++ b/dist/jquery.imagemapster.zepto.min.js @@ -1,9 +1,9 @@ /*! -* imagemapster - v1.5.3 - 2021-02-14 +* imagemapster - v1.5.4 - 2021-02-20 * https://github.com/jamietre/ImageMapster/ * Copyright (c) 2011 - 2021 James Treworgy * License: MIT */ -!function(e,a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(e,t){return void 0===t&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),a(t),t}:a(e.jQuery||e.Zepto)}("undefined"!=typeof self?self:this,function(jQuery){!function(i){"use strict";i.fn.stop||(i.fn.stop=function(){return this}),i.each(["Height","Width"],function(e,t){var a="outer"+t;i.fn[a]||(i.fn[a]=function(){return this[t.toLowerCase()]()})})}(jQuery),function(a){"use strict";a.event&&a.event.special&&function(){var i,e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){return e=!0}});window.addEventListener("testPassive.mapster",function(){},t),window.removeEventListener("testPassive.mapster",function(){},t)}catch(e){}e&&(i=function(e,t,a){if(!e.includes("noPreventDefault"))return console.warn("non-passive events - listener not added"),!1;window.addEventListener(t,a,{passive:!0})},a.event.special.touchstart={setup:function(e,t,a){return i(t,"touchstart",a)}},a.event.special.touchend={setup:function(e,t,a){return i(t,"touchend",a)}})}()}(jQuery),function($){"use strict";var mapster_version="1.5.3",Ha,Ia,Ja;$.fn.mapster=function(e){var t=$.mapster.impl;return $.mapster.utils.isFunction(t[e])?t[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof e&&e?void $.error("Method "+e+" does not exist on jQuery.mapster"):t.bind.apply(this,arguments)},$.mapster={version:mapster_version,render_defaults:{isSelectable:!0,isDeselectable:!0,fade:!1,fadeDuration:150,fill:!0,fillColor:"000000",fillColorMask:"FFFFFF",fillOpacity:.7,highlight:!0,stroke:!1,strokeColor:"ff0000",strokeOpacity:1,strokeWidth:1,includeKeys:"",altImage:null,altImageId:null,altImages:{}},defaults:{clickNavigate:!1,navigateMode:"location",wrapClass:null,wrapCss:null,onGetList:null,sortList:!1,listenToList:!1,mapKey:"",mapValue:"",singleSelect:!1,listKey:"value",listSelectedAttribute:"selected",listSelectedClass:null,onClick:null,onMouseover:null,onMouseout:null,mouseoutDelay:0,onStateChange:null,boundList:null,onConfigured:null,configTimeout:3e4,noHrefIsMask:!0,scaleMap:!0,enableAutoResizeSupport:!1,autoResize:!1,autoResizeDelay:0,autoResizeDuration:0,onAutoResize:null,safeLoad:!1,areas:[]},shared_defaults:{render_highlight:{fade:!0},render_select:{fade:!1},staticState:null,selected:null},area_defaults:{includeKeys:"",isMask:!1},canvas_style:{position:"absolute",left:0,top:0,padding:0,border:0},hasCanvas:null,map_cache:[],hooks:{},addHook:function(e,t){this.hooks[e]=(this.hooks[e]||[]).push(t)},callHooks:function(e,a){$.each(this.hooks[e]||[],function(e,t){t.apply(a)})},utils:{when:{all:function(e){return Promise.all(e)},defer:function(){return new function(){this.promise=new Promise(function(e,t){this.resolve=e,this.reject=t}.bind(this)),this.then=this.promise.then.bind(this.promise),this.catch=this.promise.catch.bind(this.promise)}}},defer:function(){return this.when.defer()},subclass:function(a,i){function e(){var e=this,t=Array.prototype.slice.call(arguments,0);e.base=a.prototype,e.base.init=function(){a.prototype.constructor.apply(e,t)},i.apply(e,t)}return(e.prototype=new a).constructor=e},asArray:function(e){return e.constructor===Array?e:this.split(e)},split:function(e,t){for(var a,i=e.split(","),n=0;n=e.index;t--)m.map_cache[t].index--};function hasVml(){var e=$("
").appendTo("body");e.html('');var t=e[0].firstChild;t.style.behavior="url(#default#VML)";t=!t||"object"==typeof t.adj;return e.remove(),t}function namespaces(){return"object"==typeof document.namespaces?document.namespaces:null}function hasCanvas(){var e=namespaces();return(!e||!e.g_vml_)&&!!$("")[0].getContext}function merge_areas(a,e){var i,n=a.options.areas;e&&$.each(e,function(e,t){t&&t.key&&(0<=(i=u.indexOfProp(n,"key",t.key))?$.extend(n[i],t):n.push(t),(i=a.getDataForKey(t.key))&&$.extend(i.options,t))})}function merge_options(e,t){var a=u.updateProps({},t);delete a.areas,u.updateProps(e.options,a),merge_areas(e,t.areas),u.updateProps(e.area_options,e.options)}return me.get=function(e){var t=m.getMapData(this);if(!t||!t.complete)throw"Can't access data until binding complete.";return new m.Method(this,function(){return this.getSelected()},function(){return this.isSelected()},{name:"get",args:arguments,key:e,first:!0,allowAsync:!0,defaultReturn:""}).go()},me.data=function(e){return new m.Method(this,null,function(){return this},{name:"data",args:arguments,key:e}).go()},me.highlight=function(t){return new m.Method(this,function(){if(!1!==t){var e=this.highlightId;return 0<=e?this.data[e].key:null}this.ensureNoHighlight()},function(){this.highlight()},{name:"highlight",args:arguments,key:t,first:!0}).go()},me.keys=function(e,i){var n=[],a=m.getMapData(this);if(!a||!a.complete)throw"Can't access data until binding complete.";function o(e){var t,a=[];i?(t=e.areas(),$.each(t,function(e,t){a=a.concat(t.keys)})):a.push(e.key),$.each(a,function(e,t){$.inArray(t,n)<0&&n.push(t)})}return a&&a.complete?("string"==typeof e?i?o(a.getDataForKey(e)):n=[a.getKeysForGroup(e)]:(i=e,this.each(function(e,t){"AREA"===t.nodeName&&o(a.getDataForArea(t))})),n.join(",")):""},me.select=function(){me.set.call(this,!0)},me.deselect=function(){me.set.call(this,!1)},me.set=function(i,n,e){var o,s,r,c,l=e;function h(e){e&&$.inArray(e,c)<0&&(c.push(e),r+=(""===r?"":",")+e.key)}function p(a){$.each(c,function(e,t){t=function(e){var t=i;if(e){switch(i){case!0:e.select(l);break;case!1:e.deselect(!0);break;default:t=e.toggle(l)}return t}}(t);a.options.boundList&&m.setBoundListProperties(a.options,m.getBoundList(a.options,r),t)}),i||a.removeSelectionFinish()}return this.filter("img,area").each(function(e,t){var a;(s=m.getMapData(t))!==o&&(o&&p(o),c=[],r=""),s&&(a="","IMG"===t.nodeName.toUpperCase()?m.queueCommand(s,$(t),"set",[i,n,l])||(n instanceof Array?n.length&&(a=n.join(",")):a=n,a&&$.each(u.split(a),function(e,t){h(s.getDataForKey(t.toString())),o=s})):(l=n,m.queueCommand(s,$(t),"set",[i,l])||(h(s.getDataForArea(t)),o=s)))}),s&&p(s),this},me.unbind=function(e){return new m.Method(this,function(){this.clearEvents(),this.clearMapData(e),removeMap(this)},null,{name:"unbind",args:arguments}).go()},me.rebind=function(t){return new m.Method(this,function(){var e=this;e.complete=!1,e.configureOptions(t),e.bindImages().then(function(){e.buildDataset(!0),e.complete=!0})},null,{name:"rebind",args:arguments}).go()},me.get_options=function(e,t){var a=u.isBool(e)?e:t;return new m.Method(this,function(){var e=$.extend({},this.options);return a&&(e.render_select=u.updateProps({},m.render_defaults,e,e.render_select),e.render_highlight=u.updateProps({},m.render_defaults,e,e.render_highlight)),e},function(){return a?this.effectiveOptions():this.options},{name:"get_options",args:arguments,first:!0,allowAsync:!0,key:e}).go()},me.set_options=function(e){return new m.Method(this,function(){merge_options(this,e)},null,{name:"set_options",args:arguments}).go()},me.unload=function(){for(var e=m.map_cache.length-1;0<=e;e--)m.map_cache[e]&&me.unbind.call($(m.map_cache[e].image));me.graphics=null},me.snapshot=function(){return new m.Method(this,function(){$.each(this.data,function(e,t){t.selected=!1}),this.base_canvas=this.graphics.createVisibleCanvas(this),$(this.image).before(this.base_canvas)},null,{name:"snapshot"}).go()},me.state=function(){var a,i=null;return $(this).each(function(e,t){if("IMG"===t.nodeName)return(a=m.getMapData(t))&&(i=a.state()),!1}),i},me.bind=function(o){return this.each(function(e,t){var a,i=$(t),n=m.getMapData(t);if(n){if(me.unbind.apply(i),!n.complete)return!0;n=null}if(t=(a=this.getAttribute("usemap"))&&$('map[name="'+a.substr(1)+'"]'),!(i.is("img")&&a&&0')[0]},clearHighlight:function(){var e=this.map_data.overlay_canvas;e.getContext("2d").clearRect(0,0,e.width,e.height)},refreshSelections:function(){var e=this.map_data,t=e.base_canvas;e.base_canvas=this.createVisibleCanvas(e),h(e.base_canvas).hide(),h(t).before(e.base_canvas),e.redrawSelections(),h(e.base_canvas).show(),h(t).remove()}},o={renderShape:function(e,t,a){var i,n=this,o=e.coords(),s=n.elementName?'name="'+n.elementName+'" ':"",r=a?'class="'+a+'" ':"",c='',l=t.stroke?" strokeweight="+t.strokeWidth+' stroked="t" strokecolor="#'+t.strokeColor+'"':' stroked="f"',u=t.fill?' filled="t"':' filled="f"';switch(e.shape){case"rect":case"rectangle":i="'+c+"";break;case"poly":case"polygon":i="'+c+"";break;case"circ":case"circle":i="'+c+""}return e=h(i),h(n.canvas).append(e),e},render:function(){var a,i=this;return h.each(this.shapes,function(e,t){i.renderShape(t.mapArea,t.options)}),this.masks.length&&h.each(this.masks,function(e,t){a=c.updateProps({},t.options,{fillOpacity:1,fillColor:t.options.fillColorMask}),i.renderShape(t.mapArea,a,"mapster_mask")}),this.active=!1,this.canvas},createCanvasFor:function(e){var t=e.scaleInfo.width,e=e.scaleInfo.height;return h('')[0]},clearHighlight:function(){h(this.map_data.overlay_canvas).children().remove()},removeSelections:function(e){(0<=e?h(this.map_data.base_canvas).find('[name="static_'+e.toString()+'"]'):h(this.map_data.base_canvas).children()).remove()}},h.each(["renderShape","addAltImage","render","createCanvasFor","clearHighlight","removeSelections","refreshSelections"],function(e,t){var a;i[t]=(a=t,function(){return i[a]=(r.hasCanvas()?n:o)[a]||s,i[a].apply(this,arguments)})})}(jQuery),function(o){"use strict";var e=o.mapster,n=e.utils,t=[];e.MapImages=function(e){this.owner=e,this.clear()},e.MapImages.prototype={constructor:e.MapImages,slice:function(){return t.slice.apply(this,arguments)},splice:function(){return t.slice.apply(this.status,arguments),t.slice.apply(this,arguments)},complete:function(){return o.inArray(!1,this.status)<0},_add:function(e){e=t.push.call(this,e)-1;return this.status[e]=!1,e},indexOf:function(e){return n.indexOf(this,e)},clear:function(){var a=this;a.ids&&0").addClass("mapster_el").hide(),a=n._add(e[0]),e.on("load.mapster",function(e){n.imageLoaded.call(n,e)}).on("error.mapster",function(e){n.imageLoadError.call(n,e)}),e.attr("src",i)}else a=n._add(o(e)[0]);if(t){if(this[t])throw t+" is already used or is not available as an altImage alias.";n.ids.push(t),n[t]=n[a]}return a}},bind:function(){var t=this,a=t.owner.options.configTimeout/200,i=function(){for(var e=t.length;0
'),u.wrapClass&&(!0===u.wrapClass?a.addClass(o[0].className):a.addClass(u.wrapClass))),l.wrapper=a,l.scaleInfo=c=d.scaleMap(l.images[0],l.images[1],u.scaleMap),l.base_canvas=t=l.graphics.createVisibleCanvas(l),l.overlay_canvas=r=l.graphics.createVisibleCanvas(l),e=y(l.images[1]).addClass("mapster_el "+l.images[0].className).attr({id:null,usemap:null}),(n=d.size(l.images[0])).complete&&e.css({width:n.width,height:n.height}),l.buildDataset(),c=y.extend({display:"block",position:"relative",padding:0},!0===u.enableAutoResizeSupport?{}:{width:c.width,height:c.height}),u.wrapCss&&y.extend(c,u.wrapCss),o.parent()[0]!==l.wrapper[0]&&o.before(l.wrapper),a.css(c),y(l.images.slice(2)).hide(),i=1;iw&&t[1]>b)return v=t,!(s=!0)}),s||(v=[l,u])),v}}(jQuery),function(d){"use strict";var f=d.mapster,m=f.utils,e=f.MapArea.prototype;f.utils.getScaleInfo=function(e,t){var a;return t?.98<(a=e.width/t.width||e.height/t.height)&&a<1.02&&(a=1):(a=1,t=e),{scale:1!==a,scalePct:a,realWidth:t.width,realHeight:t.height,width:e.width,height:e.height,ratio:e.width/e.height}},f.utils.scaleMap=function(e,t,a){e=m.size(e),t=m.size(t,!0);if(!t.complete())throw"Another script, such as an extension, appears to be interfering with image loading. Please let us know about this.";return e.complete()||(e=t),this.getScaleInfo(e,a?t:null)},f.MapData.prototype.resize=function(t,a,i,n){var o,s,r,c,e,l=this;function u(e,t,a){f.hasCanvas()?(e.width=t,e.height=a):(d(e).width(t),d(e).height(a))}function h(){var e;u(l.overlay_canvas,t,a),0<=c&&((e=l.data[c]).tempOptions={fade:!1},l.getDataForKey(e.key).highlight(),e.tempOptions=null),u(l.base_canvas,t,a),l.redrawSelections(),l.currentAction="",m.isFunction(n)&&n(),l.processCommandQueue()}function p(){d(l.image).css(r),l.scaleInfo=m.getScaleInfo({width:t,height:a},{width:l.scaleInfo.realWidth,height:l.scaleInfo.realHeight}),d.each(l.data,function(e,t){d.each(t.areas(),function(e,t){t.resize()})})}n=n||i,l.scaleInfo.width===t&&l.scaleInfo.height===a||(c=l.highlightId,t||(e=a/l.scaleInfo.realHeight,t=Math.round(l.scaleInfo.realWidth*e)),a||(e=t/l.scaleInfo.realWidth,a=Math.round(l.scaleInfo.realHeight*e)),r={width:String(t)+"px",height:String(a)+"px"},f.hasCanvas()||d(l.base_canvas).children().remove(),e=d(l.wrapper).find(".mapster_el"),!0!==l.options.enableAutoResizeSupport&&(e=e.add(l.wrapper)),i?(s=[],l.currentAction="resizing",e.filter(":visible").each(function(e,t){o=m.defer(),s.push(o),d(t).animate(r,{duration:i,complete:o.resolve,easing:"linear"})}),e.filter(":hidden").css(r),o=m.defer(),s.push(o),m.when.all(s).then(h),p(),o.resolve()):(e.css(r),p(),h()))},f.MapData.prototype.autoResize=function(e,t){this.resize(d(this.wrapper).width(),null,e,t)},f.MapData.prototype.configureAutoResize=function(){var e=this,t=e.instanceEventNamespace();function a(){!0===e.options.autoResize&&e.autoResize(e.options.autoResizeDuration,e.options.onAutoResize)}d(e.image).on("load"+t,a),d(window).on("focus"+t,a),d(window).on("resize"+t,function(){e.autoResizeTimer&&clearTimeout(e.autoResizeTimer),e.autoResizeTimer=setTimeout(a,e.options.autoResizeDelay)}),d(window).on("readystatechange"+t,a),d(window.document).on("fullscreenchange"+t,a),a()},f.MapArea=m.subclass(f.MapArea,function(){this.base.init(),this.owner.scaleInfo.scale&&this.resize()}),e.coords=function(e,t){var a,i=[],n=e||this.owner.scaleInfo.scalePct,o=t||0;if(1===n&&0===t)return this.originalCoords;for(a=0;a',showToolTip:!1,toolTip:null,toolTipFade:!0,toolTipClose:["area-mouseout","image-mouseout","generic-mouseout"],onShowToolTip:null,onHideToolTip:null}),c.extend(e.area_defaults,{toolTip:null,toolTipClose:null}),e.MapData.prototype.clearToolTip=function(){this.activeToolTip&&(this.activeToolTip.stop().remove(),this.activeToolTip=null,this.activeToolTipID=null,l.ifFunction(this.options.onHideToolTip,this))},e.AreaData.prototype.showToolTip=function(e,t){var a,i,n,o=this,s=o.owner,r=o.effectiveOptions();if(t=t?c.extend({},t):{},e=e||r.toolTip,a=t.closeEvents||r.toolTipClose||s.options.toolTipClose||"tooltip-click",n=void 0!==t.template?t.template:s.options.toolTipContainer,t.closeEvents="string"==typeof a?a=l.split(a):a,t.fadeDuration=t.fadeDuration||(s.options.toolTipFade?s.options.fadeDuration||r.fadeDuration:0),i=o.area||c.map(o.areas(),function(e){return e.area}),s.activeToolTipID!==o.areaId){s.clearToolTip();var e=l.isFunction(e)?e({key:this.key,target:i}):e;if(e)return s.activeToolTip=e=u(e,n,t.css),s.activeToolTipID=o.areaId,n=function(){s.clearToolTip()},h(a,"area-click","click",c(s.map),null,n),h(a,"tooltip-click","click",e,null,n),h(a,"image-mouseout","mouseout",c(s.image),function(e){return e.relatedTarget&&"AREA"!==e.relatedTarget.nodeName&&e.relatedTarget!==o.area},n),h(a,"image-click","click",c(s.image),null,n),p(e,i,s.image,t.container,t),l.ifFunction(s.options.onShowToolTip,o.area,{toolTip:e,options:{},areaOptions:r,key:o.key,selected:o.isSelected()}),e}},e.impl.tooltip=function(s,r){return new e.Method(this,function(){var e,t,a,i,n,o=this;s?(n=(e=c(s))&&0=e.index;t--)m.map_cache[t].index--};function hasVml(){var e=$("
").appendTo("body");e.html('');var t=e[0].firstChild;t.style.behavior="url(#default#VML)";t=!t||"object"==typeof t.adj;return e.remove(),t}function namespaces(){return"object"==typeof document.namespaces?document.namespaces:null}function hasCanvas(){var e=namespaces();return(!e||!e.g_vml_)&&!!$("")[0].getContext}function merge_areas(i,e){var a,n=i.options.areas;e&&$.each(e,function(e,t){t&&t.key&&(0<=(a=u.indexOfProp(n,"key",t.key))?$.extend(n[a],t):n.push(t),(a=i.getDataForKey(t.key))&&$.extend(a.options,t))})}function merge_options(e,t){var i=u.updateProps({},t);delete i.areas,u.updateProps(e.options,i),merge_areas(e,t.areas),u.updateProps(e.area_options,e.options)}return me.get=function(e){var t=m.getMapData(this);if(!t||!t.complete)throw"Can't access data until binding complete.";return new m.Method(this,function(){return this.getSelected()},function(){return this.isSelected()},{name:"get",args:arguments,key:e,first:!0,allowAsync:!0,defaultReturn:""}).go()},me.data=function(e){return new m.Method(this,null,function(){return this},{name:"data",args:arguments,key:e}).go()},me.highlight=function(t){return new m.Method(this,function(){if(!1!==t){var e=this.highlightId;return 0<=e?this.data[e].key:null}this.ensureNoHighlight()},function(){this.highlight()},{name:"highlight",args:arguments,key:t,first:!0}).go()},me.keys=function(e,a){var n=[],i=m.getMapData(this);if(!i||!i.complete)throw"Can't access data until binding complete.";function o(e){var t,i=[];a?(t=e.areas(),$.each(t,function(e,t){i=i.concat(t.keys)})):i.push(e.key),$.each(i,function(e,t){$.inArray(t,n)<0&&n.push(t)})}return i&&i.complete?("string"==typeof e?a?o(i.getDataForKey(e)):n=[i.getKeysForGroup(e)]:(a=e,this.each(function(e,t){"AREA"===t.nodeName&&o(i.getDataForArea(t))})),n.join(",")):""},me.select=function(){me.set.call(this,!0)},me.deselect=function(){me.set.call(this,!1)},me.set=function(a,n,e){var o,s,r,c,l=e;function h(e){e&&$.inArray(e,c)<0&&(c.push(e),r+=(""===r?"":",")+e.key)}function p(e){$.each(c,function(e,t){!function(e){if(e){switch(a){case!0:e.select(l);break;case!1:e.deselect(!0);break;default:e.toggle(l)}}}(t)}),a||e.removeSelectionFinish()}return this.filter("img,area").each(function(e,t){var i;(s=m.getMapData(t))!==o&&(o&&p(o),c=[],r=""),s&&(i="","IMG"===t.nodeName.toUpperCase()?m.queueCommand(s,$(t),"set",[a,n,l])||(n instanceof Array?n.length&&(i=n.join(",")):i=n,i&&$.each(u.split(i),function(e,t){h(s.getDataForKey(t.toString())),o=s})):(l=n,m.queueCommand(s,$(t),"set",[a,l])||(h(s.getDataForArea(t)),o=s)))}),s&&p(s),this},me.unbind=function(e){return new m.Method(this,function(){this.clearEvents(),this.clearMapData(e),removeMap(this)},null,{name:"unbind",args:arguments}).go()},me.rebind=function(t){return new m.Method(this,function(){var e=this;e.complete=!1,e.configureOptions(t),e.bindImages().then(function(){e.buildDataset(!0),e.complete=!0,e.onConfigured()})},null,{name:"rebind",args:arguments}).go()},me.get_options=function(e,t){var i=u.isBool(e)?e:t;return new m.Method(this,function(){var e=$.extend({},this.options);return i&&(e.render_select=u.updateProps({},m.render_defaults,e,e.render_select),e.render_highlight=u.updateProps({},m.render_defaults,e,e.render_highlight)),e},function(){return i?this.effectiveOptions():this.options},{name:"get_options",args:arguments,first:!0,allowAsync:!0,key:e}).go()},me.set_options=function(e){return new m.Method(this,function(){merge_options(this,e)},null,{name:"set_options",args:arguments}).go()},me.unload=function(){for(var e=m.map_cache.length-1;0<=e;e--)m.map_cache[e]&&me.unbind.call($(m.map_cache[e].image));me.graphics=null},me.snapshot=function(){return new m.Method(this,function(){$.each(this.data,function(e,t){t.selected=!1}),this.base_canvas=this.graphics.createVisibleCanvas(this),$(this.image).before(this.base_canvas)},null,{name:"snapshot"}).go()},me.state=function(){var i,a=null;return $(this).each(function(e,t){if("IMG"===t.nodeName)return(i=m.getMapData(t))&&(a=i.state()),!1}),a},me.bind=function(o){return this.each(function(e,t){var i,a=$(t),n=m.getMapData(t);if(n){if(me.unbind.apply(a),!n.complete)return!0;n=null}if(t=(i=this.getAttribute("usemap"))&&$('map[name="'+i.substr(1)+'"]'),!(a.is("img")&&i&&0')[0]},clearHighlight:function(){var e=this.map_data.overlay_canvas;e.getContext("2d").clearRect(0,0,e.width,e.height)},refreshSelections:function(){var e=this.map_data,t=e.base_canvas;e.base_canvas=this.createVisibleCanvas(e),h(e.base_canvas).hide(),h(t).before(e.base_canvas),e.redrawSelections(),h(e.base_canvas).show(),h(t).remove()}},o={renderShape:function(e,t,i){var a,n=this,o=e.coords(),s=n.elementName?'name="'+n.elementName+'" ':"",r=i?'class="'+i+'" ':"",c='',l=t.stroke?" strokeweight="+t.strokeWidth+' stroked="t" strokecolor="#'+t.strokeColor+'"':' stroked="f"',u=t.fill?' filled="t"':' filled="f"';switch(e.shape){case"rect":case"rectangle":a="'+c+"";break;case"poly":case"polygon":a="'+c+"";break;case"circ":case"circle":a="'+c+""}return e=h(a),h(n.canvas).append(e),e},render:function(){var i,a=this;return h.each(this.shapes,function(e,t){a.renderShape(t.mapArea,t.options)}),this.masks.length&&h.each(this.masks,function(e,t){i=c.updateProps({},t.options,{fillOpacity:1,fillColor:t.options.fillColorMask}),a.renderShape(t.mapArea,i,"mapster_mask")}),this.active=!1,this.canvas},createCanvasFor:function(e){var t=e.scaleInfo.width,e=e.scaleInfo.height;return h('')[0]},clearHighlight:function(){h(this.map_data.overlay_canvas).children().remove()},removeSelections:function(e){(0<=e?h(this.map_data.base_canvas).find('[name="static_'+e.toString()+'"]'):h(this.map_data.base_canvas).children()).remove()}},h.each(["renderShape","addAltImage","render","createCanvasFor","clearHighlight","removeSelections","refreshSelections"],function(e,t){var i;a[t]=(i=t,function(){return a[i]=(r.hasCanvas()?n:o)[i]||s,a[i].apply(this,arguments)})})}(jQuery),function(o){"use strict";var e=o.mapster,n=e.utils,t=[];e.MapImages=function(e){this.owner=e,this.clear()},e.MapImages.prototype={constructor:e.MapImages,slice:function(){return t.slice.apply(this,arguments)},splice:function(){return t.slice.apply(this.status,arguments),t.slice.apply(this,arguments)},complete:function(){return o.inArray(!1,this.status)<0},_add:function(e){e=t.push.call(this,e)-1;return this.status[e]=!1,e},indexOf:function(e){return n.indexOf(this,e)},clear:function(){var i=this;i.ids&&0").addClass("mapster_el").hide(),i=n._add(e[0]),e.on("load.mapster",function(e){n.imageLoaded.call(n,e)}).on("error.mapster",function(e){n.imageLoadError.call(n,e)}),e.attr("src",a)}else i=n._add(o(e)[0]);if(t){if(this[t])throw t+" is already used or is not available as an altImage alias.";n.ids.push(t),n[t]=n[i]}return i}},bind:function(){var t=this,i=t.owner.options.configTimeout/200,a=function(){for(var e=t.length;0
'),l.wrapClass&&(!0===l.wrapClass?a.addClass(s[0].className):a.addClass(l.wrapClass))),c.wrapper=a,c.scaleInfo=r=d.scaleMap(c.images[0],c.images[1],l.scaleMap),c.base_canvas=t=c.graphics.createVisibleCanvas(c),c.overlay_canvas=i=c.graphics.createVisibleCanvas(c),e=y(c.images[1]).addClass("mapster_el "+c.images[0].className).attr({id:null,usemap:null}),(o=d.size(c.images[0])).complete&&e.css({width:o.width,height:o.height}),c.buildDataset(),r=y.extend({display:"block",position:"relative",padding:0},!0===l.enableAutoResizeSupport?{}:{width:r.width,height:r.height}),l.wrapCss&&y.extend(r,l.wrapCss),s.parent()[0]!==c.wrapper[0]&&s.before(c.wrapper),a.css(r),y(c.images.slice(2)).hide(),n=1;nw&&t[1]>b)return v=t,!(s=!0)}),s||(v=[l,u])),v}}(jQuery),function(d){"use strict";var f=d.mapster,m=f.utils,e=f.MapArea.prototype;f.utils.getScaleInfo=function(e,t){var i;return t?.98<(i=e.width/t.width||e.height/t.height)&&i<1.02&&(i=1):(i=1,t=e),{scale:1!==i,scalePct:i,realWidth:t.width,realHeight:t.height,width:e.width,height:e.height,ratio:e.width/e.height}},f.utils.scaleMap=function(e,t,i){e=m.size(e),t=m.size(t,!0);if(!t.complete())throw"Another script, such as an extension, appears to be interfering with image loading. Please let us know about this.";return e.complete()||(e=t),this.getScaleInfo(e,i?t:null)},f.MapData.prototype.resize=function(t,i,a,n){var o,s,r,c,e,l=this;function u(e,t,i){f.hasCanvas()?(e.width=t,e.height=i):(d(e).width(t),d(e).height(i))}function h(){var e;u(l.overlay_canvas,t,i),0<=c&&((e=l.data[c]).tempOptions={fade:!1},l.getDataForKey(e.key).highlight(),e.tempOptions=null),u(l.base_canvas,t,i),l.redrawSelections(),l.currentAction="",m.isFunction(n)&&n(),l.processCommandQueue()}function p(){d(l.image).css(r),l.scaleInfo=m.getScaleInfo({width:t,height:i},{width:l.scaleInfo.realWidth,height:l.scaleInfo.realHeight}),d.each(l.data,function(e,t){d.each(t.areas(),function(e,t){t.resize()})})}n=n||a,l.scaleInfo.width===t&&l.scaleInfo.height===i||(c=l.highlightId,t||(e=i/l.scaleInfo.realHeight,t=Math.round(l.scaleInfo.realWidth*e)),i||(e=t/l.scaleInfo.realWidth,i=Math.round(l.scaleInfo.realHeight*e)),r={width:String(t)+"px",height:String(i)+"px"},f.hasCanvas()||d(l.base_canvas).children().remove(),e=d(l.wrapper).find(".mapster_el"),!0!==l.options.enableAutoResizeSupport&&(e=e.add(l.wrapper)),a?(s=[],l.currentAction="resizing",e.filter(":visible").each(function(e,t){o=m.defer(),s.push(o),d(t).animate(r,{duration:a,complete:o.resolve,easing:"linear"})}),e.filter(":hidden").css(r),o=m.defer(),s.push(o),m.when.all(s).then(h),p(),o.resolve()):(e.css(r),p(),h()))},f.MapData.prototype.autoResize=function(e,t){this.resize(d(this.wrapper).width(),null,e,t)},f.MapData.prototype.configureAutoResize=function(){var e=this,t=e.instanceEventNamespace();function i(){!0===e.options.autoResize&&e.autoResize(e.options.autoResizeDuration,e.options.onAutoResize)}d(e.image).on("load"+t,i),d(window).on("focus"+t,i),d(window).on("resize"+t,function(){e.autoResizeTimer&&clearTimeout(e.autoResizeTimer),e.autoResizeTimer=setTimeout(i,e.options.autoResizeDelay)}),d(window).on("readystatechange"+t,i),d(window.document).on("fullscreenchange"+t,i),i()},f.MapArea=m.subclass(f.MapArea,function(){this.base.init(),this.owner.scaleInfo.scale&&this.resize()}),e.coords=function(e,t){var i,a=[],n=e||this.owner.scaleInfo.scalePct,o=t||0;if(1===n&&0===t)return this.originalCoords;for(i=0;i',showToolTip:!1,toolTip:null,toolTipFade:!0,toolTipClose:["area-mouseout","image-mouseout","generic-mouseout"],onShowToolTip:null,onHideToolTip:null}),c.extend(e.area_defaults,{toolTip:null,toolTipClose:null}),e.MapData.prototype.clearToolTip=function(){this.activeToolTip&&(this.activeToolTip.stop().remove(),this.activeToolTip=null,this.activeToolTipID=null,l.ifFunction(this.options.onHideToolTip,this))},e.AreaData.prototype.showToolTip=function(e,t){var i,a,n,o=this,s=o.owner,r=o.effectiveOptions();if(t=t?c.extend({},t):{},e=e||r.toolTip,i=t.closeEvents||r.toolTipClose||s.options.toolTipClose||"tooltip-click",n=void 0!==t.template?t.template:s.options.toolTipContainer,t.closeEvents="string"==typeof i?i=l.split(i):i,t.fadeDuration=t.fadeDuration||(s.options.toolTipFade?s.options.fadeDuration||r.fadeDuration:0),a=o.area||c.map(o.areas(),function(e){return e.area}),s.activeToolTipID!==o.areaId){s.clearToolTip();var e=l.isFunction(e)?e({key:this.key,target:a}):e;if(e)return s.activeToolTip=e=u(e,n,t.css),s.activeToolTipID=o.areaId,n=function(){s.clearToolTip()},h(i,"area-click","click",c(s.map),null,n),h(i,"tooltip-click","click",e,null,n),h(i,"image-mouseout","mouseout",c(s.image),function(e){return e.relatedTarget&&"AREA"!==e.relatedTarget.nodeName&&e.relatedTarget!==o.area},n),h(i,"image-click","click",c(s.image),null,n),p(e,a,s.image,t.container,t),l.ifFunction(s.options.onShowToolTip,o.area,{toolTip:e,options:{},areaOptions:r,key:o.key,selected:o.isSelected()}),e}},e.impl.tooltip=function(s,r){return new e.Method(this,function(){var e,t,i,a,n,o=this;s?(n=(e=c(s))&&0