1/* 2 * 5sec Google Maps Pro 3 * (c) Web factory Ltd, 2017 4 * www.webfactoryltd.com 5 */ 6 7jQuery(function($) { 8 if (typeof wf_gmp_maps == 'undefined') { 9 wf_gmp_maps = '{}'; 10 } 11 if (typeof wf_gmp_autoload == 'undefined') { 12 wf_gmp_autoload = 0; 13 } 14 15 wf_gmp_maps = wf_gmp_maps.replace(/"/g, '"'); 16 wf_gmp_maps = $.parseJSON(wf_gmp_maps); 17 18 // tabs fix 19 if (Boolean(parseInt(wf_gmp_detect_visibility, 10))) { 20 (function ($) { 21 $.each(['show'], function (i, ev) { 22 var el = $.fn[ev]; 23 $.fn[ev] = function () { 24 this.trigger(ev); 25 return el.apply(this, arguments); 26 }; 27 }); 28 })(jQuery); 29 30 $('.wf-gmp-canvas').parent().on('show', function() { 31 id = $('.wf-gmp-canvas', this).attr('id'); 32 id = id.replace('wf-gmp_',''); 33 wf_gmp_load_map(id); 34 setTimeout(function (){ 35 $(window).trigger('resize'); 36 }, 500); // how long do you want the delay to be? 37 }); 38 } // if tabs fix 39 40 // autload all maps? 41 if (Boolean(parseInt(wf_gmp_autoload, 10))) { 42 for(var i=0, len = wf_gmp_maps.length; i < len; i++){ 43 wf_gmp_load_map(i+1); 44 } // for maps 45 } 46 47 // handle direction switch click in description 48 $(document).on('click', '.gmp_directions .gmp_switch', function() { 49 if ($(this).siblings('.gmp_start').is(':visible')) { 50 $(this).siblings('.gmp_start').hide(); 51 $(this).siblings('.gmp_start').children('input').prop('disabled', true); 52 53 $(this).siblings('.gmp_end').children('input').prop('disabled', false); 54 $(this).siblings('.gmp_end').show(); 55 } else { 56 $(this).siblings('.gmp_start').show(); 57 $(this).siblings('.gmp_start').children('input').prop('disabled', false); 58 59 $(this).siblings('.gmp_end').hide(); 60 $(this).siblings('.gmp_end').children('input').prop('disabled', true); 61 } 62 63 return false; 64 }); // directions switch 65 66 // fullscreen button click 67 $(document).on('click', '.wf_gmp_fullscreen a', function() { 68 map_id = $(this).data('map-id'); 69 wf_gmp_toggle_fullscreen(map_id); 70 71 return false; 72 }); // fullscreen button 73}); // onload 74 75// load single map 76function wf_gmp_load_map(map_number) { 77 map = wf_gmp_maps[map_number - 1]; 78 map_obj = jQuery('#wf-gmp_' + map_number); 79 80 // place pins 81 tmp_pins = []; 82 for(var i=0, len = map.pins.length; i < len; i++) { 83 pin = map.pins[i]; 84 85 if (pin.latlng) { 86 tmp_pins.push({latLng:[pin.lat, pin.lng], options:{title: pin.tooltip, icon: pin.icon, animation: parseInt(pin.bounce, 10), show_description: parseInt(pin.show_description, 10), data: pin.description }}); 87 } else { 88 tmp_pins.push({address: pin.address, options:{title: pin.tooltip, icon: pin.icon, animation: parseInt(pin.bounce, 10), show_description: parseInt(pin.show_description, 10), data: pin.description }}); 89 } 90 } // for pins 91 92 // add pins 93 map_obj.gmap3({ marker:{ values: tmp_pins, events:{ click: function(marker, event, context){ wf_gmp_pin_click(map_number, marker, event, marker.data); } } }}); 94 95 96 // predefined skin 97 if (map.skin && gmp_skins[map.skin] !== undefined) { 98 map_obj.gmap3({ map:{ options: { styles: gmp_skins[map.skin]} } }) ; 99 } 100 101 // simple map color/hue 102 if (map.color && map.color != '#ffffff') { 103 map_obj.gmap3({ map:{ options:{styles: [{ "stylers": [{ "hue": map.color } ]} ] } } }) ; 104 } 105 106 // set zoom 107 map_obj.gmap3({ map:{ options:{ zoom: map.zoom, cache: true } } }); 108 109 // disable mouse scroll wheel? 110 if (map.disable_scrollwheel) { 111 map_obj.gmap3({ map:{ options:{ scrollwheel: false } } }); 112 } 113 114 // lock map? 115 if (map.lock_map) { 116 map_obj.gmap3({ map:{ options:{ scrollwheel: false, 117 zoomControl: false, 118 panControl: false, 119 draggable: false, 120 mapTypeControl: false, 121 disableDoubleClickZoom: true, 122 keyboardShortcuts: false, 123 streetViewControl: false 124 } } }); 125 } 126 127 // set map type 128 if (map.type == 'roadmap') { 129 map_obj.gmap3({ map:{ options:{ mapTypeId: google.maps.MapTypeId.ROADMAP } } }); 130 } else if (map.type == 'satellite') { 131 map_obj.gmap3({ map:{ options:{ mapTypeId: google.maps.MapTypeId.SATELLITE } } }); 132 } else if (map.type == 'hybrid') { 133 map_obj.gmap3({ map:{ options:{ mapTypeId: google.maps.MapTypeId.HYBRID } } }); 134 } else if (map.type == 'terrain') { 135 map_obj.gmap3({ map:{ options:{ mapTypeId: google.maps.MapTypeId.TERRAIN } } }); 136 } 137 138 // autofit map based on pins 139 if (map.autofit) { 140 map_obj.gmap3({ autofit:{} }); 141 } 142 143 // set various layers 144 if (map.weather) { 145 map_obj.gmap3({ weatherlayer:{} }); 146 } 147 if (map.traffic) { 148 map_obj.gmap3({ trafficlayer:{} }); 149 } 150 if (map.clouds) { 151 map_obj.gmap3({ cloudlayer:{} }); 152 } 153 if (map.transit) { 154 map_obj.gmap3({ transitlayer:{} }); 155 } 156 if (map.bicycle) { 157 map_obj.gmap3({ bicyclinglayer:{} }); 158 } 159 160 // add fullscreen button markup 161 if (map.fullscreen) { 162 map_obj.gmap3({ panel:{ 163 options:{ 164 content: '<div class="wf_gmp_fullscreen" style="border: none; right: 100px; top: 5px; position: absolute;">' + 165 '<a data-map-id="' + map_number + '" href="#" title="Toggle fullscreen mode"><img src="' + wf_gmp_plugin_url + '/images/fullscreen.png" width="29" title="Toggle fullscreen mode"></a>' + '</div>'} 166 }}); 167 } 168 169 // show description onLoad 170 map_obj.gmap3( {map: { events: { idle: function() { 171 map_obj2 = jQuery('#wf-gmp_' + map_number); 172 if (map_obj2.data('loaded')) { 173 return; 174 } else { 175 map_obj2.data('loaded', true); 176 } 177 178 markers = map_obj2.gmap3({get:{name:'marker', all: true}}); 179 jQuery.each(markers, function(key, marker) { 180 if (marker.show_description && marker.data) { 181 wf_gmp_pin_click(map_number, marker, false, marker.data); 182 return false; 183 } 184 if (!wf_gmp_maps[map_number - 1].autofit) { 185 return false; 186 } 187 });
188 }}}}); 189 190 // rebuild on resize 191 jQuery(window).resize(function() { 192 tmp = map_obj.gmap3('get').getCenter(); 193 map_obj.gmap3({trigger: 'resize'}); 194 if (tmp !== null) { 195 map_obj.gmap3({map: { options: {center: [tmp.k, tmp.A] }}}); 196 } 197 }); 198 199 return map_obj; 200} // wf_gmp_load_map 201 202 203// handle fullscreen button click 204function wf_gmp_toggle_fullscreen(map_number) { 205 map = jQuery('#wf-gmp_' + map_number); 206 207 if (!map.data('backup_style')) { 208 map.data('backup_style', map.attr('style')); 209 } 210 211 if (map.data('fullscreen') == true) { 212 map.attr('style', map.data('backup_style')); 213 map.data('fullscreen', false); 214 map.toggleClass('gmp_fullscreen'); 215 jQuery(document).unbind('keyup.wf_gmp_fullscreen'); 216 jQuery(window).scrollTop(parseInt(map.data('scroll_backup'), 10)); 217 } else { 218 map.data('fullscreen', true); 219 map.data('scroll_backup', jQuery(window).scrollTop()); 220 map.toggleClass('gmp_fullscreen'); 221 map.css('position', 'fixed').css('z-index', parseInt(90000 + map_number, 10)); 222 map.css('width', '100%').css('height', '100%'); 223 map.css('top', '0').css('left', '0'); 224 jQuery(document).bind('keyup.wf_gmp_fullscreen', function(e){ 225 if (e.keyCode === 27) { 226 wf_gmp_toggle_fullscreen(map_number); 227 } 228 }); 229 } 230 231 tmp = map.gmap3('get').getCenter(); 232 map.gmap3({trigger: 'resize'}); 233 if (tmp !== null) { 234 map.gmap3({map: { options: {center: [tmp.k, tmp.A] }}}); 235 } 236 237 return false; 238} // wf_gmp_toggle_fullscreen 239 240// handle pin click - description show/hide 241function wf_gmp_pin_click(map_number, marker, event, data) { 242 var map = jQuery('#wf-gmp_' + map_number).gmap3('get'); 243 var infowindow = jQuery('#wf-gmp_' + map_number).gmap3({get:{name:'infowindow', tag: 'info-' + map_number}}); 244 245 if (!data) { 246 return; 247 } 248 249 data = '<div class="gmp_infowindow">' + data + '</div>'; 250 251 if (infowindow){ 252 infowindow.open(map, marker); 253 infowindow.setContent(data); 254 } else { 255 jQuery('#wf-gmp_' + map_number).gmap3({ infowindow:{tag: 'info-' + map_number, anchor: marker, options:{content: data} } }); 256 } 257} // wf_gmp_pin_click 258 259gmp_skins = { 260'pale': [{"featureType":"water","stylers":[{"visibility":"on"},{"color":"#acbcc9"}]},{"featureType":"landscape","stylers":[{"color":"#f2e5d4"}]},{"featureType":"road.highway","elementType":"geometry","stylers":[{"color":"#c5c6c6"}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"color":"#e4d7c6"}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"color":"#fbfaf7"}]},{"featureType":"poi.park","elementType":"geometry","stylers":[{"color":"#c5dac6"}]},{"featureType":"administrative","stylers":[{"visibility":"on"},{"lightness":33}]},{"featureType":"road"},{"featureType":"poi.park","elementType":"labels","stylers":[{"visibility":"on"},{"lightness":20}]},{},{"featureType":"road","stylers":[{"lightness":20}]}], 261'blue': [{"featureType":"water","stylers":[{"color":"#46bcec"},{"visibility":"on"}]},{"featureType":"landscape","stylers":[{"color":"#f2f2f2"}]},{"featureType":"road","stylers":[{"saturation":-100},{"lightness":45}]},{"featureType":"road.highway","stylers":[{"visibility":"simplified"}]},{"featureType":"road.arterial","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"administrative","elementType":"labels.text.fill","stylers":[{"color":"#444444"}]},{"featureType":"transit","stylers":[{"visibility":"off"}]},{"featureType":"poi","stylers":[{"visibility":"off"}]}], 262'light': [{"featureType":"water","elementType":"all","stylers":[{"hue":"#e9ebed"},{"saturation":-78},{"lightness":67},{"visibility":"simplified"}]},{"featureType":"landscape","elementType":"all","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"simplified"}]},{"featureType":"road","elementType":"geometry","stylers":[{"hue":"#bbc0c4"},{"saturation":-93},{"lightness":31},{"visibility":"simplified"}]},{"featureType":"poi","elementType":"all","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"off"}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"hue":"#e9ebed"},{"saturation":-90},{"lightness":-8},{"visibility":"simplified"}]},{"featureType":"transit","elementType":"all","stylers":[{"hue":"#e9ebed"},{"saturation":10},{"lightness":69},{"visibility":"on"}]},{"featureType":"administrative.locality","elementType":"all","stylers":[{"hue":"#2c2e33"},{"saturation":7},{"lightness":19},{"visibility":"on"}]},{"featureType":"road","elementType":"labels","stylers":[{"hue":"#bbc0c4"},{"saturation":-93},{"lightness":31},{"visibility":"on"}]},{"featureType":"road.arterial","elementType":"labels","stylers":[{"hue":"#bbc0c4"},{"saturation":-93},{"lightness":-2},{"visibility":"simplified"}]}], 263'bright': [{"featureType":"water","stylers":[{"color":"#19a0d8"}]},{"featureType":"administrative","elementType":"labels.text.stroke","stylers":[{"color":"#ffffff"},{"weight":6}]},{"featureType":"administrative","elementType":"labels.text.fill","stylers":[{"color":"#e85113"}]},{"featureType":"road.highway","elementType":"geometry.stroke","stylers":[{"color":"#efe9e4"},{"lightness":-40}]},{"featureType":"road.arterial","elementType":"geometry.stroke","stylers":[{"color":"#efe9e4"},{"lightness":-20}]},{"featureType":"road","elementType":"labels.text.stroke","stylers":[{"lightness":100}]},{"featureType":"road","elementType":"labels.text.fill","stylers":[{"lightness":-100}]},{"featureType":"road.highway","elementType":"labels.icon"},{"featureType":"landscape","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"landscape","stylers":[{"lightness":20},{"color":"#efe9e4"}]},{"featureType":"landscape.man_made","stylers":[{"visibility":"off"}]},{"featureType":"water","elementType":"labels.text.stroke","stylers":[{"lightness":100}]},{"featureType":"water","elementType":"labels.text.fill","stylers":[{"lightness":-100}]},{"featureType":"poi","elementType":"labels.text.fill","stylers":[{"hue":"#11ff00"}]},{"featureType":"poi","elementType":"labels.text.stroke","stylers":[{"lightness":100}]},{"featureType":"poi","elementType":"labels.icon","stylers":[{"hue":"#4cff00"},{"saturation":58}]},{"featureType":"poi","elementType":"geometry","stylers":[{"visibility":"on"},{"color":"#f0e4d3"}]},{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"color":"#efe9e4"},{"lightness":-25}]},{"featureType":"road.arterial","elementType":"geometry.fill","stylers":[{"color":"#efe9e4"},{"lightness":-10}]},{"featureType":"poi","elementType":"labels","stylers":[{"visibility":"simplified"}]}], 264'apple': [{"featureType":"water","elementType":"geometry","stylers":[{"color":"#a2daf2"}]},{"featureType":"landscape.man_made","elementType":"geometry","stylers":[{"color":"#f7f1df"}]},{"featureType":"landscape.natural","elementType":"geometry","stylers":[{"color":"#d0e3b4"}]},{"featureType":"landscape.natural.terrain","elementType":"geometry","stylers":[{"visibility":"off"}]},{"featureType":"poi.park","elementType":"geometry","stylers":[{"color":"#bde6ab"}]},{"featureType":"poi","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"poi.medical","elementType":"geometry","stylers":[{"color":"#fbd3da"}]},{"featureType":"poi.business","stylers":[{"visibility":"off"}]},{"featureType":"road","elementType":"geometry.stroke","stylers":[{"visibility":"off"}]},{"featureType":"road","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"color":"#ffe15f"}]},{"featureType":"road.highway","elementType":"geometry.stroke","stylers":[{"color":"#efd151"}]},{"featureType":"road.arterial","elementType":"geometry.fill","stylers":[{"color":"#ffffff"}]},{"featureType":"road.local","elementType":"geometry.fill","stylers":[{"color":"black"}]},{"featureType":"transit.station.airport","elementType":"geometry.fill","stylers":[{"color":"#cfb2db"}]}], 265'gray': [{"featureType":"landscape","stylers":[{"saturation":-100},{"lightness":65},{"visibility":"on"}]},{"featureType":"poi","stylers":[{"saturation":-100},{"lightness":51},{"visibility":"simplified"}]}
265,{"featureType":"road.highway","stylers":[{"saturation":-100},{"visibility":"simplified"}]},{"featureType":"road.arterial","stylers":[{"saturation":-100},{"lightness":30},{"visibility":"on"}]},{"featureType":"road.local","stylers":[{"saturation":-100},{"lightness":40},{"visibility":"on"}]},{"featureType":"transit","stylers":[{"saturation":-100},{"visibility":"simplified"}]},{"featureType":"administrative.province","stylers":[{"visibility":"off"}]},{"featureType":"water","elementType":"labels","stylers":[{"visibility":"on"},{"lightness":-25},{"saturation":-100}]},{"featureType":"water","elementType":"geometry","stylers":[{"hue":"#ffff00"},{"lightness":-25},{"saturation":-97}]}], 266'gowalla': [{"featureType":"road","elementType":"labels","stylers":[{"visibility":"simplified"},{"lightness":20}]},{"featureType":"administrative.land_parcel","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"landscape.man_made","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"transit","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"road.local","elementType":"labels","stylers":[{"visibility":"simplified"}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"visibility":"simplified"}]},{"featureType":"road.highway","elementType":"labels","stylers":[{"visibility":"simplified"}]},{"featureType":"poi","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"road.arterial","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"water","elementType":"all","stylers":[{"hue":"#a1cdfc"},{"saturation":30},{"lightness":49}]},{"featureType":"road.highway","elementType":"geometry","stylers":[{"hue":"#f49935"}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"hue":"#fad959"}]}], 267'gray2': [{"featureType":"all","stylers":[{"saturation":-100},{"gamma":0.5}]}], 268'mapbox': [{"featureType":"water","stylers":[{"saturation":43},{"lightness":-11},{"hue":"#0088ff"}]},{"featureType":"road","elementType":"geometry.fill","stylers":[{"hue":"#ff0000"},{"saturation":-100},{"lightness":99}]},{"featureType":"road","elementType":"geometry.stroke","stylers":[{"color":"#808080"},{"lightness":54}]},{"featureType":"landscape.man_made","elementType":"geometry.fill","stylers":[{"color":"#ece2d9"}]},{"featureType":"poi.park","elementType":"geometry.fill","stylers":[{"color":"#ccdca1"}]},{"featureType":"road","elementType":"labels.text.fill","stylers":[{"color":"#767676"}]},{"featureType":"road","elementType":"labels.text.stroke","stylers":[{"color":"#ffffff"}]},{"featureType":"poi","stylers":[{"visibility":"off"}]},{"featureType":"landscape.natural","elementType":"geometry.fill","stylers":[{"visibility":"on"},{"color":"#b8cb93"}]},{"featureType":"poi.park","stylers":[{"visibility":"on"}]},{"featureType":"poi.sports_complex","stylers":[{"visibility":"on"}]},{"featureType":"poi.medical","stylers":[{"visibility":"on"}]},{"featureType":"poi.business","stylers":[{"visibility":"simplified"}]}], 269'paper': [{"featureType":"landscape","stylers":[{"hue":"#F1FF00"},{"saturation":-27.4},{"lightness":9.4},{"gamma":1}]},{"featureType":"road.highway","stylers":[{"hue":"#0099FF"},{"saturation":-20},{"lightness":36.4},{"gamma":1}]},{"featureType":"road.arterial","stylers":[{"hue":"#00FF4F"},{"saturation":0},{"lightness":0},{"gamma":1}]},{"featureType":"road.local","stylers":[{"hue":"#FFB300"},{"saturation":-38},{"lightness":11.2},{"gamma":1}]},{"featureType":"water","stylers":[{"hue":"#00B6FF"},{"saturation":4.2},{"lightness":-63.4},{"gamma":1}]},{"featureType":"poi","stylers":[{"hue":"#9FFF00"},{"saturation":0},{"lightness":0},{"gamma":1}]}]};
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.