PageSourceSearch

https://mountaincabinsutah.com/wp-content/plugins/homerunner-toolk…viewport-fit-refilter-guard.js?ver=3.309.18

js mountaincabinsutah.com collected 2026-10-10 02:01:43 UTC 1,714 bytes, 45 lines download raw bytes

1/**
2 * Map Viewport Fit — refilter guard.
3 *
4 * Map Viewport Fit resizes the map container as the page scrolls, and
5 * Leaflet's invalidateSize fires moveend whenever the size change shifts the
6 * container's center (pan:false only skips the compensating pan, not the
7 * event). With "Search as I move the map" armed, the plugin re-runs the
8 * search on every moveend — so merely scrolling the page refiltered the
9 * cards (and, before the sizer's loading freeze, looped the skeleton
10 * flicker).
11 *
12 * This wrapper sits in the explorer dependency chain (explorer-map -> this
13 * -> explorer) and drops onMapPositionChange notifications that arrive
14 * within a short window of the sizer's own invalidateSize (stamped on
15 * window.hrtkMvfResizeStamp). A real drag or zoom never coincides with a
16 * scroll-driven resize, so genuine search-as-move behaviour is untouched.
17 *
18 * Window: the plugin delays the notification ~300ms (its moveend debounce);
19 * 1000ms covers that plus timer jitter, and continuous scrolling re-stamps
20 * continuously.
21 */
22(function ($) {
23	'use strict';
24
25	var WINDOW_MS = 1000;
26
27	var original = $.fn.homelocalExplorerMap;
28	if ( ! original ) {
29		return;
30	}
31
32	$.fn.homelocalExplorerMap = function ( options, explorerSettings ) {
33		if ( options && 'function' === typeof options.onMapPositionChange ) {
34			var notify = options.onMapPositionChange;
35			options.onMapPositionChange = function () {
36				var stamp = window.hrtkMvfResizeStamp || 0;
37				if ( stamp && Date.now() - stamp < WINDOW_MS ) {
38					return; // resize-sourced, not a user map move
39				}
40				return notify.apply( this, arguments );
41			};
42		}
43		return original.call( this, options, explorerSettings );
44	};
45})( window.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.