-
Notifications
You must be signed in to change notification settings - Fork 430
/
jquery-jvectormap.js
44 lines (40 loc) · 1.06 KB
/
jquery-jvectormap.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* jVectorMap version 2.0.5
*
* Copyright 2011-2014, Kirill Lebedev
*
*/
(function( $ ){
var apiParams = {
set: {
colors: 1,
values: 1,
backgroundColor: 1,
scaleColors: 1,
normalizeFunction: 1,
focus: 1
},
get: {
selectedRegions: 1,
selectedMarkers: 1,
mapObject: 1,
regionName: 1
}
};
$.fn.vectorMap = function(options) {
var map,
methodName,
map = this.children('.jvectormap-container').data('mapObject');
if (options === 'addMap') {
jvm.Map.maps[arguments[1]] = arguments[2];
} else if ((options === 'set' || options === 'get') && apiParams[options][arguments[1]]) {
methodName = arguments[1].charAt(0).toUpperCase()+arguments[1].substr(1);
return map[options+methodName].apply(map, Array.prototype.slice.call(arguments, 2));
} else {
options = options || {};
options.container = this;
map = new jvm.Map(options);
}
return this;
};
})( jQuery );