`src= { const siteUrl = TE.setting.url; //const allowedDomain = siteUrl.replace(/(^\w+:|^)\/\//, '').replace(/^www\./, ''); const thisDomain = siteUrl.replace(/(^\w+:|^)\/\//, '').replace(/^www\./, ''); const allowedDomains = [thisDomain, 'tebilisim.com', 'teimg.com']; const modal = document.getElementById("external-link"); const stayBtn = document.getElementById("stayBtn"); const continueBtn = document.getElementById("continueBtn"); let pendingUrl = ''; $(document).on('click', '.article-text a', function (e) { const url = new URL(this.href); const linkHostname = url.hostname.replace(/^www\./, ''); const isAllowedDomain = allowedDomains.some(domain => { return linkHostname === domain || linkHostname.endsWith(`.${domain}`); }) //if (linkHostname !== allowedDomain) { if (!isAllowedDomain) { e.preventDefault(); pendingUrl = this.href; document.querySelector('.external-url').innerHTML = this.href; var myModal = new bootstrap.Modal(document.getElementById('external-link')); myModal.show(); } }); stayBtn.addEventListener('click', () => { }); continueBtn.addEventListener('click', () => { modal.style.display = "none"; $('.modal-backdrop').remove(); window.open(pendingUrl, '_blank'); }); });