PageSourceSearch

https://jakeresnicow.com/wp-content/plugins/jet-engine/includes/mo…/assets/js/public/map-sync.js?ver=3.7.4

js jakeresnicow.com collected 2026-10-08 19:42:44 UTC 2,484 bytes, 102 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				this.$container = $container;
21
22				const mapId = $container.data( 'query-id' );
23				
24				if ( mapId && mapId !== 'default' ) {
25					//left .elementor-widget-container to ensure backward compatibility
26					this.mapSelector = `#${mapId} > .jet-map-listing, #${mapId} > .elementor-widget-container > .jet-map-listing`;
27				}
28
29				document.addEventListener( 'jet-engine/maps/update-sync-bounds', this.updateBounds.bind( this ) );
30
31				document.addEventListener( 'jet-engine/maps/init-sync-bounds', this.saveDefaults.bind( this ) );
32			}
33
34			updateBounds( e ) {
35				if ( e.detail.div !== document.querySelector( this.mapSelector ) ) {
36					return;
37				}
38
39				if ( ! this.mapDefaults ) {
40					this.saveDefaults( e );
41				}
42
43				this.mapDefaults.map.jetPlugins.autoCenterBlock = true;
44
45				let prevValue = this.dataValue || {};
46				
47				this.dataValue = e.detail.bounds;
48
49				if ( JSON.stringify( prevValue ) === JSON.stringify( this.dataValue ) ) {
50					this.mapDefaults.map.jetPlugins.autoCenterBlock = false;
51				}
52
53				this.wasChanged ? this.wasChanged() : this.wasСhanged();
54			}
55
56			saveDefaults( e ) {
57				if ( this.mapDefaults !== null || e.detail.div !== document.querySelector( this.mapSelector ) ) {
58					return;
59				}
60
61				this.mapDefaults = e.detail;
62
63				const map = this.mapDefaults.map;
64
65				this.mapDefaults.center = map.getCenter();
66				this.mapDefaults.zoom   = map.getZoom();
67			}
68
69			reset() {
70				super.reset();
71
72				if ( this.mapDefaults ) {
73					this.mapDefaults.map.jetPlugins.autoCenterBlock = false;
74				}
75
76				// if ( this.mapDefaults === null ) {
77				// 	return;
78				// }
79
80				// this.mapDefaults.mapProvider.panTo(
81				// 	{
82				// 		map: this.mapDefaults.map,
83				// 		position: this.mapDefaults.center,
84				// 		zoom: this.mapDefaults.zoom
85				// 	},
86				// 	true
87				// );
88			}
89
90			processData() {
91				return;
92			}
93
94		};
95
96	}
97
98	document.addEventListener( 'DOMContentLoaded', ( e ) => {
99		initMapSyncFilter();
100	});
101
102}( 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.