PageSourceSearch

https://www.tetovinilico.com/wp-content/plugins/jet-engine/include…/assets/js/public/map-sync.js?ver=3.6.2

js tetovinilico.com collected 2026-10-09 22:40:09 UTC 3,709 bytes, 163 lines download raw bytes

1( function( $ ) {
2
3	"use strict";
4
5	const initMapSyncFilter = function() {
6
7		window.JetSmartFilters.filtersList.JetEngineMapSync = 'jet-smart-filters-map-sync';
8		window.JetSmartFilters.filters.JetEngineMapSync = class JetEngineMapSync extends window.JetSmartFilters.filters.BasicFilter {
9
10			name = 'map-sync';
11			mapSelector = '.jet-map-listing';
12			mapDefaults = null;
13
14			constructor( $container ) {
15				
16				const $filter = $container.find( '.jet-smart-filters-map-sync' );
17				
18				super( $container, $filter );
19				
20				const mapId = $container.data( 'query-id' );
21				
22				if ( mapId && mapId !== 'default' ) {
23					this.mapSelector = `#${mapId} > .jet-map-listing, #${mapId} > .elementor-widget-container > .jet-map-listing`;
24				}
25
26				document.addEventListener( 'jet-engine/maps/update-sync-bounds', this.updateBounds.bind( this ) );
27
28				document.addEventListener( 'jet-engine/maps/init-sync-bounds', this.saveDefaults.bind( this ) );
29			}
30
31			updateBounds( e ) {
32				if ( e.detail.div !== document.querySelector( this.mapSelector ) ) {
33					return;
34				}
35
36				if ( ! this.mapDefaults ) {
37					this.saveDefaults( e );
38				}
39
40				this.mapDefaults.map.jeFiltersAutoCenterBlock = true;
41				
42				this.dataValue = e.detail.bounds;
43				this.wasChanged ? this.wasChanged() : this.wasСhanged();
44			}
45
46			saveDefaults( e ) {
47				if ( this.mapDefaults !== null || e.detail.div !== document.querySelector( this.mapSelector ) ) {
48					return;
49				}
50
51				this.mapDefaults = e.detail;
52
53				const map = this.mapDefaults.map;
54
55				this.mapDefaults.center = map.getCenter();
56				this.mapDefaults.zoom   = map.getZoom();
57			}
58
59			reset() {
60				super.reset();
61
62				if ( this.mapDefaults ) {
63					this.mapDefaults.map.jeFiltersAutoCenterBlock = false;
64				}
65
66				// if ( this.mapDefaults === null ) {
67				// 	return;
68				// }
69
70				// this.mapDefaults.mapProvider.panTo(
71				// 	{
72				// 		map: this.mapDefaults.map,
73				// 		position: this.mapDefaults.center,
74				// 		zoom: this.mapDefaults.zoom
75				// 	},
76				// 	true
77				// );
78			}
79
80			processData() {
81				return;
82			}
83
84		};
85
86	}
87
88	const initFilterConflictHandler = function() {
89		const conflictHandler = class FilterConflictHandler {
90
91			isResolving = false;
92
93			constructor() {
94				this.init();
95			}
96
97			init( e ) {
98				JetSmartFilters.events.subscribe( 'fiter/change', ( filter ) => {
99					if ( this.isResolving ) {
100						return;
101					}
102
103					this.isResolving = true;
104
105					if ( ! [ 'map-sync', 'user-geolocation', 'location-distance' ].includes( filter?.name ) ) {
106						return;
107					}
108
109					let conflictingTypes = [];
110		
111					if ( filter.name === 'map-sync' ) {
112						conflictingTypes = [ 'user-geolocation', 'location-distance' ];
113					} else {
114						conflictingTypes = [ 'map-sync' ];
115					}
116
117					this.resetConflictingFilters( filter, conflictingTypes );
118				} );
119			}
120			
121			resetConflictingFilters( filter, conflictingTypes ) {
122				for ( const conflictingFilter of this.getFilters( filter, conflictingTypes ) ) {
123					conflictingFilter.reset();
124					conflictingFilter.dataValue = false;
125					conflictingFilter.wasChanged ? conflictingFilter.wasChanged() : conflictingFilter.wasСhanged();
126				}
127
128				this.isResolving = false;
129			}
130
131			getFilters( filter, types ) {
132				if ( ! types.length ) {
133					return [];
134				}
135
136				let filters = [];
137
138				filter.filterGroup.filters.forEach(
139					( f ) => {
140						if ( ! types.includes( f.name ) ) {
141							return;
142						}
143
144						filters.push( f );
145					}
146				);
147
148				return filters;
149			}
150
151		};
152
153		new conflictHandler();
154
155	}
156
157	document.addEventListener( 'DOMContentLoaded', ( e ) => {
158		initMapSyncFilter();
159	});
160
161	document.addEventListener( 'jet-smart-filters/inited', initFilterConflictHandler );
162
163}( 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.