From 880c35f9d1291cc73ed13ebcf339b650d3ceeac8 Mon Sep 17 00:00:00 2001 From: Septs Date: Fri, 24 Dec 2021 16:48:10 +0800 Subject: [PATCH] refactor: use base64 encode protect email address --- assets/customize.js | 5 +++++ assets/customize.scss | 3 +-- config/_default/config.toml | 3 +++ layouts/_default/_markup/render-link.html | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 assets/customize.js diff --git a/assets/customize.js b/assets/customize.js new file mode 100644 index 00000000..9bb36bf5 --- /dev/null +++ b/assets/customize.js @@ -0,0 +1,5 @@ +document.querySelectorAll('a[data-href]').forEach((element) => { + element.href = atob(element.dataset.href); + delete element.dataset.href; +}) + diff --git a/assets/customize.scss b/assets/customize.scss index 0ecfe416..b62f34f4 100644 --- a/assets/customize.scss +++ b/assets/customize.scss @@ -5,8 +5,7 @@ img.shields-icon { a.github-profile { color: inherit; - cursor: pointer; - text-decoration: none; + text-decoration: none !important; display: inline-block; vertical-align: middle; img { diff --git a/config/_default/config.toml b/config/_default/config.toml index a8af59dd..f38d6a5d 100644 --- a/config/_default/config.toml +++ b/config/_default/config.toml @@ -22,6 +22,9 @@ hostName = "https://mtf.wiki" custom_css = [ "customize.scss" ] +custom_js = [ + "customize.js" +] [markup] [markup.goldmark] diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html index 56e52c31..4cbdb35d 100644 --- a/layouts/_default/_markup/render-link.html +++ b/layouts/_default/_markup/render-link.html @@ -1,6 +1,6 @@ {{- if hasPrefix .Destination "mailto:" -}} {{- $badge := replace (replace .Text "-" "--") "_" "__" -}} - + {{- else -}} {{- .Text | safeHTML -}}