aboutsummaryrefslogtreecommitdiff
path: root/docs/js
diff options
context:
space:
mode:
Diffstat (limited to 'docs/js')
-rw-r--r--docs/js/open-in-new-tab.js19
1 files changed, 19 insertions, 0 deletions
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