1(function( $ ) { 2 (async () => { 3 // Creating global for devs 4 window.mwm_v2 = { 5 preloadedFns : [], 6 onload: (fn) => window.mwm_v2.preloadedFns.push(fn) 7 } 8 // Load 9 let mapster = false; 10 if (window.mapster_params.is_dev === "true") { 11 const base_url = "http://localhost:5173"; 12 if (window.mapster_params.map_provider === "maplibre" || window.mapster_params.map_provider === "custom-image") { 13 mapster = await import(`${base_url}/src/index-maplibre.js`); 14 } 15 if (window.mapster_params.map_provider === "mapbox") { 16 mapster = await import(`${base_url}/src/index-mapbox.js`); 17 } 18 if (window.mapster_params.map_provider === "google-maps") { 19 mapster = await import(`${base_url}/src/index-google.js`); 20 } 21 } else { 22 const base_url = window.mapster_params.sdk_base_url; 23 const free = window.mapster_params.is_pro === "true" ? "pro" : "free"; 24 const ver = window.mapster_params.sdk_version ? `?ver=${window.mapster_params.sdk_version}` : ""; 25 if (window.mapster_params.map_provider === "maplibre" || window.mapster_params.map_provider === "custom-image") { 26 mapster = await import(`${base_url}/${free}/mapster-maplibre-${free}.js${ver}`); 27 } 28 if (window.mapster_params.map_provider === "mapbox") { 29 mapster = await import(`${base_url}/${free}/mapster-mapbox-${free}.js${ver}`); 30 } 31 if (window.mapster_params.map_provider === "google-maps") { 32 mapster = await import(`${base_url}/${free}/mapster-google-${free}.js${ver}`); 33 } 34 } 35 // Public 36 waitForElm('.mapster-wp-maps').then(() => { 37 mapster.MapManager.registerAll( 38 mapster.MapInstance, 39 $('.mapster-wp-maps').toArray(), 40 async (element) => { 41 const post_id = element.id.replace('mapster-wp-maps-', ''); 42 const single_feature_id = $(`#${element.id}`).data('single_feature_id') !== "" ? $(`#${element.id}`).data('single_feature_id') : false; 43 const feature_ids = $(`#${element.id}`).data('feature_ids') !== "" ? $(`#${element.id}`).data('feature_ids') : false; 44 const singleFeatureQueryString = single_feature_id ? `&single_feature_id=${single_feature_id}` : ''; 45 const featuresQueryString = feature_ids ? `&feature_ids=${feature_ids}` : ''; 46 const data = await fetch(`${window.mapster_params.rest_url}mapster-wp-maps/map${window.mapster_params.qd}id=${post_id}&sdk=true${singleFeatureQueryString}${featuresQueryString}`).then(r => r.json()); 47 return { 48 config: data.config, 49 features: data.features, 50 paid : window.mapster_params.is_pro === "true" 51 }; 52 } 53 ); 54 }); 55 })(); 56 57 58 function waitForElm(selector) { 59 return new Promise(resolve => { 60 if (document.querySelector(selector)) { 61 return resolve(document.querySelector(selector)); 62 } 63 64 const observer = new MutationObserver(mutations => { 65 if (document.querySelector(selector)) { 66 resolve(document.querySelector(selector)); 67 observer.disconnect(); 68 } 69 }); 70 71 observer.observe(document.body, { 72 childList: true, 73 subtree: true 74 }); 75 }); 76 } 77 78})( 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.