PageSourceSearch

https://www.sanantoniomag.com/wp-content/plugins/web-directory-pro-v2/assets/js/frontend.js?ver=1.0.0

js sanantoniomag.com collected 2026-09-24 09:13:03 UTC 5,356 bytes, 200 lines download raw bytes

1var WDP = {};
2(function ($, window, wp, document, undefined) {
3	'use strict';
4	WDP = {
5		init: function () {
6			$(document).on('mouseenter', '.wdp-listing-item', WDP.FocusMarkerOnMap);
7			$('.wdp-location-picker').on('click', WDP.userLocationHandler);
8			$('.wdp-mobile-filter-bar').on('click', WDP.filterbarCollapse);
9			$('#listing-claim-form').on('submit', WDP.handleClaimForm);
10			WDP.initDropdownMenu('#header-dropdown-opener');
11		},
12
13		initPlugins: function () {
14			jQuery('.wdp-filter select').each(function () {
15				$(this).SumoSelect({
16					search: true,
17					forceCustomRendering: true,
18					placeholder: $(this).data('label')
19				});
20			});
21		},
22		isMobile: function () {
23			return /Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
24		},
25		initMap: function () {
26			if (WDP.isMobile() && window.hideOnMobile){
27				return;
28			}
29
30			var wdp_locations = window.wdp_locations || [];
31			if (!wdp_locations.length){
32				return;
33			}
34
35			var mapZoom = window.mapZoom || 10;
36
37			window.maplace = new Maplace({
38				map_div: '#gmap',
39				map_options: {
40					mapTypeId: google.maps.MapTypeId.ROADMAP,
41					streetViewControl: !1,
42					controls_cssclass: 'hidden',
43					controls_on_map: !1,
44					mapTypeControl: !1,
45					minZoom: 3,
46					maxZoom: 18,
47					zoom: mapZoom,
48					scrollwheel: !1,
49					styles: [{
50						featureType: 'poi',
51						stylers: [{
52							visibility: 'off'
53						}]
54					}, {
55						featureType: 'transit',
56						elementType: 'labels.icon',
57						stylers: [{
58							visibility: 'off'
59						}]
60					}]
61				},
62				afterViewAll: function() {
63					$( 'body' ).trigger( 'wdp:map:loaded' );
64				}
65			});
66			wdp_locations = wdp_locations.map(function (location) {
67				location.icon.scaledSize = new google.maps.Size(80, 50.26);
68				location.icon.origin = new google.maps.Point(0, 0);
69				//location.icon.anchor = new google.maps.Point(0, 0);
70				location.animation = google.maps.Animation.DROP;
71				return location;
72			});
73
74			maplace.AddLocations(wdp_locations, true);
75			maplace.Load();
76			//maplace.ViewOnMap(1);
77		},
78		FocusMarkerOnMap: function () {
79			if (WDP.isMobile()){
80				return;
81			}
82			var post_id = $(this).data('postid');
83			if (post_id === undefined) {
84				return;
85			}
86			var index = _.findLastIndex(window.maplace.markers, {
87				listing_id: post_id
88			});
89			window.maplace.ViewOnMap(index + 1);
90
91		},
92		visibleFilter: function () {
93			$('.wdp-listing-filter *').css('visibility', 'visible');
94		},
95		filterbarCollapse: function () {
96			$('.wdp-listing-form').collapse('toggle');
97		},
98		handleClaimForm: function (e) {
99			$('#claim-listing-btn').attr('disabled', 'disabled');
100
101			if ( ! $(this).hasClass('need-payment') ) {
102				return;
103			}
104
105			if ($(this).hasClass('need-payment')) {
106				e.preventDefault();
107			}
108			var $form = $(this);
109			// var $reason = $form.find('input#contact_reason');
110
111			// if ($reason !== 'claim_listing') {
112			// 	$form.removeClass('need-payment');
113			// 	$form.submit();
114			// 	return;
115			// }
116
117
118			var $token = $form.find('input.stripe_token');
119			var amount = parseFloat( window.wdp_checkout_params.amount );
120			$form.append("<input type='hidden' class='amount' name='amount' value='" + amount + "'/>");
121
122			if ( amount <= 0 ) {
123				$form.removeClass('need-payment');
124				$form.find('input.stripe_token').remove();
125				$form.submit();
126			}
127
128			if ( ! $token.val() && amount > 0 ) {
129				e.preventDefault();
130				StripeCheckout.open({
131					key: window.wdp_checkout_params.key,
132					billingAddress: false,
133					name: window.wdp_checkout_params.name,
134					amount: amount,
135					panelLabel: window.wdp_checkout_params.label,
136					currency: 'usd',
137					email: $form.find('#email').val(),
138					token: function (res) {
139						$form.removeClass('need-payment');
140						$form.find('input.stripe_token').remove();
141						$form.append("<input type='hidden' class='stripe_token' name='stripe_token' value='" + res.id + "'/>");
142						$form.submit();
143
144					}
145				});
146			}
147
148
149			// if ( $token.val()  ){
150			//     console.log('have value');
151			//     $form.submit();
152			// }
153			// console.log($token.val());
154			// e.preventDefault();
155			//
156			// return false;
157
158		},
159		userLocationHandler: function () {
160			var button = $(this);
161			var ip = $(this).data('ip') || null;
162			if (!ip) {
163				alert('Automatic location detect failed. Please try inputting your location');
164				return false;
165			}
166
167			wp.ajax.send('wdp_get_client_data', {
168				data: {ip: ip},
169				success: function (data) {
170					if (!data.city || !data.lat || !data.lon) {
171						alert('Automatic location detect failed. Please try inputting your location');
172						return false;
173					}
174					$('.wdp-order_by').val('distance');
175					$('.wdp-lat').val(data.lat);
176					$('.wdp-lon').val(data.lon);
177					button.closest('form').submit();
178				},
179				error: function () {
180					alert('Automatic location detect failed. Please try inputting your location');
181				}
182			});
183
184		},
185
186		initDropdownMenu: function ($selector) {
187			$($selector).on('click', function () {
188				$('.header-dropdown').slideToggle('animate');
189				return false;
190			});
191			$('body, html').on('click', function () {
192				$('.header-dropdown').slideUp('animate');
193			});
194		}
195	};
196	$(document).ready(WDP.init);
197	$(document).ready(WDP.initPlugins);
198	$(document).ready(WDP.initMap);
199	$(document).ready(WDP.visibleFilter);
200})(jQuery, window, window.wp, document, undefined);

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.