[object Object]

← back to Rentv Website

auto-save: 2026-08-01T02:32:45 (1 files) — public/index.html

de1e3db3e79d26af0c43efb965664585f6d3bca2 · 2026-08-01 02:32:45 -0700 · Steve Abrams

Files touched

Diff

commit de1e3db3e79d26af0c43efb965664585f6d3bca2
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Sat Aug 1 02:32:45 2026 -0700

    auto-save: 2026-08-01T02:32:45 (1 files) — public/index.html
---
 public/index.html | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/public/index.html b/public/index.html
index 4d1d74d..0163aeb 100644
--- a/public/index.html
+++ b/public/index.html
@@ -135,13 +135,17 @@
 <script>
 document.getElementById('today').textContent = new Date().toLocaleDateString(undefined,{weekday:'long',year:'numeric',month:'long',day:'numeric'});
 let ALL=[], cat='all';
+// ── href-drill: category filter is URL-addressable (shareable + deep-link + back-button) ──
+function qstr(over){ const c=(over&&'cat'in over)?over.cat:cat; return (c&&c!=='all')?('?cat='+encodeURIComponent(c)):location.pathname; }
+function readURL(){ cat=new URLSearchParams(location.search).get('cat')||'all'; }
+function writeURL(push){ history[push?'pushState':'replaceState']({},'',qstr()); }
 const esc=s=>(s||'').replace(/[&<>"]/g,c=>({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;'}[c]));
 const bgimg=o=>(o&&o.image)?(' style="background:#12161a url(\''+esc(o.image)+'\') center/cover"'):'';
 function render(){
   const items = cat==='all'?ALL:ALL.filter(x=>x.cat===cat);
   const lead=items[0];
   if(lead){document.getElementById('lead').innerHTML='<a href="/news/'+encodeURIComponent(lead.id)+'"><div class="img"'+bgimg(lead)+'></div><span class="chip">'+esc(lead.cat)+' · Western U.S.</span><h1>'+esc(lead.title)+'</h1><div class="byl">By RENTV Staff · live from rentv.com</div></a>';}
-  const cards=items.slice(1,13).map(x=>'<a class="card" href="/news/'+encodeURIComponent(x.id)+'"><div class="img"'+bgimg(x)+'></div><span class="chip">'+esc(x.cat)+'</span><h4>'+esc(x.title)+'</h4><div class="byl">RENTV Staff</div></a>').join('');
+  const cards=items.slice(1,13).map(x=>'<a class="card" href="/news/'+encodeURIComponent(x.id)+'"><div class="img"'+bgimg(x)+'></div><span class="chip drill" data-filter="cat" data-v="'+esc(x.cat)+'" title="Filter to '+esc(x.cat)+'">'+esc(x.cat)+'</span><h4>'+esc(x.title)+'</h4><div class="byl">RENTV Staff</div></a>').join('');
   document.getElementById('cards').innerHTML=cards||'<p style="color:var(--sub)">No items in this section right now.</p>';
   document.getElementById('breaking').innerHTML=ALL.slice(0,6).map(x=>'<span>'+esc(x.title)+'</span>').join(' · ').repeat(2);
   document.getElementById('mostread').innerHTML=ALL.slice(0,5).map(x=>'<li><a href="/news/'+encodeURIComponent(x.id)+'">'+esc(x.title)+'</a></li>').join('');
@@ -150,7 +154,7 @@ async function load(){
   try{
     const d=await (await fetch('/api/news')).json();
     ALL=(d.items||[]).map(x=>({...x,title:x.title}));
-    if(ALL.length){render();
+    if(ALL.length){readURL();document.querySelectorAll('#nav a[data-cat]').forEach(x=>x.classList.toggle('on',x.dataset.cat===cat));render();
       const mins=Math.max(0,Math.round((Date.now()-new Date(d.fetched_at))/60000));
       document.getElementById('freshness').textContent=mins<2?'updated just now':('updated '+mins+' min ago');
       document.getElementById('src').textContent='last pull '+new Date(d.fetched_at).toLocaleTimeString();
@@ -159,7 +163,11 @@ async function load(){
 }
 const hamBtn=document.getElementById('hamBtn');
 hamBtn.addEventListener('click',()=>{const open=document.getElementById('nav').classList.toggle('open');hamBtn.setAttribute('aria-expanded',open);});
-document.getElementById('nav').addEventListener('click',e=>{const a=e.target.closest('a');if(!a)return;document.getElementById('nav').classList.remove('open');hamBtn.setAttribute('aria-expanded','false');if(!a.dataset.cat)return;e.preventDefault();document.querySelectorAll('#nav a').forEach(x=>x.classList.remove('on'));a.classList.add('on');cat=a.dataset.cat;render();window.scrollTo({top:0,behavior:'smooth'});});
+document.getElementById('nav').addEventListener('click',e=>{const a=e.target.closest('a');if(!a)return;document.getElementById('nav').classList.remove('open');hamBtn.setAttribute('aria-expanded','false');if(!a.dataset.cat)return;e.preventDefault();document.querySelectorAll('#nav a').forEach(x=>x.classList.remove('on'));a.classList.add('on');cat=a.dataset.cat;writeURL(true);render();window.scrollTo({top:0,behavior:'smooth'});});
+// a card's category chip is an href-drill atom → filter the feed to that category + reflect into the URL (not the article link)
+document.addEventListener('click',e=>{ const d=e.target.closest('.chip.drill[data-filter="cat"]'); if(!d)return; e.preventDefault(); e.stopPropagation();
+  cat=(cat===d.dataset.v?'all':d.dataset.v); document.querySelectorAll('#nav a[data-cat]').forEach(x=>x.classList.toggle('on',x.dataset.cat===cat)); writeURL(true); render(); window.scrollTo({top:0,behavior:'smooth'}); });
+addEventListener('popstate',()=>{ readURL(); document.querySelectorAll('#nav a[data-cat]').forEach(x=>x.classList.toggle('on',x.dataset.cat===cat)); render(); });
 document.getElementById('subbtn').onclick=()=>{if((document.getElementById('email').value||'').includes('@')){document.getElementById('subok').style.display='block';}};
 async function loadTicker(){
   try{

← 3b1f8b3 LA Commercial: syndicate usrealestate commercial intel into  ·  back to Rentv Website  ·  creds-safe fetch guard: resolve relative fetch vs credential 847a42e →