1/* 2 * Note, this does not auto-load, because it does not contain identifiable namespaces or module dependencies 3 * 4 * For the beta, this is intentional. It will likely change with time 5*/ 6jQuery(function($) { 7 WPGMZA.Map.prototype.__fetchFeaturesViaREST = WPGMZA.Map.prototype.fetchFeaturesViaREST; 8 9 WPGMZA.Map.prototype.fetchFeaturesViaREST = function(){ 10 if(typeof WPGMZA_CACHE !== 'undefined' && typeof WPGMZA_CACHE.markers !== 'undefined' && typeof WPGMZA_CACHE.markers.defer !== 'undefined'){ 11 /* Deferred loading */ 12 if(WPGMZA_CACHE.markers.defer.trim().length > 0){ 13 $.ajax(WPGMZA_CACHE.markers.defer.trim()).then((data) => { 14 if(data && data instanceof Object){ 15 /* Repopulate the local cache now */ 16 for(let cacheKey in data){ 17 WPGMZA_CACHE.markers[cacheKey] = data[cacheKey]; 18 } 19 20 if(typeof WPGMZA_CACHE.markers.data !== 'undefined'){ 21 /* Deferred data loaded correctly */ 22 this.fetchFeaturesViaCache(); 23 WPGMZA_CACHE.markers.info.source = "defer-cache"; 24 } else { 25 /* Something has gone wrong */ 26 this.__fetchFeaturesViaREST(); 27 WPGMZA_CACHE.markers.info.source = "rest"; 28 } 29 } 30 }).catch((error) => { 31 /* Something went wrong, use original function */ 32 this.__fetchFeaturesViaREST(); 33 WPGMZA_CACHE.markers.info = {}; 34 WPGMZA_CACHE.markers.info.source = "rest"; 35 }); 36 } else { 37 /* Cache is not ready yet, use original function */ 38 this.__fetchFeaturesViaREST(); 39 WPGMZA_CACHE.markers.info = {}; 40 WPGMZA_CACHE.markers.info.source = "rest"; 41 } 42 } else { 43 /* Localized loading */ 44 if(typeof WPGMZA_CACHE === 'undefined' || typeof WPGMZA_CACHE.markers === 'undefined' || typeof WPGMZA_CACHE.markers.data === 'undefined'){ 45 /* Run the original function - Missing cache localized data */ 46 this.__fetchFeaturesViaREST(); 47 WPGMZA_CACHE.markers.info.source = "rest"; 48 } else { 49 /* Load from the cache - Data was found in the page source*/ 50 this.fetchFeaturesViaCache(); 51 WPGMZA_CACHE.markers.info.source = "cache"; 52 } 53 } 54 } 55 56 WPGMZA.Map.prototype.fetchFeaturesViaCache = function(){ 57 const mapIds = [parseInt(this.id)]; 58 if(this.mashupIDs && this.mashupIDs.length){ 59 for(let id of this.mashupIDs){ 60 mapIds.push(parseInt(id)); 61 } 62 } 63 64 let cachedData = []; 65 for(let mapId of mapIds){ 66 if(typeof WPGMZA_CACHE.markers.data[mapId] !== 'undefined'){ 67 cachedData = cachedData.concat(WPGMZA_CACHE.markers.data[mapId]); 68 } 69 } 70 71 this.onMarkersFetched(cachedData, false); 72 73 var self = this; 74 var data; 75 var filter = this.markerFilter.getFilteringParameters(); 76 77 data = this.getRESTParameters({ 78 filter: JSON.stringify(filter) 79 }); 80 81 data.exclude = "markers"; 82 WPGMZA.restAPI.call("/features/", { 83 useCompressedPathVariable: true, 84 data: data, 85 success: function(result, status, xhr) { 86 self.onFeaturesFetched(result); 87 } 88 }); 89 } 90})
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.