From 8ff6b0ba11014a800380e9ee7fb2dfb8798e5a5d Mon Sep 17 00:00:00 2001 From: Davide Marchegiani Date: Mon, 9 Sep 2024 15:45:56 +1000 Subject: [PATCH] Updated makeLinksExternal in the miscellaneous.js file, to make also external links on cards open in a new tab, but without adding the external link icon. --- docs/js/miscellaneous.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/js/miscellaneous.js b/docs/js/miscellaneous.js index 62ee6b3d9..ab2fbb938 100644 --- a/docs/js/miscellaneous.js +++ b/docs/js/miscellaneous.js @@ -136,11 +136,16 @@ function tabFunctionality() { target="_blank" attribute, and add an external-link icon to them. */ function makeLinksExternal() { - let extLinks = document.querySelectorAll("article a[href^='http']:not([href^='https://access-hive.org.au']):not(:is(.vertical-card,.horizontal-card,.text-card))"); - extLinks.forEach(link => { - link.classList.add('external-link'); - link.setAttribute('target','_blank'); - }) + // Links to be opened in a new tab + document.querySelectorAll("a[href^='http']:not([href^='https://access-hive.org.au'])") + .forEach(link => { + link.setAttribute('target','_blank'); + }); + // Add external link icon only to some external links + document.querySelectorAll("article a[href^='http']:not([href^='https://access-hive.org.au']):not(:is(.vertical-card,.horizontal-card,.text-card))") + .forEach(link => { + link.classList.add('external-link'); + }); }