1/*-------------------------------------------------------------- 2 Copyright (C) pixelemu.com 3 License: http://www.pixelemu.com/license.html PixelEmu Proprietary Use License 4 Website: http://www.pixelemu.com 5 Support: [email protected] 6---------------------------------------------------------------*/ 7 8// Google Maps 9 10(function($) { 11 12 "use strict"; 13 14 /* -------------------------------------------------------- */ 15 /* FUNCTIONS */ 16 /* -------------------------------------------------------- */ 17 18 $(document).ready(function(){ 19 if( $('.pe_map_canvas').length ) { //load only if needed 20 //console.log('Map needed'); 21 if (window.google && google.maps) { 22 // Map script is already loaded 23 initializeMap(); 24 } else { 25 //Lazy loading Google Map API 26 lazyLoadGoogleMap(); 27 } 28 } 29 }); 30 31 function lazyLoadGoogleMap() { 32 var script = '//maps.google.com/maps/api/js?sensor=true&callback=initializeMap'; 33 if( typeof pemaps !== 'undefined' ) { 34 script = '//maps.google.com/maps/api/js?key=' + pemaps.key + '&sensor=true&callback=initializeMap'; 35 } else { 36 window.pemaps = {}; 37 } 38 $.getScript(script) 39 .done(function (script, textStatus) { 40 //console.log("Google map script loaded successfully"); 41 }) 42 .fail(function (jqxhr, settings, ex) { 43 //console.log("Could not load Google Map script: " + jqxhr); 44 }); 45 } 46 47 function initializeMap() { 48 $('.pe_map_canvas').each(function() { 49 var mapID = $(this).attr('id'); 50 var zoom = parseInt( $(this).attr('data-zoom') ); 51 var latitude = $(this).attr('data-lat'); 52 var longitude = $(this).attr('data-lng'); 53 var scroll = $(this).attr('data-scroll'); 54 var control = $(this).attr('data-control'); 55 var tooltip = $(this).attr('data-tooltip'); 56 57 var options = { 58 zoom: zoom, 59 center: new google.maps.LatLng(latitude, longitude), 60 scrollwheel: scroll, 61 disableDefaultUI: control, 62 mapTypeId: google.maps.MapTypeId.ROADMAP 63 } 64 65 var location = new google.maps.LatLng(latitude, longitude); 66 var bounds = new google.maps.LatLngBounds(); 67 var map = new google.maps.Map(document.getElementById(mapID), options); 68 var marker = new google.maps.Marker({ 69 position: location, 70 map: map, 71 }); 72 73 if( tooltip && tooltip != 'disable' ) { 74 // add tootltip 75 var infoWindow = new google.maps.InfoWindow({ 76 content: tooltip, 77 }); 78 infoWindow.open(mapID, marker); 79 google.maps.event.addListener(marker, 'click', function () { 80 infoWindow.open(mapID, marker); 81 }); 82 } 83 84 //create object 85 window.pemaps[mapID] = { 86 map: map, 87 marker: marker, 88 infoWindow: infoWindow, 89 tooltip: tooltip, 90 } 91 92 }); 93 } 94 window.initializeMap = initializeMap; 95 96})(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.