Guest User

Untitled

a guest
Jan 21st, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. var marker = createCustomDataArray();
  2.  
  3. var addresspicker = $( "#searchbox" ).addresspicker({
  4. mapOptions: {
  5. zoom: 17,
  6. regionBias: "id",
  7. center: pos,
  8. scrollwheel: true,
  9. mapTypeId: google.maps.MapTypeId.ROADMAP,
  10. componentRestrictions: { country: "id" },
  11. types: ['geocode']
  12. },
  13. elements: {
  14. map: "#mapholder",
  15. lat: "#lat",
  16. lng: "#lng",
  17. locality: '#locality',
  18. country: '#country'
  19. },
  20. customData: marker
  21. })
  22.  
  23. $.widget( "ui.addresspicker", {
  24. options: {
  25. appendAddressString: "",
  26. draggableMarker: true,
  27. regionBias: "id",
  28. mapOptions: {
  29. zoom: 12,
  30. center: new google.maps.LatLng(-5, 106.84517200000005),
  31. scrollwheel: false,
  32. mapTypeId: google.maps.MapTypeId.ROADMAP
  33. },
  34. elements: {
  35. map: false,
  36. lat: false,
  37. lng: false,
  38. locality: false,
  39. country: false,
  40. type: false
  41. },
  42. customData: null
  43. },
  44.  
  45. setCustomData: function(data) {
  46. this.customData = data;
  47. return 42;
  48. },
  49.  
  50. _create: function() {
  51. this.geocoder = new google.maps.Geocoder();
  52. this.element.autocomplete({
  53.  
  54. source: $.proxy(this._geocode, this),
  55. focus: $.proxy(this._focusAddress, this),
  56. select: $.proxy(this._selectAddress, this)
  57. });
  58.  
  59. this.lat = $(this.options.elements.lat);
  60. this.lng = $(this.options.elements.lng);
  61. this.locality = $(this.options.elements.locality);
  62. this.country = $(this.options.elements.country);
  63. this.type = $(this.options.elements.type);
  64. if (this.options.elements.map) {
  65. this.mapElement = $(this.options.elements.map);
  66. this._initMap();
  67. }
  68. this.setCustomData(this.options.customData);
  69.  
  70. },
Add Comment
Please, Sign In to add comment