document.addEventListener("DOMContentLoaded", function() { const container = document.querySelector('.live-feed'); if(!container) return; function formatUpdate(updateIndex) { const updateBlocks = container.querySelectorAll('.live-update'); updateBlocks.forEach((block, i) => { // Skip if already formatted if(block.dataset.formatted) return; block.classList.add('live-update'); block.id = 'update-' + (i+1); block.dataset.formatted = 'true'; // Add 🔗 icon if not present if(!block.querySelector('.copy-link')) { const link = document.createElement('a'); link.href = '#' + block.id; link.className = 'copy-link'; link.innerHTML = ' 🔗'; link.title = 'Copy link'; link.onclick = function(e){ e.preventDefault(); navigator.clipboard.writeText(window.location.href.split('#')[0] + '#' + block.id); alert('Link copied!'); } block.appendChild(link); } }); } // Observe for new updates const observer = new MutationObserver(() => formatUpdate()); observer.observe(container, { childList: true, subtree: true }); // Initial format formatUpdate(); });
Scroll to Top