PageSourceSearch

https://voli305vodka.com/wp-content/plugins/wordpress-store-locato…ss-store-locator-public-single.js?ver=2.2.1

js voli305vodka.com collected 2026-10-05 19:06:20 UTC 6,483 bytes, 245 lines download raw bytes

1(function( $ ) {
2	'use strict';
3
4	// Create the defaults once
5	var pluginName = "storeLocatorSingle",
6		defaults = {
7			map_min_height: 300,
8			earthRadi: {
9				mi: 3963.1676,
10				km: 6378.1,
11				ft: 20925524.9,
12				mt: 6378100,
13				"in": 251106299,
14				yd: 6975174.98,
15				fa: 3487587.49,
16				na: 3443.89849,
17				ch: 317053.408,
18				rd: 1268213.63,
19				fr: 31705.3408
20			},
21		};
22
23	// The actual plugin constructor
24	function Plugin ( element, options ) {
25		this.element = element;
26		this.settings = $.extend( {}, defaults, options );
27		this._defaults = defaults;
28
29		this.settings.lat = $(element).data('lat');
30		this.settings.lng = $(element).data('lng');
31
32		this._name = pluginName;
33		this.init();
34	}
35
36	// Avoid Plugin.prototype conflicts
37	$.extend( Plugin.prototype, {
38		init: function() {
39			var that = this;
40			this.window = $(window);
41			this.documentHeight = $( document ).height();
42			this.windowHeight = this.window.height();
43			this.settings.singleStoreShowMapZoom = parseInt(that.settings.singleStoreShowMapZoom);
44			this.templateCache = {};
45			this.bounds = new google.maps.LatLngBounds();
46
47			that.initStoreLocatorSingle();
48		},
49		initStoreLocatorSingle: function() {
50			var that = this;
51
52			that.initMap(function(){
53				that.createMarker();  
54
55				if(that.settings.singleStoreLivePosition == "1") {
56					that.createLivePosition();
57				}
58			});
59		},
60		initMap: function(callback) {
61
62			var that = this;
63
64			var mapContainer = $(this.element);
65		    var singleStoreShowMapZoom = this.settings.singleStoreShowMapZoom;
66		    var mapDefaultType = this.settings.mapDefaultType;
67		    var mapDefaultLat = Number(this.settings.lat);
68		    var mapDefaultLng = Number(this.settings.lng);
69
70		    var mapStyling = this.settings.mapStyling;
71		    if( !this.isEmpty(mapStyling) ) {
72		    	mapStyling = JSON.parse(mapStyling);
73		    } else {
74		    	mapStyling = "";
75		    }
76
77		    var options = {
78				zoom: singleStoreShowMapZoom,
79				center: new google.maps.LatLng(mapDefaultLat, mapDefaultLng),
80				mapTypeId: google.maps.MapTypeId[mapDefaultType],
81				scrollwheel: false,
82				styles: mapStyling
83		    };
84
85		    if(this.settings.singleStoreShowMapDisablePanControl == "1") {
86		    	options.panControl = false;
87		    }
88
89		    if(this.settings.singleStoreShowMapDisableZoomControl == "1") {
90		    	options.zoomControl = false;
91		    }
92
93		    if(this.settings.singleStoreShowMapDisableScaleControl == "1") {
94		    	options.scaleControl = false;
95		    }
96
97		    if(this.settings.singleStoreShowMapDisableStreetViewControl == "1") {
98		    	options.streetViewControl = false;
99		    }
100
101		    if(this.settings.singleStoreShowMapDisableFullscreenControl == "1") {
102		    	options.fullscreenControl = false;
103		    }
104
105		    if(this.settings.singleStoreShowMapDisableMapTypeControl == "1") {
106		    	options.mapTypeControl = false;
107		    }
108
109		    // Construct Map
110		   	this.map = new google.maps.Map(mapContainer[0], options);
111
112		    callback();
113		},
114		createMarker: function() {
115		   	var marker;
116		   	var store = {};
117
118			store.map = this.map;
119			store.position = new google.maps.LatLng(this.settings.lat, this.settings.lng);
120			store.icon = this.settings.singleStorenMapIcon;
121
122			this.bounds.extend(store.position);
123
124		    marker = new google.maps.Marker(store);
125		    marker.setMap(this.map);
126		},
127		createLivePosition : function() {
128
129			var that = this;
130
131			if( that.isEmpty(that.settings.live_lat) || that.settings.live_lat == "0" || that.isEmpty(that.settings.live_lng) || that.settings.live_lng == "0") {
132				return;
133			}
134
135			that.liveStore = {};
136
137			that.liveStore.map = that.map;
138			that.liveStore.position = new google.maps.LatLng(that.settings.live_lat, that.settings.live_lng);
139			that.liveStore.icon = { "url": that.settings.singleStoreLivePositionMapIcon } ;
140
141		    that.liveStoreMarker = new google.maps.Marker(that.liveStore);
142		    that.liveStoreMarker.setMap(that.map);
143		    that.liveStoreMarker.position = false;
144
145			setInterval( function(){ 
146				
147				jQuery.ajax({
148					url: that.settings.ajax_url,
149					type: 'post',
150					dataType: 'JSON',
151					data: {
152						action: 'get_single_store_live_position',
153						post_id: that.settings.post_id,
154					},
155					success : function( response ) {
156
157						var newLatLngKey = response.lat + response.lng;
158						var newPosition = new google.maps.LatLng(response.lat, response.lng);
159						if(that.liveStoreMarker.latLngKey == newLatLngKey) {
160							return;
161						}
162
163						that.liveStoreMarker.latLngKey = newLatLngKey;
164
165						that.liveStoreMarker.setPosition(newPosition);
166
167						that.bounds.extend(newPosition);
168						that.map.fitBounds(that.bounds);
169					},
170					error: function(jqXHR, textStatus, errorThrown) {
171
172					    alert('An Error Occured: ' + jqXHR.status + ' ' + errorThrown + '! Please contact System Administrator!');
173					}
174				});
175
176			}, that.settings.singleStoreLivePositionInterval);
177
178
179// // 1. Create a marker and keep a reference to it:
180
181// var latLng = new google.maps.LatLng(-12.042, -77.028333),
182//     marker = new google.maps.Marker({ position: latLng , map: map });
183
184// marker.setMap(map);
185
186// // 2. Move it around by setting a new position:
187
188// var newPosition = new google.maps.LatLng(-12.042, -78.028333);
189// marker.setPosition(newPosition);
190
191		},
192		//////////////////////
193		///Helper Functions///
194		//////////////////////
195		isEmpty: function(obj) {
196
197		    if (obj == null)		return true;
198		    if (obj.length > 0)		return false;
199		    if (obj.length === 0)	return true;
200
201		    for (var key in obj) {
202		        if (hasOwnProperty.call(obj, key)) return false;
203		    }
204
205		    return true;
206		},
207		sprintf: function parse(str) {
208		    var args = [].slice.call(arguments, 1),
209		        i = 0;
210
211		    return str.replace(/%s/g, function() {
212		        return args[i++];
213		    });
214		},
215		getCookie: function(cname) {
216		    var name = cname + "=";
217		    var ca = document.cookie.split(';');
218		    for(var i=0; i<ca.length; i++) {
219		        var c = ca[i];
220		        while (c.charAt(0)==' ') c = c.substring(1);
221		        if (c.indexOf(name) === 0) return c.substring(name.length, c.length);
222		    }
223		    return "";
224		},
225	} );
226
227	// Constructor wrapper
228	$.fn[ pluginName ] = function( options ) {
229		return this.each( function() {
230			if ( !$.data( this, "plugin_" + pluginName ) ) {
231				$.data( this, "plugin_" +
232					pluginName, new Plugin( this, options ) );
233			}
234		} );
235	};
236
237	$(document).ready(function() {
238
239		$( ".store_locator_single_map_render" ).storeLocatorSingle( 
240			store_locator_options
241		);
242
243	} );
244
245})( 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.