|
|
|
|
|
// Choose language confirmation button
|
|
|
document.querySelectorAll('#confirm_btn').forEach((confirm_btn) => {
|
|
|
confirm_btn.addEventListener('click', (e) => {
|
|
|
window.location.href = '/' + document.getElementById('language_select').value
|
|
|
})
|
|
|
})
|
|
|
|
|
|
// Copy link to clipboard
|
|
|
document.querySelectorAll('[data-share-url]').forEach((share_btn) => {
|
|
|
|
|
|
share_btn.addEventListener('click', (e) => {
|
|
|
|
|
|
navigator.clipboard.writeText(e.currentTarget.getAttribute('data-share-url'))
|
|
|
alert('URL copied to clipboard!')
|
|
|
})
|
|
|
})
|
|
|
|
|
|
|
|
|
// Open all external links in ny tab
|
|
|
for (const link of document.links) {
|
|
|
if (link.hostname.replace(/^www\./i, "") != window.location.hostname.replace(/^www\./i, "") && (link.protocol == 'https:' || link.protocol == 'http:'))
|
|
|
link.target = '_blank'
|
|
|
}
|
|
|
|