feat: bump theme to v4.0.3
This commit is contained in:
31
layouts/_partials/comments/provider/artalk.html
Normal file
31
layouts/_partials/comments/provider/artalk.html
Normal file
@@ -0,0 +1,31 @@
|
||||
{{- $style := resources.Get "scss/partials/comments/artalk.scss" | toCSS | minify -}}
|
||||
{{- with .Site.Params.comments.artalk -}}
|
||||
{{- $serverUrl := default .server .serverUrl -}}
|
||||
<link href="https://cdn.taurusxin.com/hugo/assets/artalk/2.9.1/Artalk.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="{{ $style.RelPermalink }}">
|
||||
|
||||
<script src="https://cdn.taurusxin.com/hugo/assets/artalk/2.9.1/Artalk.min.js"></script>
|
||||
|
||||
<div id="Comments" class="artalk-container"></div>
|
||||
|
||||
<script>
|
||||
function isDarkMode() {
|
||||
return document.documentElement.dataset.scheme === 'dark';
|
||||
}
|
||||
|
||||
const artalkInstance = Artalk.init({
|
||||
el: '#Comments',
|
||||
pageKey: '{{ $.RelPermalink }}',
|
||||
pageTitle: '{{ $.Title }}',
|
||||
server: '{{ $serverUrl }}',
|
||||
site: '{{ .site }}',
|
||||
darkMode: isDarkMode(),
|
||||
locale: 'auto',
|
||||
});
|
||||
|
||||
window.addEventListener('onColorSchemeChange', (e) => {
|
||||
if (!artalkInstance || typeof artalkInstance.setDarkMode !== 'function') return;
|
||||
artalkInstance.setDarkMode(e.detail === 'dark');
|
||||
});
|
||||
</script>
|
||||
{{- end -}}
|
||||
37
layouts/_partials/head/custom.html
Normal file
37
layouts/_partials/head/custom.html
Normal file
@@ -0,0 +1,37 @@
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
|
||||
<link rel="manifest" href="/site.webmanifest">
|
||||
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
|
||||
<meta name="apple-mobile-web-app-title" content="TaurusXin">
|
||||
<meta name="application-name" content="TaurusXin">
|
||||
<meta name="msapplication-TileColor" content="#da532c">
|
||||
<meta name="theme-color" content="#f5f5fa" media="(prefers-color-scheme: light)">
|
||||
<meta name="theme-color" content="#303030" media="(prefers-color-scheme: dark)">
|
||||
|
||||
<!-- highlight.js -->
|
||||
<link href="https://cdn.taurusxin.com/hugo/assets/highlight.js/9.12.0/styles/atom-one-dark.min.css" rel="stylesheet">
|
||||
<script src="https://cdn.taurusxin.com/hugo/assets/highlight.js/9.12.0/highlight.min.js"></script>
|
||||
<script>hljs.initHighlightingOnLoad()</script>
|
||||
|
||||
<style>
|
||||
@font-face{
|
||||
font-family: 'Maple Font Mono';
|
||||
src: url('https://cdn.taurusxin.com/hugo/assets/fonts/MapleFontMono/MapleMono-Regular.woff2') format('woff2'),
|
||||
url('https://cdn.taurusxin.com/hugo/assets/fonts/MapleFontMono/MapleMono-Regular.woff') format('woff'),
|
||||
url('https://cdn.taurusxin.com/hugo/assets/fonts/MapleFontMono/MapleMono-Regular.ttf') format('truetype');
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Baidu Analytics -->
|
||||
<script>
|
||||
var _hmt = _hmt || [];
|
||||
(function() {
|
||||
var hm = document.createElement("script");
|
||||
hm.src = "https://hm.baidu.com/hm.js?360253efb0d8255a98cdeb8be43ef88d";
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
})();
|
||||
</script>
|
||||
109
layouts/_partials/widget/status.html
Normal file
109
layouts/_partials/widget/status.html
Normal file
@@ -0,0 +1,109 @@
|
||||
{{/*-- post count */}} {{ $posts := (where .Context.Site.Pages "Section" "==" "post") }}
|
||||
{{ $postCount := len $posts }}
|
||||
|
||||
<section class="widget archives" style="padding-bottom: 45px;">
|
||||
<div class="widget-icon">{{ partial "helper/icon" "status" }}</div>
|
||||
<h2 class="widget-title section-title">{{ T "widget.status.title" }}</h2>
|
||||
|
||||
<div class="widget-archive--list">
|
||||
<div class="status-item">
|
||||
<span class="year">{{ T "widget.status.postCount" }}</span>
|
||||
<span class="count">{{ $postCount }}</span>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<span class="year">{{ T "widget.status.start" }}</span>
|
||||
<span class="count" id="start"></span>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<span class="year">{{ T "widget.status.time" }}</span>
|
||||
<span class="count" id="time"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
Date.prototype.format = function(fmt) {
|
||||
var o = {
|
||||
"M+" : this.getMonth()+1, //月份
|
||||
"d+" : this.getDate(), //日
|
||||
"h+" : this.getHours(), //小时
|
||||
"m+" : this.getMinutes(), //分
|
||||
"s+" : this.getSeconds(), //秒
|
||||
"q+" : Math.floor((this.getMonth()+3)/3), //季度
|
||||
"S" : this.getMilliseconds() //毫秒
|
||||
};
|
||||
if(/(y+)/.test(fmt)) {
|
||||
fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
|
||||
}
|
||||
for(var k in o) {
|
||||
if(new RegExp("("+ k +")").test(fmt)){
|
||||
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
|
||||
}
|
||||
}
|
||||
return fmt;
|
||||
}
|
||||
|
||||
|
||||
let start = new Date({{ .Params.start }})
|
||||
let startFormated = start.format({{ .Params.format }})
|
||||
document.querySelector('#start').innerHTML = startFormated
|
||||
start.setMonth(start.getMonth() - 1)
|
||||
|
||||
let now = new Date()
|
||||
now.setMonth(now.getMonth() -1)
|
||||
|
||||
let diff = Date.UTC(now.getFullYear(), now.getMonth(), now.getDay(), 0, 0, 0)
|
||||
- Date.UTC(start.getFullYear(), start.getMonth(), start.getDay(), 0, 0, 0)
|
||||
|
||||
function checkleapyear(datea)
|
||||
{
|
||||
if(datea.getYear() % 4 == 0)
|
||||
{
|
||||
if(datea.getYear() % 10 != 0)
|
||||
{
|
||||
return true
|
||||
}
|
||||
else
|
||||
{
|
||||
if(datea.getYear() % 400 == 0)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function DaysInMonth(Y, M) {
|
||||
with (new Date(Y, M, 1, 12)) {
|
||||
setDate(-2)
|
||||
return getDate()
|
||||
}
|
||||
}
|
||||
|
||||
function datediff(date1, date2)
|
||||
{
|
||||
var y1 = date1.getFullYear(), m1 = date1.getMonth(), d1 = date1.getDate(),
|
||||
y2 = date2.getFullYear(), m2 = date2.getMonth(), d2 = date2.getDate()
|
||||
if (d1 < d2)
|
||||
{
|
||||
m1--
|
||||
d1 += DaysInMonth(y2, m2)
|
||||
}
|
||||
if (m1 < m2)
|
||||
{
|
||||
y1--
|
||||
m1 += 12
|
||||
}
|
||||
return [y1 - y2, m1 - m2, d1 - d2]
|
||||
}
|
||||
|
||||
var dife = datediff(now, start)
|
||||
if(checkleapyear(start)==true)
|
||||
{
|
||||
document.querySelector('#time').innerHTML = dife[0] + " 年 "+dife[1] + ' 月 ' + dife[2] + ' 天'
|
||||
|
||||
}else{
|
||||
document.querySelector('#time').innerHTML = dife[0] + " 年 "+dife[1] + ' 月 ' + dife[2] + ' 天'
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
Reference in New Issue
Block a user