From 0a30bdc024931e18ccf282845c1631881e53a90f Mon Sep 17 00:00:00 2001 From: ILikePlayingGames <22475143+ILikePlayingGames@users.noreply.github.com> Date: Fri, 22 Dec 2023 03:03:40 -0500 Subject: Separate mod lists by Minecraft version and open external links in new tab --- docs/js/open-in-new-tab.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 docs/js/open-in-new-tab.js (limited to 'docs/js') diff --git a/docs/js/open-in-new-tab.js b/docs/js/open-in-new-tab.js new file mode 100644 index 0000000..643cf51 --- /dev/null +++ b/docs/js/open-in-new-tab.js @@ -0,0 +1,19 @@ +(function (){ + const IGNORED_PATHS = [] + + for (const ignoredPath of IGNORED_PATHS) { + if (window.location.pathname.match(`(\/${ignoredPath}[\/?].*)`)) { + return; + } + } + + let links = document.getElementsByTagName("a"); + + for (const link of links) { + if (link.hostname !== window.location.hostname) { + link.target = "_blank"; + } + } + + console.debug(`[Open in New Tab] Changed external links to open in new tab.`); +})(); \ No newline at end of file -- cgit