💄 Update common creative post link setting.

This commit is contained in:
凡梦星尘 2022-06-20 18:54:43 +08:00
parent 26f36810c9
commit c116aa31ad
3 changed files with 20 additions and 6 deletions

View File

@ -44,14 +44,15 @@ NexT.boot.refresh = function() {
CONFIG.lazyload && window.lozad('.post-body img').observe();
CONFIG.pangu && window.pangu.spacingPage();
NexT.utils.registerCopyCode();
CONFIG.isPage && NexT.utils.replacePostCRLink();
CONFIG.isPage && NexT.utils.registerCopyCode();
NexT.utils.registerTabsTag();
/*NexT.utils.registerActiveMenuItem();
NexT.utils.registerLangSelect();*/
NexT.utils.registerSidebarTOC();
NexT.utils.registerPostReward();
NexT.utils.initCommontesDispaly();
NexT.utils.registerCommonSwitch();
CONFIG.isPage && NexT.utils.registerSidebarTOC();
CONFIG.isPage && NexT.utils.registerPostReward();
CONFIG.isPage && NexT.utils.initCommontesDispaly();
CONFIG.isPage && NexT.utils.registerCommonSwitch();
NexT.utils.wrapTableWithBox();
NexT.utils.registerVideoIframe();
};

View File

@ -23,6 +23,19 @@ HTMLElement.prototype.wrap = function(wrapper) {
NexT.utils = {
replacePostCRLink: function() {
if (CONFIG.hostname.startsWith('http')) return;
// Try to support mutli domain without base URL sets.
let href = window.location.href;
if (href.indexOf('#')>-1){
href = href.split('#')[0];
}
let postLink = document.getElementById('post-cr-link');
if (!postLink) return;
postLink.text = href;
postLink.href = href;
},
/**
* One-click copy code support.
*/

View File

@ -21,7 +21,7 @@
<a target="_blank" href="{{ .Params.OriginLink }}" title="{{ .Title }}">{{ .Params.Link }}</a>
{{- else }}
<strong>{{ print (T "PostCRLink") (T "SymbolColon") }}</strong>
<a href="{{ .Permalink | absLangURL }}" title="{{ .Title }}">{{ .Permalink | absLangURL }}</a>
<a id="post-cr-link" href="{{ .Permalink | absLangURL }}" title="{{ .Title }}">{{ .Permalink | absLangURL }}</a>
{{- end }}
</li>
<li class="post-copyright-license">