1var secra; 2 3if (!secra){ 4 secra = {}; 5} 6 7// Checking if JQuery is available. 8if (!$){ 9 if(console){ 10 if(console.log){ 11 console.log('Missing JQuery!'); 12 } 13 } 14} 15 16////////////////////////////////////////////////////////////////////////////// 17 18// Setting up default values for initial map. Defaultoptions are our fallback-values. 19secra.leafletMap = function (options) { 20 var defaultoptions = { 21 folder: '/example/dist', 22 embed_id: 'map', 23 lat: '23', 24 lng: '10', 25 zoom: '10', 26 url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', 27 enableEsri: false 28 }; 29 30 this.options = $.extend(defaultoptions, options); 31 32 // Saving the map. 33 this.map = null; 34 35 $(window).ready($.proxy(this.makeMap, this)); 36 37}; 38 39 40secra.leafletMap.prototype.sendError = function(msg) { 41 if (console){ 42 if(console.log){ 43 console.log(msg); 44 } 45 } 46}; 47 48// Building the actual map. 49secra.leafletMap.prototype.makeMap = function() { 50 // Checking if default value is available. 51 if(!document.getElementById(this.options.embed_id)) { 52 this.sendError('No embed_id!'); 53 return; 54 } 55 56 // Setting up our icon and building path to actual resource. 57 var icon = L.icon({ 58 iconUrl: this.options.folder + '/images/marker-icon.png', 59 iconLocation: [ ], 60 iconSize: [ ], // Size of the icon-source. 61 iconAnchor: [12, 41] 62 }); 63 64 // Telling Leaflet that we're about to build a map. 65 this.map = L.map (this.options.embed_id, { 66 loadingControl: true, 67 fullscreenControl: true 68 }); 69 70 // Building the map with default options. 71 // Getting tiles from some URL, in this case official OSM-Source and adding them to our map. Credits for using OSM 72 var osm = L.tileLayer(this.options.url, { 73 attribution: '© <a href="http://openstreetmap.org">OpenStreetMap</a> contributors', 74 maxZoom: 22 75 }).addTo(this.map); 76 77 if(this.options.enableEsri){ 78 var Esri_WorldImagery = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', { 79 attribution: 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community' 80 }); 81 82 var baseMaps = { 83 "Strassen": osm, 84 "Satellit": Esri_WorldImagery 85 }; 86 87 L.control.layers(baseMaps, {}).addTo(this.map); 88 } 89 90 // Marker is set up on custom location and added to map. 91 L.marker ([this.options.lat, this.options.lng], {icon: icon}).addTo(this.map); 92 93 // Finish our default map by giving it a zoom level and some coordinates. 94 var index = new L.LatLng(this.options.lat, this.options.lng); 95 this.map.setView(index, this.options.zoom); 96};
97/////////////////////////////////////////////////////////////////
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.