modified widget "server-status"
This commit is contained in:
parent
4ce38d51a7
commit
481db4e836
26
assets/scss/custom.scss
Normal file
26
assets/scss/custom.scss
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
.widget.archives {
|
||||||
|
.widget-archive--list {
|
||||||
|
border-radius: var(--card-border-radius);
|
||||||
|
box-shadow: var(--shadow-l1);
|
||||||
|
background-color: var(--card-background);
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-item {
|
||||||
|
&:not(:last-of-type) {
|
||||||
|
border-bottom: 1.5px solid var(--card-separator-color);
|
||||||
|
}
|
||||||
|
font-size: 1.4rem;
|
||||||
|
padding: 18px 25px;
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
span.year {
|
||||||
|
flex: 1;
|
||||||
|
color: var(--card-text-color-main);
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.count {
|
||||||
|
color: var(--card-text-color-tertiary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -5,6 +5,6 @@ widget:
|
|||||||
|
|
||||||
status:
|
status:
|
||||||
title: 状态
|
title: 状态
|
||||||
start: 博客建立自:
|
postCount: 文章数量
|
||||||
time: 已稳定运行:
|
start: 博客起始
|
||||||
postCount: 总文章数量:
|
time: 稳定运行
|
@ -1,39 +1,45 @@
|
|||||||
{{/*-- post count */}}
|
{{/*-- post count */}} {{ $posts := (where .Site.RegularPages "Section" "==" "post") }} {{
|
||||||
{{ $posts := (where .Site.RegularPages "Section" "==" "post") }}
|
$postCount := len $posts }}
|
||||||
{{ $postCount := len $posts }}
|
|
||||||
|
|
||||||
<section class="widget tagCloud">
|
<section class="widget archives">
|
||||||
<div class="widget-icon">
|
<div class="widget-icon">{{ partial "helper/icon" "status" }}</div>
|
||||||
{{ partial "helper/icon" "status" }}
|
|
||||||
</div>
|
|
||||||
<h2 class="widget-title section-title">{{ T "widget.status.title" }}</h2>
|
<h2 class="widget-title section-title">{{ T "widget.status.title" }}</h2>
|
||||||
|
|
||||||
<div class="tagCloud-tags" style="display: flex; flex-direction: column;">
|
<div class="widget-archive--list">
|
||||||
<div style="padding: 10px 0; color: #bababa;">{{ T "widget.status.postCount" }}{{ $postCount }}</div>
|
<div class="status-item">
|
||||||
<div style="padding: 10px 0; color: #bababa;">{{ T "widget.status.start" }}<span id="start"></span></div>
|
<span class="year">{{ T "widget.status.postCount" }}</span>
|
||||||
<div style="padding: 10px 0; color: #bababa;">{{ T "widget.status.time" }}<span id="time"></span></div>
|
<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>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
Date.prototype.format = function(fmt) {
|
Date.prototype.format = function(fmt) {
|
||||||
var o = {
|
var o = {
|
||||||
"M+" : this.getMonth()+1, //月份
|
"M+" : this.getMonth()+1, //月份
|
||||||
"d+" : this.getDate(), //日
|
"d+" : this.getDate(), //日
|
||||||
"h+" : this.getHours(), //小时
|
"h+" : this.getHours(), //小时
|
||||||
"m+" : this.getMinutes(), //分
|
"m+" : this.getMinutes(), //分
|
||||||
"s+" : this.getSeconds(), //秒
|
"s+" : this.getSeconds(), //秒
|
||||||
"q+" : Math.floor((this.getMonth()+3)/3), //季度
|
"q+" : Math.floor((this.getMonth()+3)/3), //季度
|
||||||
"S" : this.getMilliseconds() //毫秒
|
"S" : this.getMilliseconds() //毫秒
|
||||||
};
|
};
|
||||||
if(/(y+)/.test(fmt)) {
|
if(/(y+)/.test(fmt)) {
|
||||||
fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
|
fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
|
||||||
}
|
}
|
||||||
for(var k in o) {
|
for(var k in o) {
|
||||||
if(new RegExp("("+ k +")").test(fmt)){
|
if(new RegExp("("+ k +")").test(fmt)){
|
||||||
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
|
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fmt;
|
return fmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user