PageSourceSearch

https://bkf.dk/wp-content/themes/bkf-beruf/library/js/acf_gmap.js

js bkf.dk collected 2026-10-02 10:04:11 UTC 5,552 bytes, 184 lines download raw bytes

1jQuery(document).ready(function($){
2
3var bkf_styling     = [{"featureType": "water","elementType": "geometry","stylers": [{"color": "#e9e9e9"},{"lightness": 17}]},{"featureType": "landscape","elementType": "geometry","stylers": [{"color": "#f5f5f5"},{"lightness": 20}]},{"featureType": "road.highway","elementType": "geometry.fill",
4        "stylers": [{"color": "#ffffff"},{"lightness": 17}]},{"featureType": "road.highway","elementType": "geometry.stroke","stylers": [{"color": "#ffffff"},{"lightness": 29},{"weight": 0.2}]},{"featureType": "road.arterial","elementType": "geometry",        "stylers": [{"color": "#ffffff"},{"lightness": 18}]},{"featureType": "road.local","elementType": "geometry","stylers": [{"color": "#ffffff"},{"lightness": 16}]},{"featureType": "poi","elementType": "geometry","stylers": [{"color": "#f5f5f5"},
5            {"lightness": 21}]},{"featureType": "poi.park","elementType": "geometry","stylers": [{"color": "#dedede"},{"lightness": 21}]},{"elementType": "labels.text.stroke","stylers": [{"visibility": "on"},            {
6                "color": "#ffffff"            },            {                "lightness": 16            }        ]    },    {        "elementType": "labels.text.fill",        "stylers": [            {                "saturation": 36
7            },            {                "color": "#333333"            },            {                "lightness": 40            }        ]    },    {        "elementType": "labels.icon",
8        "stylers": [            {                "visibility": "off"            }        ]
9        },    {        "featureType": "transit",        "elementType": "geometry",        "stylers": [            {                "color": "#f2f2f2"            },            {                "lightness": 19            }        ]    },    {
10        "featureType": "administrative",        "elementType": "geometry.fill",        "stylers": [            {                "color": "#fefefe"            },            {                "lightness": 20            }        ]    },    {
11        "featureType": "administrative",        "elementType": "geometry.stroke",        "stylers": [            {                "color": "#fefefe"            },            {                "lightness": 17            },            {                "weight": 1.2
12            }        ]    }];
13
14/*
15*  new_map
16*
17*  This function will render a Google Map onto the selected jQuery element
18*
19*  @type    function
20*  @date    8/11/2013
21*  @since   4.3.0
22*
23*  @param   $el (jQuery element)
24*  @return  n/a
25*/
26
27function new_map( $el ) {
28    
29    // var
30    var $markers    = $el.find('.marker');
31    
32    
33    // vars
34    var args = {
35        zoom        : 17,
36        center      : new google.maps.LatLng(0, 0),
37        mapTypeId   : google.maps.MapTypeId.ROADMAP,
38        styles      : bkf_styling,
39        scrollwheel : false
40    };
41    
42    
43    // create map               
44    var map = new google.maps.Map( $el[0], args);
45    
46    
47    // add a markers reference
48    map.markers = [];
49    
50    
51    // add markers
52    $markers.each(function(){
53        
54        add_marker( $(this), map );
55        
56    });
57    
58    
59    // center map
60    center_map( map );
61    
62    
63    // return
64    return map;
65    
66}
67
68/*
69*  add_marker
70*
71*  This function will add a marker to the selected Google Map
72*
73*  @type    function
74*  @date    8/11/2013
75*  @since   4.3.0
76*
77*  @param   $marker (jQuery element)
78*  @param   map (Google Map object)
79*  @return  n/a
80*/
81
82function add_marker( $marker, map ) {
83
84    // var
85    var latlng = new google.maps.LatLng( $marker.attr('data-lat'), $marker.attr('data-lng') );
86    var iconBase = 'http://bkf.beruf-dev.dk/wp-content/themes/bkf-beruf/library/images/';
87
88    // create marker
89    var marker = new google.maps.Marker({
90        position    : latlng,
91        map         : map,
92        icon        : iconBase + 'gmap-marker.png'
93    });
94
95    // add to array
96    map.markers.push( marker );
97
98    // if marker contains HTML, add it to an infoWindow
99    if( $marker.html() )
100    {
101        // create info window
102        var infowindow = new google.maps.InfoWindow({
103            content     : $marker.html()
104        });
105
106        // show info window when marker is clicked
107        google.maps.event.addListener(marker, 'click', function() {
108
109            infowindow.open( map, marker );
110
111        });
112    }
113
114}
115
116/*
117*  center_map
118*
119*  This function will center the map, showing all markers attached to this map
120*
121*  @type    function
122*  @date    8/11/2013
123*  @since   4.3.0
124*
125*  @param   map (Google Map object)
126*  @return  n/a
127*/
128
129function center_map( map ) {
130
131    // vars
132    var bounds = new google.maps.LatLngBounds();
133
134    // loop through all markers and create bounds
135    $.each( map.markers, function( i, marker ){
136
137        var latlng = new google.maps.LatLng( marker.position.lat(), marker.position.lng() );
138
139        bounds.extend( latlng );
140
141    });
142
143    // only 1 marker?
144    if( map.markers.length == 1 )
145    {
146        // set center of map
147        map.setCenter( bounds.getCenter() );
148        map.setZoom( 16 );
149    }
150    else
151    {
152        // fit to bounds
153        map.fitBounds( bounds );
154    }
155
156}
157
158/*
159*  document ready
160*
161*  This function will render each map when the document is ready (page has loaded)
162*
163*  @type    function
164*  @date    8/11/2013
165*  @since   5.0.0
166*
167*  @param   n/a
168*  @return  n/a
169*/
170// global var
171var map = null;
172
173$(document).ready(function(){
174
175    $('.acf-map').each(function(){
176
177        // create map
178        map = new_map( $(this) );
179
180    });
181
182});
183
184});

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.