Open CNN
(function(){
document.addEventListener(‘click’, async function(e){
const a = e.target.closest(‘a.copy-open’);
if(!a) return;
e.preventDefault();
const text = a.getAttribute(‘data-copy’) || ”;
try {
if (text) {
if (navigator.clipboard && window.isSecureContext) {
await navigator.clipboard.writeText(text);
} else {
const i = document.createElement(‘input’);
i.value = text;
i.setAttribute(‘readonly’,”);
i.style.position=’absolute’;
i.style.left=’-9999px’;
document.body.appendChild(i);
i.select();
document.execCommand(‘copy’);
document.body.removeChild(i);
}
}
} catch(_) { /* ignore copy errors, still open */ }
window.open(a.href, ‘_blank’, ‘noopener’);
});
})();
