1/** 2 * @namespace WPGMZA 3 * @module CapsuleModules 4 * @requires WPGMZA.EventDispatcher 5 */ 6jQuery(function($) { 7 8 WPGMZA.CapsuleModules = function(){ 9 10 WPGMZA.EventDispatcher.call(this); 11 12 this.proxies = {}; 13 this.capsules = []; 14 this.prepareCapsules(); 15 this.flagCapsules(); 16 } 17 18 WPGMZA.extend(WPGMZA.CapsuleModules, WPGMZA.EventDispatcher); 19 20 WPGMZA.CapsuleModules.getConstructor = function(){ 21 if(WPGMZA.isProVersion()) 22 return WPGMZA.ProCapsuleModules; 23 24 return WPGMZA.CapsuleModules; 25 } 26 27 28 WPGMZA.CapsuleModules.createInstance = function(){ 29 const constructor = WPGMZA.CapsuleModules.getConstructor(); 30 return new constructor(); 31 } 32 33 WPGMZA.CapsuleModules.prototype.proxyMap = function(id, settings){ 34 if(!this.proxies[id]){ 35 this.proxies[id] = Object.create(this); 36 37 this.proxies[id].id = id; 38 39 this.proxies[id].markers = []; 40 41 this.proxies[id].showPreloader = function(){}; 42 this.proxies[id].getMarkerByID = function(){ return {}; }; 43 44 this.proxies[id].markerFilter = WPGMZA.MarkerFilter.createInstance(this.proxies[id]); 45 } 46 47 if(settings){ 48 this.proxies[id].settings = settings; 49 } 50 51 return this.proxies[id]; 52 } 53 54 WPGMZA.CapsuleModules.prototype.flagCapsules = function(){ 55 if(this.capsules){ 56 for(let i in this.capsules){ 57 if(this.capsules[i].element){ 58 $(this.capsules[i].element).addClass('wpgmza-capsule-module'); 59 } 60 } 61 } 62 } 63 64 WPGMZA.CapsuleModules.prototype.prepareCapsules = function(){ 65 this.registerStoreLocator(); 66 } 67 68 WPGMZA.CapsuleModules.prototype.registerStoreLocator = function(){ 69 $('.wpgmza-store-locator').each((index, element) => { 70 const mapId = $(element).data('map-id'); 71 const url = $(element).data('url'); 72 if(mapId && !WPGMZA.getMapByID(mapId)){ 73 if(url){ 74 const settings = $(element).data('map-settings'); 75 const mapProxy = this.proxyMap(mapId, settings); 76 77 const capsule = { 78 type : 'store_locator', 79 element : element, 80 instance : WPGMZA.StoreLocator.createInstance(mapProxy, element) 81 }; 82 83 capsule.instance.isCapsule = true; 84 capsule.instance.redirectUrl = url; 85 86 this.capsules.push(capsule); 87 } else { 88 console.warn("WPGMZA: You seem to have added a stadalone store locator without a map page URL. Please add a URL to your shortcode [wpgmza_store_locator id=\"" + mapId + "\" url=\"{URL}\"] and try again"); 89 } 90 } 91 }); 92 } 93});
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.