fix external links

This commit is contained in:
samaradel
2023-08-20 14:28:24 +03:00
parent 5f20d705cf
commit dfdcc8a4fc
6 changed files with 58 additions and 100 deletions

View File

@@ -114,10 +114,24 @@ window.onload = function () {
});
})
var links = document.links;
var internal_hosts = [
'www.ourworld.tf',
'ourworld.tf',
'www2.ourworld.tf',
'localhost',
'127.0.0.1'
]
for (var i = 0, linksLength = links.length; i < linksLength; i++) {
if (!internal_hosts.includes(links[i].hostname)) {
links[i].target = '_blank';
}
}
document.getElementById("filter-btn").addEventListener('click', toggleFilter);
document.getElementById("mobile-learn-btn").addEventListener('click', toggleMenu);
}
function openInNewTab(url) {
window.open(url, '_blank').focus()
}
}