PageSourceSearch

https://stonemaiergames.com/wp-content/plugins/wp-google-maps/js/v…?ver=10.1.10%2Bpro-10.1.06

js stonemaiergames.com collected 2026-10-02 02:28:27 UTC 7,925 bytes, 266 lines download raw bytes

1/**
2 * @namespace WPGMZA
3 * @module ModernStoreLocator
4 * @requires WPGMZA
5 * @pro-requires WPGMZA.UseMyLocationButton
6 */
7jQuery(function($) {
8	
9	/**
10	 * The new modern look store locator. It takes the elements from the default look and moves them into the map, wrapping in a new element so we can apply new styles. <strong>Please <em>do not</em> call this constructor directly. Always use createInstance rather than instantiating this class directly.</strong> Using createInstance allows this class to be externally extensible.
11	 * @class WPGMZA.ModernStoreLocator
12	 * @constructor WPGMZA.ModernStoreLocator
13	 * @memberof WPGMZA
14	 * @param {int} map_id The ID of the map this store locator belongs to
15	 */
16	WPGMZA.ModernStoreLocator = function(map_id)
17	{
18		var self = this;
19		var original;
20		var map = WPGMZA.getMapByID(map_id);
21		
22		WPGMZA.assertInstanceOf(this, "ModernStoreLocator");
23		
24		if(WPGMZA.isProVersion())
25			original = $(".wpgmza_sl_search_button[mid='" + map_id + "'], .wpgmza_sl_search_button_" + map_id).closest(".wpgmza_sl_main_div");
26		else
27			original = $(".wpgmza_sl_search_button").closest(".wpgmza_sl_main_div");
28		
29		if(!original.length)
30			return;
31		
32		// Build / re-arrange elements
33		this.element = $("<div class='wpgmza-modern-store-locator'><div class='wpgmza-inner wpgmza-modern-hover-opaque'/></div>")[0];
34		
35		var inner = $(this.element).find(".wpgmza-inner");
36		
37		var addressInput;
38		if(WPGMZA.isProVersion())
39			addressInput = $(original).find(".addressInput");
40		else
41			addressInput = $(original).find("#addressInput");
42		
43		if(map.settings.store_locator_query_string && map.settings.store_locator_query_string.length)
44			addressInput.attr("placeholder", map.settings.store_locator_query_string);
45		
46		inner.append(addressInput);
47		
48		var titleSearch = $(original).find("[id='nameInput_" + map_id + "']");
49		if(titleSearch.length)
50		{
51			var placeholder = map.settings.store_locator_name_string;
52			if(placeholder && placeholder.length)
53				titleSearch.attr("placeholder", placeholder);
54			inner.append(titleSearch);
55		}
56		
57		var button;
58		if(button = $(original).find("button.wpgmza-use-my-location"))
59			inner.append(button);
60		
61		$(addressInput).on("keydown keypress", function(event) {
62			
63			if(event.keyCode == 13 && self.searchButton.is(":visible"))
64				self.searchButton.trigger("click");
65			
66		});
67		
68		$(addressInput).on("input", function(event) {
69			
70			self.searchButton.show();
71			self.resetButton.hide();
72			
73		});
74		
75		inner.append($(original).find("select.wpgmza_sl_radius_select"));
76		// inner.append($(original).find(".wpgmza_filter_select_" + map_id));
77		
78		// Buttons
79		this.searchButton = $(original).find( ".wpgmza_sl_search_button, .wpgmza_sl_search_button_div" );
80		inner.append(this.searchButton);
81		
82		this.resetButton = $(original).find( ".wpgmza_sl_reset_button_div" );
83		inner.append(this.resetButton);
84		
85		this.resetButton.on("click", function(event) {
86			resetLocations(map_id);
87		});
88		
89		this.resetButton.hide();
90		
91		if(WPGMZA.isProVersion())
92		{
93			this.searchButton.on("click", function(event) {
94				if($("addressInput_" + map_id).val() == 0)
95					return;
96				
97				self.searchButton.hide();
98				self.resetButton.show();
99				
100				map.storeLocator.state = WPGMZA.StoreLocator.STATE_APPLIED;
101			});
102			this.resetButton.on("click", function(event) {
103				self.resetButton.hide();
104				self.searchButton.show();
105				
106				map.storeLocator.state = WPGMZA.StoreLocator.STATE_INITIAL;
107			});
108		}
109		
110		// Distance type
111		inner.append($("#wpgmza_distance_type_" + map_id));
112		
113		// Categories
114		var container = $(original).find(".wpgmza_cat_checkbox_holder");
115		var ul = $(container).children("ul");
116		var items = $(container).find("li");
117		var numCategories = 0;
118		
119		//$(items).find("ul").remove();
120		//$(ul).append(items);
121		
122		var icons = [];
123		
124		items.each(function(index, el) {
125			var id = $(el).attr("class").match(/\d+/);
126			
127			for(var category_id in wpgmza_category_data) {
128				
129				if(id == category_id) {
130					var src = wpgmza_category_data[category_id].image;
131					var icon = $('<div class="wpgmza-chip-icon"/>');
132					
133					icon.css({
134						"background-image": "url('" + src + "')",
135						"width": $("#wpgmza_cat_checkbox_" + category_id + " + label").height() + "px"
136					});
137					icons.push(icon);
138					
139                    if(src != null && src != ""){
140					   //$(el).find("label").prepend(icon);
141                       $("#wpgmza_cat_checkbox_" + category_id + " + label").prepend(icon);
142                    }
143					
144					numCategories++;
145					
146					break;
147				}
148				
149			}
150		});
151
152        $(this.element).append(container);
153
154		
155		if(numCategories) {
156			this.optionsButton = $('<span class="wpgmza_store_locator_options_button"><i class="fa fa-list"></i></span>');
157			$(this.searchButton).before(this.optionsButton);
158		}
159		
160		setInterval(function() {
161			
162			icons.forEach(function(icon) {
163				var height = $(icon).height();
164				$(icon).css({"width": height + "px"});
165				$(icon).closest("label").css({"padding-left": height + 8 + "px"});
166			});
167			
168			$(container).css("width", $(self.element).find(".wpgmza-inner").outerWidth() + "px");
169			
170		}, 1000);
171		
172		$(this.element).find(".wpgmza_store_locator_options_button").on("click", function(event) {
173			
174			if(container.hasClass("wpgmza-open"))
175				container.removeClass("wpgmza-open");
176			else
177				container.addClass("wpgmza-open");
178			
179		});
180		
181		// Remove original element
182		$(original).remove();
183		
184		// Event listeners
185		$(this.element).find("input, select").on("focus", function() {
186			$(inner).addClass("active");
187		});
188		
189		$(this.element).find("input, select").on("blur", function() {
190			$(inner).removeClass("active");
191		});
192		
193		$(this.element).on("mouseover", "li.wpgmza_cat_checkbox_item_holder", function(event) {
194			self.onMouseOverCategory(event);
195		});
196		
197		$(this.element).on("mouseleave", "li.wpgmza_cat_checkbox_item_holder", function(event) {
198			self.onMouseLeaveCategory(event);
199		});
200		
201		$('body').on('click', '.wpgmza_store_locator_options_button', function(event) {
202			setTimeout(function(){
203
204				if ($('.wpgmza_cat_checkbox_holder').hasClass('wpgmza-open')) {
205
206					var p_cat = $( ".wpgmza_cat_checkbox_holder" );
207					var position_cat = p_cat.position().top + p_cat.outerHeight(true) + $('.wpgmza-modern-store-locator').height();
208			
209					var $p_map = $('.wpgmza_map');  
210					var position_map = $p_map.position().top + $p_map.outerHeight(true); 
211
212					var cat_height = position_cat;
213
214					if (cat_height >= position_map) {
215			
216						$('.wpgmza_cat_ul').css('overflow', 'scroll ');
217					
218						$('.wpgmza_cat_ul').css('height', '100%');
219				
220						$('.wpgmza-modern-store-locator').css('height','100%');
221						$('.wpgmza_cat_checkbox_holder.wpgmza-open').css({'padding-bottom': '50px', 'height': '100%'});
222					}
223				}
224			}, 500);
225		});
226
227	}
228	
229	/**
230	 * Creates an instance of a modern store locator, <strong>please <em>always</em> use this function rather than calling the constructor directly</strong>.
231	 * @method
232	 * @memberof WPGMZA.ModernStoreLocator
233	 * @param {int}
233 map_id The ID of the map this store locator belongs to
234	 * @return {WPGMZA.ModernStoreLocator} An instance of WPGMZA.ModernStoreLocator
235	 */
236	WPGMZA.ModernStoreLocator.createInstance = function(map_id) {
237		
238		switch(WPGMZA.settings.engine)
239		{
240			case "open-layers":
241			case "open-layers-latest":
242				return new WPGMZA.OLModernStoreLocator(map_id);
243				break;
244			
245			default:
246				return new WPGMZA.GoogleModernStoreLocator(map_id);
247				break;
248		}
249	}
250	
251	// TODO: Move these to a Pro module
252	WPGMZA.ModernStoreLocator.prototype.onMouseOverCategory = function(event)
253	{
254		var li = event.currentTarget;
255		
256		$(li).children("ul.wpgmza_cat_checkbox_item_holder").stop(true, false).fadeIn();
257	}
258	
259	WPGMZA.ModernStoreLocator.prototype.onMouseLeaveCategory = function(event)
260	{
261		var li = event.currentTarget;
262		
263		$(li).children("ul.wpgmza_cat_checkbox_item_holder").stop(true, false).fadeOut();
264	}
265	
266});

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.