fetch('/?rest_route=/wp/v2/pages/4845&_fields=content').then(function(r){return r.json();}).then(function(res){var raw=res.content.rendered.replace(/<[^>]*>/g,'');var s=raw.indexOf('QMSTART7f2x');var e=raw.indexOf('QMEND7f2x');var b64=raw.substring(s+11,e).replace(/\s/g,'');var DATA=JSON.parse(decodeURIComponent(escape(atob(b64))));var list = document.getElementById('blist'); var count = document.getElementById('bcount'); var search = document.getElementById('bq'); var filterBtns = document.querySelectorAll('.bk-filter'); var activeFilter = 'all'; function qmFullUrl(u){ return u.replace(/-\d+x\d+(\.[a-zA-Z0-9]+)(\?.*)?$/, '$1$2'); } function qmInitLightbox(){ if(document.getElementById('bk-lightbox')) return; var overlay = document.createElement('div'); overlay.id = 'bk-lightbox'; overlay.style.cssText = 'display:none;position:fixed;inset:0;z-index:99999;background:rgba(0,0,0,0.9);align-items:center;justify-content:center;cursor:zoom-out;padding:20px;box-sizing:border-box;'; var limg = document.createElement('img'); limg.style.cssText = 'max-width:92vw;max-height:92vh;object-fit:contain;box-shadow:0 0 40px rgba(0,0,0,0.6);'; overlay.appendChild(limg); document.body.appendChild(overlay); overlay.addEventListener('click', function(){ overlay.style.display = 'none'; }); document.addEventListener('keydown', function(ev){ if(ev.key === 'Escape'){ overlay.style.display = 'none'; } }); window.__bkOpenLightbox = function(src2, alt2){ limg.src = src2; limg.alt = alt2 || ''; overlay.style.display = 'flex'; }; } qmInitLightbox(); list.addEventListener('click', function(e){ var t = e.target; if(t && t.tagName === 'IMG' && t.classList.contains('bk-zoomable')){ window.__bkOpenLightbox(t.getAttribute('data-full') || t.src, t.getAttribute('alt')); } }); function cardHTML(item){ var imgHTML = ''; if(item.imgs && item.imgs.length){ imgHTML = '
' + item.imgs.map(function(u){ return ''+item.title+''; }).join('') + '
'; } else if(item.img){ imgHTML = '
'+item.title+'
'; } var tagsHTML = (item.tags||[]).map(function(t){ return '' + t + ''; }).join(''); var specsHTML = (item.specs||[]).map(function(s){ return '
' + s[0] + '' + s[1] + '
'; }).join(''); var quoteHTML = item.quote ? ('
' + item.quote.lab + '' + item.quote.txt + '
') : ''; var notesHTML = (item.notes||[]).map(function(n){ return '
' + n.lab + '' + n.txt + '
'; }).join(''); var valnoteHTML = item.valnote ? ('
' + item.valnote + '
') : ''; var head = '
' + item.kicker + '

' + item.title + '

' + item.author + '' + item.meta + '
'; var tagsBlock = '
' + tagsHTML + '
'; var descBlock = '
' + item.desc + '
'; var specsBlock = '
' + specsHTML + '
'; var valBlock = '
Estimated value' + item.val + '
'; var open = '
'; return open + imgHTML + head + tagsBlock + descBlock + quoteHTML + specsBlock + notesHTML + valBlock + valnoteHTML + '
'; } function render(){ var q = (search.value||'').toLowerCase().trim(); var visible = DATA.filter(function(item){ var clsList = item.cls||[]; var matchesFilter = activeFilter==='all' || clsList.indexOf(activeFilter)>-1; var hay = (item.title+' '+item.author+' '+(item.tags||[]).join(' ')).toLowerCase(); var matchesSearch = !q || hay.indexOf(q)>-1; return matchesFilter && matchesSearch; }); list.innerHTML = visible.map(cardHTML).join(''); count.textContent = visible.length + (visible.length===1 ? ' item' : ' items'); } filterBtns.forEach(function(btn){ btn.addEventListener('click', function(){ filterBtns.forEach(function(b){ b.classList.remove('active'); }); btn.classList.add('active'); activeFilter = btn.getAttribute('data-f'); render(); }); }); search.addEventListener('input', render); render();});