BBnepal-Accounts/account/plugins/jquery-mapael/jquery.mapael.min.js

2 lines
35 KiB
JavaScript
Raw Normal View History

2024-07-10 12:43:19 +00:00
!function(a){"object"==typeof exports?module.exports=a(require("jquery"),require("raphael"),require("jquery-mousewheel")):"function"==typeof define&&define.amd?define(["jquery","raphael","mousewheel"],a):a(jQuery,Raphael,jQuery.fn.mousewheel)}(function(a,b,c,d){"use strict";var e=function(b,c){var d=this;d.container=b,d.$container=a(b),d.options=d.extendDefaultOptions(c),d.zoomTO=0,d.zoomCenterX=0,d.zoomCenterY=0,d.previousPinchDist=0,d.zoomData={zoomLevel:0,zoomX:0,zoomY:0,panX:0,panY:0},d.currentViewBox={x:0,y:0,w:0,h:0},d.panning=!1,d.zoomAnimID=null,d.zoomAnimStartTime=null,d.zoomAnimCVBTarget=null,d.$map=a("."+d.options.map.cssClass,d.container),d.initialMapHTMLContent=d.$map.html(),d.$tooltip={},d.paper={},d.areas={},d.plots={},d.links={},d.legends={},d.mapConf={},d.customEventHandlers={},d.init()};return e.prototype={MouseOverFilteringTO:120,panningFilteringTO:150,panningEndFilteringTO:50,zoomFilteringTO:150,resizeFilteringTO:150,init:function(){var c=this;if(""===c.options.map.cssClass||0===a("."+c.options.map.cssClass,c.container).length)throw new Error("The map class `"+c.options.map.cssClass+"` doesn't exists");if(c.$tooltip=a("<div>").addClass(c.options.map.tooltip.cssClass).css("display","none"),c.$map.empty().append(c.$tooltip),a.mapael&&a.mapael.maps&&a.mapael.maps[c.options.map.name])c.mapConf=a.mapael.maps[c.options.map.name];else{if(!(a.fn.mapael&&a.fn.mapael.maps&&a.fn.mapael.maps[c.options.map.name]))throw new Error("Unknown map '"+c.options.map.name+"'");c.mapConf=a.fn.mapael.maps[c.options.map.name],window.console&&window.console.warn&&window.console.warn("Extending $.fn.mapael is deprecated (map '"+c.options.map.name+"')")}if(c.paper=new b(c.$map[0],c.mapConf.width,c.mapConf.height),!0===c.isRaphaelBBoxBugPresent())throw c.destroy(),new Error("Can't get boundary box for text (is your container hidden? See #135)");c.$container.addClass("mapael"),c.options.map.tooltip.css&&c.$tooltip.css(c.options.map.tooltip.css),c.setViewBox(0,0,c.mapConf.width,c.mapConf.height),c.options.map.width?c.paper.setSize(c.options.map.width,c.mapConf.height*(c.options.map.width/c.mapConf.width)):c.initResponsiveSize(),a.each(c.mapConf.elems,function(a){c.areas[a]={},c.areas[a].options=c.getElemOptions(c.options.map.defaultArea,c.options.areas[a]?c.options.areas[a]:{},c.options.legend.area),c.areas[a].mapElem=c.paper.path(c.mapConf.elems[a])}),c.options.map.beforeInit&&c.options.map.beforeInit(c.$container,c.paper,c.options),a.each(c.mapConf.elems,function(a){c.initElem(a,"area",c.areas[a])}),c.links=c.drawLinksCollection(c.options.links),a.each(c.options.plots,function(a){c.plots[a]=c.drawPlot(a)}),c.$container.on("zoom.mapael",function(a,b){c.onZoomEvent(a,b)}),c.options.map.zoom.enabled&&c.initZoom(c.mapConf.width,c.mapConf.height,c.options.map.zoom),c.options.map.zoom.init!==d&&(c.options.map.zoom.init.animDuration===d&&(c.options.map.zoom.init.animDuration=0),c.$container.trigger("zoom",c.options.map.zoom.init)),c.createLegends("area",c.areas,1),c.createLegends("plot",c.plots,c.paper.width/c.mapConf.width),c.$container.on("update.mapael",function(a,b){c.onUpdateEvent(a,b)}),c.$container.on("showElementsInRange.mapael",function(a,b){c.onShowElementsInRange(a,b)}),c.initDelegatedMapEvents(),c.initDelegatedCustomEvents(),c.options.map.afterInit&&c.options.map.afterInit(c.$container,c.paper,c.areas,c.plots,c.options),a(c.paper.desc).append(" and Mapael "+c.version+" (https://www.vincentbroute.fr/mapael/)")},destroy:function(){var b=this;b.$container.off(".mapael"),b.$map.off(".mapael"),b.onResizeEvent&&a(window).off("resize.mapael",b.onResizeEvent),b.$map.empty(),b.$map.html(b.initialMapHTMLContent),a.each(b.legends,function(c){a.each(b.legends[c],function(a){var d=b.legends[c][a];d.container.empty(),d.container.html(d.initialHTMLContent)})}),b.$container.removeClass("mapael"),b.$container.removeData("mapael"),b.container=d,b.$container=d,b.options=d,b.paper=d,b.$map=d,b.$tooltip=d,b.mapConf=d,b.areas=d,b.plots=d,b.links=d,b.customEventHandlers=d},initResponsiveSize:function(){var b=this,c=null,d=function(a){var c=b.$map
requestAnimationFrame:function(a){return this._requestAnimationFrameFn.call(window,a)},cancelAnimationFrame:function(a){this._cancelAnimationFrameFn.call(window,a)},_requestAnimationFrameFn:function(){var a=function(){var b=(new Date).getTime();return function(c){var d=(new Date).getTime();if(!(d-b>16))return setTimeout(function(){a(c)},0);b=d,c(d)}}();return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||a}(),_cancelAnimationFrameFn:function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelAnimationFrame||window.mozCancelRequestAnimationFrame||window.msCancelAnimationFrame||window.msCancelRequestAnimationFrame||window.oCancelAnimationFrame||window.oCancelRequestAnimationFrame||clearTimeout}(),setViewBox:function(a,b,c,d){var e=this;e.currentViewBox.x=a,e.currentViewBox.y=b,e.currentViewBox.w=c,e.currentViewBox.h=d,e.paper.setViewBox(a,b,c,d,!1)},_nonAnimatedAttrs:["arrow-end","arrow-start","gradient","class","cursor","text-anchor","font","font-family","font-style","font-weight","letter-spacing","src","href","target","title","stroke-dasharray","stroke-linecap","stroke-linejoin","stroke-miterlimit"],animate:function(a,b,c,e){var f=this;if(a)if(c>0){for(var g={},h=0;h<f._nonAnimatedAttrs.length;h++){var i=f._nonAnimatedAttrs[h];b[i]!==d&&(g[i]=b[i])}a.attr(g),a.animate(b,c,"linear",function(){e&&e()})}else a.attr(b),e&&e()},isRaphaelBBoxBugPresent:function(){var a=this,b=a.paper.text(-50,-50,"TEST"),c=b.getBBox();return b.remove(),0===c.width&&0===c.height},defaultOptions:{map:{cssClass:"map",tooltip:{cssClass:"mapTooltip"},defaultArea:{attrs:{fill:"#343434",stroke:"#5d5d5d","stroke-width":1,"stroke-linejoin":"round"},attrsHover:{fill:"#f38a03",animDuration:300},text:{position:"inner",margin:10,attrs:{"font-size":15,fill:"#c7c7c7"},attrsHover:{fill:"#eaeaea",animDuration:300}},target:"_self",cssClass:"area"},defaultPlot:{type:"circle",size:15,attrs:{fill:"#0088db",stroke:"#fff","stroke-width":0,"stroke-linejoin":"round"},attrsHover:{"stroke-width":3,animDuration:300},text:{position:"right",margin:10,attrs:{"font-size":15,fill:"#c7c7c7"},attrsHover:{fill:"#eaeaea",animDuration:300}},target:"_self",cssClass:"plot"},defaultLink:{factor:.5,attrs:{stroke:"#0088db","stroke-width":2},attrsHover:{animDuration:300},text:{position:"inner",margin:10,attrs:{"font-size":15,fill:"#c7c7c7"},attrsHover:{fill:"#eaeaea",animDuration:300}},target:"_self",cssClass:"link"},zoom:{enabled:!1,minLevel:0,maxLevel:10,step:.25,mousewheel:!0,touch:!0,animDuration:200,animEasing:"linear",buttons:{reset:{cssClass:"zoomButton zoomReset",content:"&#8226;",title:"Reset zoom"},in:{cssClass:"zoomButton zoomIn",content:"+",title:"Zoom in"},out:{cssClass:"zoomButton zoomOut",content:"&#8722;",title:"Zoom out"}}}},legend:{redrawOnResize:!0,area:[],plot:[]},areas:{},plots:{},links:{}},legendDefaultOptions:{area:{cssClass:"areaLegend",display:!0,marginLeft:10,marginLeftTitle:5,marginBottomTitle:10,marginLeftLabel:10,marginBottom:10,titleAttrs:{"font-size":16,fill:"#343434","text-anchor":"start"},labelAttrs:{"font-size":12,fill:"#343434","text-anchor":"start"},labelAttrsHover:{fill:"#787878",animDuration:300},hideElemsOnClick:{enabled:!0,opacity:.2,animDuration:300},slices:[],mode:"vertical"},plot:{cssClass:"plotLegend",display:!0,marginLeft:10,marginLeftTitle:5,marginBottomTitle:10,marginLeftLabel:10,marginBottom:10,titleAttrs:{"font-size":16,fill:"#343434","text-anchor":"start"},labelAttrs:{"font-size":12,fill:"#343434","text-anchor":"start"},labelAttrsHover:{fill:"#787878",animDuration:300},hideElemsOnClick:{enabled:!0,opacity:.2,animDuration:300},slices:[],mode:"vertical"}}},e.version="2.2.0",a.mapael===d&&(a.mapael=e),a.fn.mapael=function(b){return this.each(function(){a.data(this,"mapael")&&a.data(this,"mapael").destroy(),a.data(this,"mapael",new e(this,b))})},e});