jquery-jvectormap.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * jVectorMap version 1.2.2
  3. *
  4. * Copyright 2011-2013, Kirill Lebedev
  5. * Licensed under the MIT license.
  6. *
  7. */
  8. (function( $ ){
  9. var apiParams = {
  10. set: {
  11. colors: 1,
  12. values: 1,
  13. backgroundColor: 1,
  14. scaleColors: 1,
  15. normalizeFunction: 1,
  16. focus: 1
  17. },
  18. get: {
  19. selectedRegions: 1,
  20. selectedMarkers: 1,
  21. mapObject: 1,
  22. regionName: 1
  23. }
  24. };
  25. $.fn.vectorMap = function(options) {
  26. var map,
  27. methodName,
  28. event,
  29. map = this.children('.jvectormap-container').data('mapObject');
  30. if (options === 'addMap') {
  31. jvm.WorldMap.maps[arguments[1]] = arguments[2];
  32. } else if ((options === 'set' || options === 'get') && apiParams[options][arguments[1]]) {
  33. methodName = arguments[1].charAt(0).toUpperCase()+arguments[1].substr(1);
  34. return map[options+methodName].apply(map, Array.prototype.slice.call(arguments, 2));
  35. } else {
  36. options = options || {};
  37. options.container = this;
  38. map = new jvm.WorldMap(options);
  39. }
  40. return this;
  41. };
  42. })( jQuery );