/**
* CHM Fix - Gravity Slider Fields value sync (added 2026-10-27)
* Problem: Gravity Slider Fields v2.1 writes the slider value with jQuery .attr('value'),
* which only changes the HTML attribute. Gravity Forms' currency formatting sets the
* input's live .value property, so after that the attribute no longer controls what is
* submitted. Result since ~Oct 20: currency sliders submitted their default
* ($70,000 purchase price, $0.00 income/assets).
* Fix: also write the live .value property on every slider update.
* Rollback: deactivate this item.
*/
(function ($) {
if (!$) { return; }
function chmPatchSliders() {
$('.ginput_container_slider .slider-display').each(function () {
var s = this;
if (!s.noUiSlider || s._chmSyncPatched) { return; }
var inp = $(s).closest('.ginput_container_slider').find('input.slider')[0];
if (!inp) { return; }
s._chmSyncPatched = true;
s.noUiSlider.on('update.chmfix', function (values, handle) {
inp.value = values[handle];
});
});
}
function later() { setTimeout(chmPatchSliders, 0); setTimeout(chmPatchSliders, 500); }
$(later);
$(document).on('gform_post_render gform_page_loaded', later);
$(document).on('submit', 'form[id^="gform_"]', chmPatchSliders);
})(window.jQuery);
(function() {
// Global page view and session tracking for UAEL Modal Popup feature
try {
// Session tracking: increment if this is a new session
// Check if any popup on this page uses current page tracking
var hasCurrentPageTracking = false;
var currentPagePopups = [];
// Check all modal popups on this page for current page tracking
if (typeof jQuery !== 'undefined') {
jQuery('.uael-modal-parent-wrapper').each(function() {
var scope = jQuery(this).data('page-views-scope');
var enabled = jQuery(this).data('page-views-enabled');
var popupId = jQuery(this).attr('id').replace('-overlay', '');
if (enabled === 'yes' && scope === 'current') {
hasCurrentPageTracking = true;
currentPagePopups.push(popupId);
}
});
}
// Global tracking: ALWAYS increment if ANY popup on the site uses global tracking
// Current page tracking: increment per-page counters
if (hasCurrentPageTracking && currentPagePopups.length > 0) {
var currentUrl = window.location.href;
var urlKey = 'uael_page_views_' + btoa(currentUrl).replace(/[^a-zA-Z0-9]/g, '').substring(0, 50);
var currentPageViews = parseInt(localStorage.getItem(urlKey) || '0');
currentPageViews++;
localStorage.setItem(urlKey, currentPageViews.toString());
// Store URL mapping for each popup
for (var i = 0; i < currentPagePopups.length; i++) {
var popupUrlKey = 'uael_popup_' + currentPagePopups[i] + '_url_key';
localStorage.setItem(popupUrlKey, urlKey);
}
}
} catch (e) {
// Silently fail if localStorage is not available
}
})();