/* The news gallery: a press on a story opens it in the site's card panel. * * Taufik, 28 October 2026, on /news: "i click but not pop-up. make it pop-up". * Only the headline was a link (to the story's own page); the picture and the * rest of the card did nothing at all. Now the whole card opens the panel the * chapter pages and the front page's ring use (popup.js, filled from #newsPop, * which the server writes). Its own controls keep doing what they did: the * write-up links, the chapter links, Share, "Read more" — and the headline, * which still goes to the story's page for anyone who wants the address. */ (function () { 'use strict'; var dataEl = document.getElementById('newsPop'); if (!dataEl || !window._openCard) return; var POP = {}; try { POP = JSON.parse(dataEl.textContent); } catch (e) { return; } var css = document.createElement('style'); css.textContent = '.galcard[data-newspop]{cursor:pointer}'; document.head.appendChild(css); document.addEventListener('click', function (e) { var card = e.target.closest && e.target.closest('[data-newspop]'); if (!card) return; /* a real control inside the card does its own thing */ if (e.target.closest('a, button, summary, details, input, label, .share, [data-share]')) return; var c = POP[card.getAttribute('data-newspop')]; if (!c) return; e.preventDefault(); window._openCard(c, card); }); /* and from the keyboard: the card can be reached and opened like a button */ document.querySelectorAll('[data-newspop]').forEach(function (card) { if (!card.hasAttribute('tabindex')) card.setAttribute('tabindex', '0'); card.setAttribute('role', 'button'); card.setAttribute('aria-label', 'Open the story: ' + ((card.querySelector('h3') || {}).textContent || '').trim()); card.addEventListener('keydown', function (e) { if ((e.key === 'Enter' || e.key === ' ') && e.target === card) { e.preventDefault(); var c = POP[card.getAttribute('data-newspop')]; if (c) window._openCard(c, card); } }); }); })();