Skip to content

Commit

Permalink
Updated makeLinksExternal in the miscellaneous.js file, to make also …
Browse files Browse the repository at this point in the history
…external links on cards open in a new tab, but without adding the external link icon.
  • Loading branch information
atteggiani committed Sep 19, 2024
1 parent 004fb22 commit 095c248
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions docs/js/miscellaneous.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,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');
});
}


Expand Down

0 comments on commit 095c248

Please sign in to comment.