💄 Add extend URL display style.

This commit is contained in:
凡梦星尘 2022-06-19 14:53:12 +08:00
parent 00c93d2fb7
commit f155ded3e0
6 changed files with 13 additions and 21 deletions

View File

@ -9,7 +9,6 @@ if (!window.NexT) window.NexT = {};
"scheme" : "{{ .Site.Params.scheme }}",
"darkmode" : {{ .Site.Params.darkmode }},
"version" : "{{ .Site.Data.config.version }}",
"exturl" : {{ .Site.Params.exturl }},
"sidebar" : {{ .Site.Params.sidebar | jsonify }},
"copycode" : {{ .Site.Params.codeblock.copyBtn | jsonify }},
"bookmark" : {{ .Site.Params.bookmark | jsonify }},

View File

@ -37,7 +37,7 @@ NexT.boot.refresh = function() {
* Register JS handlers by condition option.
* Need to add config option in Front-End at 'scripts/helpers/next-config.js' file.
*/
CONFIG.prism && window.Prism.highlightAll();
//CONFIG.prism && window.Prism.highlightAll();
/*CONFIG.mediumzoom && window.mediumZoom('.post-body :not(a) > img, .post-body > img', {
background: 'var(--content-bg-color)'
});*/

View File

@ -23,22 +23,6 @@ HTMLElement.prototype.wrap = function(wrapper) {
NexT.utils = {
registerExtURL: function() {
document.querySelectorAll('span.exturl').forEach(element => {
const link = document.createElement('a');
// https://stackoverflow.com/questions/30106476/using-javascripts-atob-to-decode-base64-doesnt-properly-decode-utf-8-strings
link.href = decodeURIComponent(atob(element.dataset.url).split('').map(c => {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
}).join(''));
link.rel = 'noopener external nofollow noreferrer';
link.target = '_blank';
link.className = element.className;
link.title = element.title;
link.innerHTML = element.innerHTML;
element.parentNode.replaceChild(link, element);
});
},
/**
* One-click copy code support.
*/

View File

@ -608,9 +608,11 @@ params:
index_with_subtitle: false
# Automatically add external URL with Base64 encrypt & decrypt.
exturl: false
exturl:
enable: true
icon: true
# If true, an icon will be attached to each external URL
exturl_icon: true
#exturl_icon: true
# Google Webmaster tools verification.
# See: https://developers.google.com/search

View File

@ -17,6 +17,6 @@ Documentation: https://hugo-next.js.org
EOT
}
next V0.0.1
next `cat ../VERSION`
hugo server -D -t ../.. --port 1414 --panicOnWarning

View File

@ -0,0 +1,7 @@
{{- $extURL := .Page.Site.Params.exturl.enable }}
<a href="{{ .Destination | safeURL }}" title="{{ .Text }}" {{ if strings.HasPrefix .Destination "http" }}rel="noopener external nofollow noreferrer" target="_blank"{{ end }} {{ if $extURL }}class=" exturl"{{ end }}>
{{ .Text | safeHTML }}
{{- if and $extURL .Page.Site.Params.exturl.icon }}
<i class="fa fa-external-link-alt"></i>
{{- end }}
</a>