Please enter your username or email address. You will receive a link to create a new password via email.
(function(){
// Only run on the listing/search screens
var where = (location.pathname + ' ' + document.body.className).toLowerCase();
if (!/search-results|half-map|map-listings| search /.test(where)) return;
function qs(s, r){ return (r||document).querySelector(s); }
function toYMD(v){
if(!v) return '';
v=(''+v).trim();
if (/^\d{4}-\d{2}-\d{2}$/.test(v)) return v;
if (/^\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}$/.test(v)) {
var p=v.split(/[\/\-]/), m=('0'+p[0]).slice(-2), d=('0'+p[1]).slice(-2), y=p[2];
y = (y.length===2 ? '20'+y : y);
return y+'-'+m+'-'+d;
}
var d=new Date(v); if(!isNaN(d)) return d.toISOString().slice(0,10);
return '';
}
function todayYMD(){
var d=new Date();
return d.getFullYear()+'-'+('0'+(d.getMonth()+1)).slice(-2)+'-'+('0'+d.getDate()).slice(-2);
}
// Build a **clean** base URL (no old query params, no stray ?paged)
var basePath = /search-results|half-map|map-listings/.test(location.pathname)
? location.pathname.replace(/\/?$/,'/') // ensure trailing slash
: '/search-results/';
var BASE = location.origin + basePath;
function navigateWithDate(ymd){
var url = BASE + (ymd ? ('?auction_date='+encodeURIComponent(ymd)) : '');
location.assign(url);
}
var form = qs('.search-panel form, form.houzez-adv-search, form.advanced-search') || qs('.search-panel') || document;
var vis = qs('input[placeholder*="Auction Search Date"], input[name="auction_search_date"], input[name="auction_date"], input[type="date"]', form);
var btn = qs('.search-panel .btn-search, .search-panel [type="submit"], .advanced-search [type="submit"], .houzez-advanced-search [type="submit"]', form);
if(!vis || !btn) return;
// Default the UI to today if no ?auction_date in the URL
var hadParam=false, urlDate='';
try { urlDate = new URL(location.href).searchParams.get('auction_date')||''; hadParam = !!urlDate; } catch(e){}
var init = urlDate || todayYMD();
if (vis.type==='date') vis.value = init;
else { try { vis.value = new Date(init).toLocaleDateString(); } catch(e){ vis.value = init; } }
// Intercept Search button -> go to clean URL with only ?auction_date
if(!btn.dataset.iflBound){
btn.dataset.iflBound='1';
btn.addEventListener('click', function(ev){
try{ ev.preventDefault(); ev.stopPropagation(); }catch(e){}
var ymd = toYMD(vis.value) || todayYMD();
navigateWithDate(ymd);
}, true);
}
// Enter in the date box does the same
if(!vis.dataset.iflBound){
vis.dataset.iflBound='1';
vis.addEventListener('keydown', function(ev){
if(ev.key==='Enter'){
try{ ev.preventDefault(); ev.stopPropagation(); }catch(e){}
var ymd = toYMD(vis.value) || todayYMD();
navigateWithDate(ymd);
}
}, true);
vis.addEventListener('change', function(){
var ymd = toYMD(vis.value);
if(ymd) history.replaceState(null,'', BASE + '?auction_date='+encodeURIComponent(ymd));
});
}
// Keep the calendar above the map UI
if(!document.getElementById('ifl-calendar-zfix')){
var style=document.createElement('style'); style.id='ifl-calendar-zfix';
style.textContent='.flatpickr-calendar,.bootstrap-datetimepicker-widget{z-index:999999!important}';
document.head.appendChild(style);
}
})();