(function() {
var p = new URLSearchParams(window.location.search);
var id = p.get('news');
if (id === null) return;
var n = parseInt(id, 10);
var iframe = document.querySelector('iframe');
if (!iframe) return;
iframe.addEventListener('load', function() {
iframe.contentWindow.postMessage({ type: 'terrae-news', id: n }, '*');
});
// Anche dopo un ritardo, nel caso l'iframe fosse già caricato
setTimeout(function() {
if (iframe.contentWindow) {
iframe.contentWindow.postMessage({ type: 'terrae-news', id: n }, '*');
}
}, 1500);
})();