From 8898dca50e2f9ba7c6e7e4bfd3df838668ef5eab Mon Sep 17 00:00:00 2001 From: Flook Peter Date: Fri, 14 Jul 2023 12:31:17 +0800 Subject: [PATCH] Links open in new tab --- mkdocs.yml | 1 + site/404.html | 4 +++ site/advanced/advanced/index.html | 4 +++ site/connections/connections/index.html | 4 +++ site/generators/generators/index.html | 4 +++ site/get-started/docker/index.html | 4 +++ site/index.html | 4 +++ site/js/open_in_new_tab.js | 33 ++++++++++++++++++++++++ site/sample/index.html | 4 +++ site/sitemap.xml.gz | Bin 127 -> 127 bytes 10 files changed, 62 insertions(+) create mode 100644 site/js/open_in_new_tab.js diff --git a/mkdocs.yml b/mkdocs.yml index 4066a579..82e66391 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -23,4 +23,5 @@ markdown_extensions: custom_checkbox: true plugins: - search + - open-in-new-tab diff --git a/site/404.html b/site/404.html index 04335aa1..dbc995b1 100644 --- a/site/404.html +++ b/site/404.html @@ -415,6 +415,10 @@

404 - Not found

+ + + + \ No newline at end of file diff --git a/site/advanced/advanced/index.html b/site/advanced/advanced/index.html index 05aefe5d..a7f00e64 100644 --- a/site/advanced/advanced/index.html +++ b/site/advanced/advanced/index.html @@ -593,6 +593,10 @@

Generating JSON data

+ + + + \ No newline at end of file diff --git a/site/connections/connections/index.html b/site/connections/connections/index.html index 25f58e36..90d54453 100644 --- a/site/connections/connections/index.html +++ b/site/connections/connections/index.html @@ -941,6 +941,10 @@

HTTP

+ + + + \ No newline at end of file diff --git a/site/generators/generators/index.html b/site/generators/generators/index.html index a7677257..7b9e60e7 100644 --- a/site/generators/generators/index.html +++ b/site/generators/generators/index.html @@ -1046,6 +1046,10 @@

List

+ + + + \ No newline at end of file diff --git a/site/get-started/docker/index.html b/site/get-started/docker/index.html index 3861ad83..06044402 100644 --- a/site/get-started/docker/index.html +++ b/site/get-started/docker/index.html @@ -605,6 +605,10 @@

Helm

+ + + + \ No newline at end of file diff --git a/site/index.html b/site/index.html index f351a735..e5e63248 100644 --- a/site/index.html +++ b/site/index.html @@ -453,6 +453,10 @@

Home

+ + + + \ No newline at end of file diff --git a/site/js/open_in_new_tab.js b/site/js/open_in_new_tab.js new file mode 100644 index 00000000..e2c10317 --- /dev/null +++ b/site/js/open_in_new_tab.js @@ -0,0 +1,33 @@ +// Description: Open external links in a new tab and PDF links in a new tab +// Source: https://jekyllcodex.org/without-plugin/new-window-fix/ + +//open external links in a new window +function external_new_window() { + for(var c = document.getElementsByTagName("a"), a = 0;a < c.length;a++) { + var b = c[a]; + if(b.getAttribute("href") && b.hostname !== location.hostname) { + b.target = "_blank"; + b.rel = "noopener"; + } + } +} +//open PDF links in a new window +function pdf_new_window () +{ + if (!document.getElementsByTagName) return false; + var links = document.getElementsByTagName("a"); + for (var eleLink=0; eleLink < links.length; eleLink ++) { + if ((links[eleLink].href.indexOf('.pdf') !== -1)||(links[eleLink].href.indexOf('.doc') !== -1)||(links[eleLink].href.indexOf('.docx') !== -1)) { + links[eleLink].onclick = + function() { + window.open(this.href); + return false; + } + } + } +} + +window.addEventListener("DOMContentLoaded", function() { + external_new_window(); + pdf_new_window(); +}); \ No newline at end of file diff --git a/site/sample/index.html b/site/sample/index.html index 14e935ca..7cfa4149 100644 --- a/site/sample/index.html +++ b/site/sample/index.html @@ -610,6 +610,10 @@

Configuration

+ + + + \ No newline at end of file diff --git a/site/sitemap.xml.gz b/site/sitemap.xml.gz index eeb6518e6af34a79fec75ba1e865b2976b76e73c..870a9817faae0faca4638bacab4568941978712a 100644 GIT binary patch delta 12 Tcmb=gXOr*d;AlNRk*yK{8I=Sh delta 12 Tcmb=gXOr*d;5c}0B3mT@8odNw