PageSourceSearch

https://scorm.com/wp-content/themes/rustici/_/js/map.js?ac6e1

js scorm.com collected 2026-09-24 08:33:12 UTC 2,805 bytes, 147 lines download raw bytes

1(function($) {
2  /*
3*  new_map
4*
5*  This function will render a Google Map onto the selected jQuery element
6*
7*  @type	function
8*  @date	8/11/2013
9*  @since	4.3.0
10*
11*  @param	$el (jQuery element)
12*  @return	n/a
13*/
14
15  function new_map($el) {
16    // var
17    var $markers = $el.find(".marker");
18
19    // vars
20    var args = {
21      zoom: 16,
22      center: new google.maps.LatLng(0, 0),
23      mapTypeId: google.maps.MapTypeId.ROADMAP
24    };
25
26    // create map
27    var map = new google.maps.Map($el[0], args);
28
29    // add a markers reference
30    map.markers = [];
31
32    // add markers
33    $markers.each(function() {
34      add_marker($(this), map);
35    });
36
37    // center map
38    center_map(map);
39
40    // return
41    return map;
42  }
43
44  /*
45*  add_marker
46*
47*  This function will add a marker to the selected Google Map
48*
49*  @type	function
50*  @date	8/11/2013
51*  @since	4.3.0
52*
53*  @param	$marker (jQuery element)
54*  @param	map (Google Map object)
55*  @return	n/a
56*/
57
58  function add_marker($marker, map) {
59    // var
60    var latlng = new google.maps.LatLng(
61      $marker.attr("data-lat"),
62      $marker.attr("data-lng")
63    );
64
65    // create marker
66    var marker = new google.maps.Marker({
67      position: latlng,
68      map: map
69    });
70
71    // add to array
72    map.markers.push(marker);
73
74    // if marker contains HTML, add it to an infoWindow
75    if ($marker.html()) {
76      // create info window
77      var infowindow = new google.maps.InfoWindow({
78        content: $marker.html()
79      });
80
81      // show info window when marker is clicked
82      google.maps.event.addListener(marker, "click", function() {
83        infowindow.open(map, marker);
84      });
85    }
86  }
87
88  /*
89*  center_map
90*
91*  This function will center the map, showing all markers attached to this map
92*
93*  @type	function
94*  @date	8/11/2013
95*  @since	4.3.0
96*
97*  @param	map (Google Map object)
98*  @return	n/a
99*/
100
101  function center_map(map) {
102    // vars
103    var bounds = new google.maps.LatLngBounds();
104
105    // loop through all markers and create bounds
106    $.each(map.markers, function(i, marker) {
107      var latlng = new google.maps.LatLng(
108        marker.position.lat(),
109        marker.position.lng()
110      );
111
112      bounds.extend(latlng);
113    });
114
115    // only 1 marker?
116    if (map.markers.length == 1) {
117      // set center of map
118      map.setCenter(bounds.getCenter());
119      map.setZoom(16);
120    } else {
121      // fit to bounds
122      map.fitBounds(bounds);
123    }
124  }
125
126  /*
127*  document ready
128*
129*  This function will render each map when the document is ready (page has loaded)
130*
131*  @type	function
132*  @date	8/11/2013
133*  @since	5.0.0
134*
135*  @param	n/a
136*  @return	n/a
137*/
138  // global var
139  var map = null;
140
141  $(document).ready(function() {
142    $(".acf-map").each(function() {
143      // create map
144      map = new_map($(this));
145    });
146  });
147})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.