Archive v7

arch + year/month filter let searchBox=document.createElement('input'); searchBox.placeholder='Search posts...'; searchBox.style.cssText='width:100%;padding:10px;margin:15px 0;border-radius:10px;border:1px solid #222;background:#111;color:#fff;font-size:16px'; box.before(searchBox); let filterWrap=document.createElement('div'); filterWrap.style.cssText='display:flex;gap:10px;margin-bottom:15px'; let yearSel=document.createElement('select'); let monthSel=document.createElement('select'); [yearSel,monthSel].forEach(s=>{s.style.cssText='flex:1;padding:10px;border-radius:10px;border:1px solid #222;background:#111;color:#fff'}); yearSel.innerHTML=''; monthSel.innerHTML=''; filterWrap.append(yearSel,monthSel); box.before(filterWrap); let allPosts=[]; function render(list){box.innerHTML='';let groups={};list.forEach(p=>{let y=p.date.getFullYear();if(!groups[y])groups[y]=[];groups[y].push(p);});Object.keys(groups).sort((a,b)=>b-a).forEach(y=>{box.innerHTML+=`
${y}
`;groups[y].forEach(p=>{box.innerHTML+=`
${p.title}
${p.date.toDateString()}
`;});});} fetch('/feeds/posts/summary?alt=json&max-results=500').then(r=>r.json()).then(d=>{ let posts=d.feed.entry||[]; allPosts=posts.map(p=>({title:p.title.$t,link:p.link.find(l=>l.rel==='alternate').href,date:new Date(p.published.$t),thumb:(p.media$thumbnail?p.media$thumbnail.url.replace(/s72/,'s200'):'https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-placeholder=s200')})); let years=[...new Set(allPosts.map(p=>p.date.getFullYear()))].sort((a,b)=>b-a); yearSel.innerHTML=''+years.map(y=>``).join(''); render(allPosts); }); function applyFilters(){let text=searchBox.value.toLowerCase();let ys=yearSel.value;let ms=monthSel.value;let f=allPosts.filter(p=>(p.title.toLowerCase().includes(text))&&(ys==='all'||p.date.getFullYear()==ys)&&(ms==='all'||p.date.getMonth()==ms));render(f);}searchBox.oninput=applyFilters;yearSel.onchange=()=>{if(yearSel.value==='all'){monthSel.innerHTML='';}else{monthSel.innerHTML=''+[...Array(12)].map((_,i)=>``).join('');}applyFilters();};monthSel.onchange=applyFilt