jquery-jvectormap.js 1.1 KB

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