82 Commits

Author SHA1 Message Date
elkan1788
53ad048763 Merge branch 'release_v4.5.0'
Some checks failed
sync-2-gitee / sync-2-gitee (push) Failing after 2s
2023-06-24 21:20:22 +08:00
elkan1788
85871aadfc 🐛 Fixed the yaml syntax error. 2023-06-24 21:18:24 +08:00
elkan1788
61079367ef 🔧 Update the zh_tw i18n config file. 2023-06-24 20:27:00 +08:00
elkan1788
07e199ba11 🔖 Start new release version to 4.5.0 2023-06-24 16:49:05 +08:00
elkan1788
92a55d49e5 💄 Add magrin pixes from icon between text. 2023-06-24 16:37:33 +08:00
elkan1788
ee86b0d152 🐛 Fixed the comment enabled setting. 2023-06-24 15:24:04 +08:00
elkan1788
53f3a902c1 💄 Upgrade categories display in post meta. 2023-06-24 14:30:15 +08:00
elkan1788
05dba844d7 💄 Add support subcategory feature. 2023-06-24 11:08:17 +08:00
elkan1788
d44d4c2a79 💄 add page comment counter click event. 2023-06-23 22:06:42 +08:00
elkan1788
a4f496b796 📝 Upgrade README content with add new donor. 2023-06-23 20:09:17 +08:00
凡梦星尘
03ebd658ea Merge pull request #96 from vishnucho/main
feat i18n zh-tw
2023-04-23 09:52:31 +08:00
Vishnu Cho
77a33df023 feat i18n zh-tw 2023-04-15 15:47:21 +08:00
elkan1788
588740f27b 💄 Add header anchor in post page. Close #35 2023-04-07 14:17:15 +08:00
elkan1788
726349a2e0 🔀 sync main branch code 2023-04-05 15:49:39 +08:00
elkan1788
fbac63d70e 🎨 Improved page & comment counter, Close #74. 2023-04-05 12:16:05 +08:00
elkan1788
c7e4f52499 🎨 Update the site stat paramter format. 2023-04-02 17:07:29 +08:00
凡梦星尘
fdaabac210 Merge branch 'develop' of github.com:hugo-next/hugo-theme-next into develop 2023-02-20 10:30:42 +08:00
凡梦星尘
76bb84d195 Merge pull request #89 from ego/fix/utils-hideComments
Minor improvements for utils
2023-02-20 10:24:21 +08:00
凡梦星尘
88e6bc5993 🐛 Fixed the verify code build error. 2023-02-16 16:19:45 +08:00
Alter Ego
3feea66b49 * Fix utils function hideComments.
* Fix function name.
2023-02-10 01:20:07 +00:00
凡梦星尘
6b589a8206 :wrench:💄 Update the i18n config files. 2023-01-02 20:08:48 +08:00
凡梦星尘
835e98d85d :lipstick:🔧 Update the sidebar info. 2023-01-02 18:00:44 +08:00
凡梦星尘
a2019876a2 :wrench:💄 Update the post archive info. 2023-01-02 14:58:17 +08:00
凡梦星尘
dca196c315 :lipstick:🔧 Update the post meta info. 2023-01-01 22:06:59 +08:00
凡梦星尘
85b7dc11ca :lipstick:🔧 Upate the reward tip info. 2023-01-01 21:43:06 +08:00
凡梦星尘
03fd9dc829 :lipstick:🔧 Update the post copyright info. 2023-01-01 21:32:18 +08:00
凡梦星尘
a2f37c8470 Remove trim blank charsets flag to improve speed. 2023-01-01 21:12:58 +08:00
凡梦星尘
d0a6d943e0 📝 Find other way to break down math formula. 2023-01-01 17:48:24 +08:00
凡梦星尘
fa0f7856bf 📝 Update the math formula break down description. 2023-01-01 17:18:56 +08:00
凡梦星尘
dac9b379dc 💄 Move fixed post copyright word break limit. 2022-12-31 21:54:21 +08:00
凡梦星尘
a59b6a6f32 🔍 Add copyright's img attribute of alt. 2022-12-21 09:09:01 +08:00
凡梦星尘
40674ad12b 📝 Upgrade the README content to add new Donor. 2022-12-19 11:43:52 +08:00
凡梦星尘
b0ad23d764 Merge pull request #76 from ehlxr/patch-1
fix bug  404 of uppercase tag or category name
2022-12-19 11:39:34 +08:00
凡梦星尘
6db5f5c3f9 Merge pull request #76 from ehlxr/patch-1
fix bug  404 of uppercase tag or category name
2022-12-19 11:23:47 +08:00
ḕℏỈẍȓ
7b7b50fe1a fix bug 404 of uppercase tag or category name
fix bug of 404 when the tag or category  name is uppercase

Signed-off-by: ḕℏỈẍȓ <ehlxr.me@gmail.com>
2022-12-12 10:40:00 +08:00
kaolengmian7
73b15c7271 Merge remote-tracking branch 'origin/develop' into develop 2022-11-06 22:58:29 +08:00
凡梦星尘
24b135ca4b Merge branch 'hotfix_v4.4.1' into develop 2022-11-06 18:26:54 +08:00
凡梦星尘
86b9b5aa50 Merge branch 'hotfix_v4.4.1' 2022-11-06 18:26:14 +08:00
凡梦星尘
8918bff71f 🐛 Fixed the page views counter in home page. 2022-11-06 18:23:55 +08:00
凡梦星尘
dd3766bce3 📝 Startup hotfix for v4.4.1 2022-11-06 17:24:23 +08:00
kaolengmian7
8310dd347d [fix]修复样式BUG,调整 li 标签和 a 标签 css 样式 2022-11-05 10:31:41 +08:00
凡梦星尘
d6de03a2d0 Merge branch 'release_v4.4.0' into develop 2022-10-30 22:19:31 +08:00
凡梦星尘
21395a0263 Merge branch 'release_v4.4.0'
Some checks failed
sync-2-gitee / sync-2-gitee (push) Failing after 3s
2022-10-30 21:21:00 +08:00
凡梦星尘
54ada081c7 🐛 Fixed the busuanzi post view counter in home page. 2022-10-30 21:19:34 +08:00
凡梦星尘
51221f0f91 📝 Upgrade the README content about post front matter. 2022-10-30 21:12:01 +08:00
凡梦星尘
f84d590023 🐛 Fixed the comment setting in front matter. 2022-10-30 21:04:08 +08:00
凡梦星尘
7c9b834729 Add new CDN vendor who name is qiniu & bootcdn. 2022-10-30 16:54:38 +08:00
凡梦星尘
e1c088c355 💄 Add comment counter in home & page. 2022-10-30 11:43:18 +08:00
凡梦星尘
d609eecb23 ⬆️ Upgrade the Waline component version. 2022-10-30 10:40:58 +08:00
凡梦星尘
08156f22b8 Use lazy loading image function & add image viewer. Close #65 2022-10-29 22:37:41 +08:00
凡梦星尘
fa414e827a 💄 Make home post view only work for waline. 2022-10-29 20:35:19 +08:00
凡梦星尘
146bf52038 💄 Update use waline pageview & add to homepage. Close #41, #42 2022-10-29 18:15:39 +08:00
凡梦星尘
ac712b9277 🐛 Fixed the 51la widget load data issue. 2022-10-27 17:29:18 +08:00
凡梦星尘
0d1b00f7b0 🔥 Refactor struct & code for loading 3rd scripts. 2022-10-27 15:57:42 +08:00
凡梦星尘
9160a33053 💄 Fixed the waline reaction icon pixes in mobile driver. 2022-10-27 08:54:54 +08:00
凡梦星尘
525c8a7cf5 Upgrade third party js logic improve load speed. 2022-10-26 22:37:03 +08:00
凡梦星尘
90df1e1247 Refactoring the comments component js scripts. 2022-10-24 22:08:17 +08:00
凡梦星尘
b9511728f3 🔥 Remove unused the gt.scss file. 2022-10-24 20:38:28 +08:00
凡梦星尘
cc91cd0e07 🔥 Remove the busuanzi layout in footer. 2022-10-23 18:37:29 +08:00
凡梦星尘
aaa3a1449f Make the google translate script lazy load. 2022-10-23 18:36:10 +08:00
凡梦星尘
dacf4cd2c7 🙈 Add VSCode IDEA setting ignore. 2022-10-23 17:43:30 +08:00
凡梦星尘
913ae1821a 🐛 Fixed toggle theme color will refresh page. 2022-10-23 16:05:23 +08:00
凡梦星尘
1ae0ca2488 🐛 Fixed the theme schema listener of system's media. 2022-10-23 09:06:58 +08:00
凡梦星尘
72972e3a10 💄 Use smaller font size on tool button by default. 2022-10-22 17:24:13 +08:00
凡梦星尘
50f17ff502 💄 Uniform the tool buttons font size. 2022-10-22 13:24:28 +08:00
凡梦星尘
6865ec72c7 🚑 Enable the home page register tool button click. 2022-10-22 12:55:11 +08:00
凡梦星尘
0d4e0b9b84 🚑 Fixed the tool buttons click event. 2022-10-22 12:52:27 +08:00
凡梦星尘
c0ba7eda06 🎨 Try to remove the post link in creative commons. 2022-10-16 20:16:24 +08:00
凡梦星尘
e0cfe0c50c 🔥 🚚 Remove no used code & rename startup shell script file name. 2022-10-12 20:06:14 +08:00
凡梦星尘
e4cb4f0188 🔥 Remove no used code. 2022-10-09 21:54:02 +08:00
凡梦星尘
989e2c43dc 💄 Try to add reaction image with pixes in mobile driver. 2022-10-09 21:53:03 +08:00
凡梦星尘
2d736b8f35 💄 Add Algolia link with source reference content. 2022-10-07 10:13:10 +08:00
凡梦星尘
b04c1b9aa0 🐛 Fixed the tool button scroll Y pixes. 2022-10-06 13:57:37 +08:00
凡梦星尘
6a42188853 💄 Design search box footer with pagination & fixed toc enable in home page. 2022-10-06 12:00:10 +08:00
凡梦星尘
0536ac37fc 💄 Add tool button click events make it more silky. 2022-10-06 10:48:52 +08:00
凡梦星尘
0abad2539a 💄 Fixed the TOC enable in global set & implement the auto follow in TOC list with content scroll. 2022-10-06 10:02:19 +08:00
凡梦星尘
48df6401d8 💄 Remove margin in Algolia pagination widget. 2022-10-06 08:49:03 +08:00
凡梦星尘
9632707ece 💄 Redesign the Algolia search result display UI. 2022-10-05 22:56:13 +08:00
凡梦星尘
ea8a4f1dca 🔖 Start new development version to 4.4.0 2022-10-05 22:20:51 +08:00
凡梦星尘
bebd279735 👷 Upgrade Algolia search indexes with objectID. 2022-10-04 14:19:01 +08:00
凡梦星尘
9f2b1f37f8 Merge branch 'hotfix_v4.3.1' into develop 2022-10-02 13:46:50 +08:00
凡梦星尘
01f2c10ec8 Merge branch 'release_v4.3.0' into develop 2022-10-02 13:46:34 +08:00
126 changed files with 1935 additions and 2547 deletions

4
.gitignore vendored
View File

@@ -20,9 +20,11 @@ exampleSite/content/**/
# Exclude special files
!exampleSite/config.yaml
!exampleSite/start.sh
!exampleSite/startup.sh
data/*
!data/config.yaml
!data/resources.yaml
# vscode
.vscode/

View File

@@ -112,10 +112,12 @@ tags:
#expand: true
# It's means that will redirecting to external links
#extlink:
# Switch to enabled or disabled comment plugins in this post
# Disabled comment plugins in this post
#comment:
# enable: false
# Enable table of content
# Disable table of content int this post
# Notice: By default will automatic build table of content
# with h2-h4 title in post and without other settings
#toc: false
# Absolute link for visit
#url: "{{ lower .Name }}.html"
@@ -170,9 +172,11 @@ List of Donors(Order desc by Date):
| Donation time | Donors | Donation mode | Donation content | Message |
| :-------: | ------ | ------ | ---- | ---- |
| 2022.09.30 | * | wechat pay | ¥66.66 | Hope it could help more people. |
| 2022.09.30 | N*l | wechat pay | ¥20.00 | / |
| 2022.07.09 | * | wechat pay | ¥10.00 | / |
| 2022.05.08 | *泉 | wechat pay | ¥6.60 | Good luck with next develop. |
| 2022.02.28 | * | wechat pay | ¥5.00 | / |
| 2021.12.21 | z*y | wechat pay | ¥18.88 | / |
| 2023.06.01 | **霖 | alipay | RMB 10.00 | / |
| 2022.11.15 | f888 | xianyu | RMB 6.20 | Good luck. |
| 2022.09.30 | * | wechat pay | RMB 66.66 | Hope it could help more people. |
| 2022.09.30 | N*l | wechat pay | RMB 20.00 | / |
| 2022.07.09 | * | wechat pay | RMB 10.00 | / |
| 2022.05.08 | *泉 | wechat pay | RMB 6.60 | Good luck with next develop. |
| 2022.02.28 | *娇 | wechat pay | RMB 5.00 | / |
| 2021.12.21 | z*y | wechat pay | RMB 18.88 | / |

View File

@@ -120,10 +120,11 @@ tags:
#expand: true
# 外部链接地址,访问时直接跳转
#extlink:
# 在当前页面开启或关闭评论功能
# 在当前页面关闭评论功能
#comment:
# enable: false
# 开启文章目录功能
# 关闭当前页面目录功能
# 注意正常情况下文章中有H2-H4标题会自动生成目录无需额外配置
#toc: false
# 绝对访问路径
#url: "{{ lower .Name }}.html"
@@ -180,6 +181,8 @@ Copyright (c) 2022 hugo-next 团队
| 打赏时间 | 打赏者 | 打赏方式 | 打赏内容 | 留言 |
| :-------: | ------ | ------ | ---- | ---- |
| 2023.06.01 | **霖 | 支付宝 | ¥10.00 | / |
| 2022.11.15 | f888 | 咸鱼 | ¥6.20 | 聊表心意 |
| 2022.09.30 | *軒 | 微信支付 | ¥66.66 | 愿项目造福更多人! |
| 2022.09.30 | N*l | 微信支付 | ¥20.00 | / |
| 2022.07.09 | *风 | 微信支付 | ¥10.00 | / |

View File

@@ -1 +1 @@
4.3.1
4.5.0

View File

@@ -27,12 +27,12 @@ tags:
# 外部链接地址,访问时直接跳转
# It's means that will redirecting to external links
#extlink:
# 在当前页面开启或关闭评论功能
# Switch to enabled or disabled comment plugins in this post
# 在当前页面关闭评论功能
# Disabled comment plugins in this post
#comment:
# enable: false
# 开启文章目录功能
# Enable table of content
# 关闭文章目录功能
# Disable table of content
#toc: false
# 绝对访问路径
# Absolute link for visit

View File

@@ -15,14 +15,23 @@
list-style: none;
margin: 0;
padding: 0;
}
.category-list-item {
margin: 5px 10px;
.category-list-item:before {
font-family: var(--fa-style-family,"Font Awesome 6 Free");
font-weight: var(--fa-style,900);
content: "\f07c";
margin-right: 5px;
}
.category-list-item {
margin: 5px 10px;
font-weight: bold;
}
}
.category-list-count {
color: $grey;
padding: 0 2px;
&::before {
content: ' (';
@@ -33,7 +42,19 @@
}
}
.category-list-child {
padding-left: 10px;
.category-children-list {
padding-left: 38px;
list-style: none;
.category-children-list-item:before {
font-family: var(--fa-style-family,"Font Awesome 6 Free");
font-weight: var(--fa-style,900);
content: "\f0ae";
margin-right: 5px;
}
.category-children-list-item {
font-size: 0.925em;
}
}
}

View File

@@ -42,6 +42,7 @@
}
}
@if $toc_number {
.autonumber {
h2 {
counter-reset: h3;
@@ -66,6 +67,7 @@
content: counter(h2) "." counter(h3) "." counter(h4) ". ";
}
}
}
}
@import 'post-collapse';

View File

@@ -59,6 +59,10 @@
@include post-card();
border: none;
background: none;
li {
word-break: break-all;
}
}
}

View File

@@ -113,3 +113,8 @@
flex-basis: 100%;
height: 0;
}
#comments-count {
cursor: pointer;
border-bottom: 1px solid $link-decoration-color;
}

View File

@@ -24,7 +24,7 @@
.search-popup {
background: var(--card-bg-color);
border-radius: 5px;
height: 80%;
height: 65%;
margin: auto;
transform: scale(0);
transition: transform .4s;
@@ -55,12 +55,7 @@
}
.search-header {
background: $gainsboro;
@if $darkmode {
@media (prefers-color-scheme: dark) {
background: $grey-dim;
}
}
background: var(--content-bg-color);
border-top-left-radius: 5px;
border-top-right-radius: 5px;
display: flex;
@@ -72,6 +67,7 @@
border: 0;
outline: 0;
width: 100%;
color: var(--text-color);
&::-webkit-search-cancel-button {
display: none;
@@ -81,15 +77,46 @@
.search-result-container {
height: calc(100% - 55px);
overflow: auto;
padding: 5px 25px;
padding: 0px 25px;
}
hr {
margin: 5px 0 10px;
.search-footer {
background: var(--content-bg-color);
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
padding: 0 5px;
color: var(--text-color);
&:first-child {
display: none;
.search-meta-info {
height: 26px;
display: flex;
padding: 5px 0;
.search-hit-stats {
font-size: $font-size-smaller;
width: 65%;
padding: 2px 8px;
}
.search-vendor {
width: 34%;
text-align: right;
font-size: $font-size-small;
font-weight: bold;
img {
width: 68px;
margin: 5px;
vertical-align: middle;
display: inline;
}
a {
border: none;
}
}
}
}
.search-result-list {
@@ -137,9 +164,16 @@
.algolia-pagination {
// Override default style of ul
margin: 40px 0;
//margin: 40px 0;
opacity: 1;
padding: 0;
font-size: $font-size-smallest;
margin-bottom: -16px;
.pagination {
visibility: visible;
margin: 0;
}
.pagination-item {
display: inline-block;
@@ -176,4 +210,4 @@
margin: auto;
}
}
}
}

View File

@@ -2,4 +2,17 @@
.wl-actions>button:nth-child(3) {
display: none
}
@include mobile() {
.wl-reaction-img {
width: 28px;
height: 28px;
}
.wl-reaction-votes {
padding: 0.85px;
font-weight: 500;
font-size: .65em;
line-height: .85;
}
}
}

View File

@@ -2,9 +2,12 @@
@include sidebar-toggle();
background: none;
bottom: 55px;
bottom: 58px;
filter: alpha(opacity=0);
font-size: 12px;
font-size: $font-size-smaller;
@include mobile() {
font-size: $font-size-smallest;
}
.button {
display: block;
@@ -15,7 +18,6 @@
background-color: $tool-btn-bg;
color: $tool-btn-color;
text-align: center;
font-size: $font-size-larger;
line-height: 35px;
padding: 0;
outline: 0;
@@ -25,6 +27,13 @@
opacity: $tool-btn-opacity;
touch-action: manipulation;
@include mobile() {
width: 24px;
height: 24px;
line-height: 24px;
border-radius: 3px;
}
&:hover {
color: $tool-btn-hover-fore-color;
opacity: $tool-btn-opacity-hover;
@@ -32,7 +41,7 @@
}
.goto-comments {
display: none;
display: none;
}
.goto-comments-on {
@@ -42,7 +51,6 @@
@if $back2top_enable {
.back-to-top {
font-size: $font-size-smaller;
@if not $back2top_scrollpercent {
span {
@@ -51,7 +59,7 @@
}
@if $back2top_sidebar {
margin: 20px - $sidebar-offset -10px -20px;
margin: 20px -$sidebar-offset -10px -20px;
opacity: 0;
transition: opacity $transition-ease;

View File

@@ -32,10 +32,10 @@
.google-translate {
display: flex;
justify-content: center;
i {
.fa {
font-size: $font-size-larger;
margin: auto 0;
line-height: normal;
}
}

View File

@@ -27,6 +27,8 @@
img {
display: inline-block;
max-width: 120px;
max-height: 42px;
}
}

View File

@@ -1,6 +1,7 @@
.site-author-image {
border: $site-author-image-border-width solid $site-author-image-border-color;
max-width: $site-author-image-width;
width: $site-author-image-width;
height: $site-author-image-width;
padding: 2px;
@if $avatar_rounded {

View File

@@ -2,6 +2,10 @@
font-size: $font-size-small;
padding: 0 8px;
.active-current {
color: $orange;
}
ul {
list-style: none;
@@ -15,22 +19,22 @@
> ul {
border-left: 1px solid;
margin-left: 6px;
margin-left: 4px;
li {
position: relative;
padding-left: 0;
&:before {
position: absolute;
content: ' ';
top: 0.14em;
left: -0.75em;
width: 0.68em;
width: 0.65em;
height: 0.815em;
border-style: none none dashed none;
border-width: 0.05em;
}
}
}
}
@@ -42,10 +46,11 @@
a {
transition: all $transition-ease;
border: none;
&:before {
content: counters(item, ".") ". ";
counter-increment: item;
@if $toc_number {
&:before {
content: counters(item, ".") ". ";
counter-increment: item;
}
}
&:hover {

View File

@@ -1,6 +1,6 @@
@mixin mobile-smallest() {
@media (max-width: 413px) {
@content;;
@content;
}
}

View File

@@ -296,7 +296,7 @@ $b2t-opacity-hover : 1;
$b2t-position-bottom : -100px;
$b2t-position-bottom-on : 19px;
$b2t-position-right : 30px;
$b2t-position-right-mobile : 20px;
$b2t-position-right-mobile : 16px;
$b2t-font-size : 12px;
$b2t-color : white;
$b2t-bg-color : $black-deep;

View File

@@ -1,892 +0,0 @@
:root {
--gt-blue: #2640b2;
--gt-border: #d1d5db;
}
@keyframes "goog-te-spinner-rotator" {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(270deg);
}
}
@keyframes "goog-te-spinner-dash" {
0% {
stroke-dashoffset: 187;
}
50% {
stroke-dashoffset: 46.75;
transform: rotate(135deg);
}
100% {
stroke-dashoffset: 187;
transform: rotate(450deg);
}
}
.goog-te-banner-frame {
left: 0px;
top: 0px;
height: 39px;
width: 100%;
z-index: 10000001;
position: fixed;
border: none;
border-bottom: 1px solid #6b90da;
margin: 0;
box-shadow: 0 0 8px 1px #999999;
_position: absolute;
}
.goog-te-menu-frame {
z-index: 10000002;
position: fixed;
box-shadow: 0.5rem 0.875rem 2.375rem rgba(39, 44, 49, 0.06), 0.0625rem 0.1875rem 0.5rem rgba(39, 44, 49, 0.03);
_position: absolute;
}
.goog-te-ftab-frame {
z-index: 10000000;
border: none;
margin: 0;
}
.goog-te-gadget {
font-family: arial;
font-size: 11px;
color: #666;
white-space: nowrap;
display: inline-flex;
img {
vertical-align: middle;
border: none;
display: inline-block;
}
.goog-te-combo {
margin: 4px 0;
}
div:first-child {
margin: 0 10px;
}
}
.goog-te-gadget-simple {
background-color: #fff;
border-left: 1px solid #d5d5d5;
border-top: 1px solid #9b9b9b;
border-bottom: 1px solid #e8e8e8;
border-right: 1px solid #d5d5d5;
font-size: 10pt;
display: inline-block;
padding-top: 1px;
padding-bottom: 2px;
cursor: pointer;
zoom: 1;
*display: inline;
.goog-te-menu-value {
color: #000;
span {
text-decoration: none;
}
}
}
.goog-te-gadget-icon {
margin-left: 2px;
margin-right: 2px;
width: 19px;
height: 19px;
border: none;
vertical-align: middle;
}
.goog-te-combo {
margin-left: 4px;
margin-right: 4px;
vertical-align: baseline;
*vertical-align: middle;
font-family: arial;
font-size: 10pt;
}
.goog-logo-link {
font-size: 12px;
font-weight: bold;
color: #444;
text-decoration: none;
margin: 0 5px;
border-bottom: 0;
&:link {
font-size: 12px;
font-weight: bold;
color: #444;
text-decoration: none;
}
&:visited {
font-size: 12px;
font-weight: bold;
color: #444;
text-decoration: none;
}
&:hover {
font-size: 12px;
font-weight: bold;
color: #444;
text-decoration: none;
}
&:active {
font-size: 12px;
font-weight: bold;
color: #444;
text-decoration: none;
}
}
.goog-te-banner {
.goog-logo-link {
display: block;
margin: 0px 10px;
padding-top: 2px;
padding-left: 4px;
}
* {
font-family: arial;
font-size: 10pt;
}
margin: 0;
background-color: #fff;
overflow: hidden;
img {
border: none;
}
table {
tbody {
tr {
td {
&:nth-child(2) {
display: none;
}
}
}
}
}
}
.goog-close-link {
display: block;
margin: 0px 10px;
}
.goog-te-ftab {
* {
font-family: arial;
font-size: 10pt;
}
margin: 0px;
background-color: #fff;
white-space: nowrap;
}
.goog-te-menu {
* {
font-family: arial;
font-size: 10pt;
}
background-color: #ffffff;
text-decoration: none;
border: 2px solid #c3d9ff;
overflow-y: scroll;
overflow-x: hidden;
position: absolute;
left: 0;
top: 0;
}
.goog-te-menu2 {
* {
font-family: arial;
font-size: 10pt;
}
background-color: #ffffff;
text-decoration: none;
overflow: hidden;
padding: 4px;
border: 1px solid var(--gt-border);
border-radius: 4px;
}
.goog-te-balloon {
* {
font-family: arial;
font-size: 10pt;
}
background-color: #ffffff;
overflow: hidden;
padding: 8px;
border: none;
border-radius: 10px;
img {
border: none;
}
}
.goog-te-banner-content {
color: #000;
img {
vertical-align: middle;
}
}
.goog-te-banner-info {
color: #666;
vertical-align: top;
margin-top: 0px;
font-size: 7pt;
}
.goog-te-banner-margin {
width: 8px;
}
.goog-te-button {
div {
border: 1px solid var(--gt-border);
height: 20px;
}
button {
background: transparent;
border: none;
cursor: pointer;
height: 20px;
overflow: hidden;
margin: 0;
vertical-align: top;
white-space: nowrap;
&:active {
background: none repeat scroll 0 0 #cccccc;
}
}
}
.goog-te-ftab-link {
text-decoration: none;
font-weight: bold;
font-size: 10pt;
border: 1px outset #888;
padding: 6px 10px;
white-space: nowrap;
position: absolute;
left: 0px;
top: 0px;
img {
margin-left: 2px;
margin-right: 2px;
width: 19px;
height: 19px;
border: none;
vertical-align: middle;
}
span {
text-decoration: underline;
margin-left: 2px;
margin-right: 2px;
vertical-align: middle;
}
}
.goog-float-top {
.goog-te-ftab-link {
padding: 2px 2px;
border-top-width: 0px;
}
}
.goog-float-bottom {
.goog-te-ftab-link {
padding: 2px 2px;
border-bottom-width: 0px;
}
}
.goog-te-menu-value {
text-decoration: none;
color: var(--gt-blue);
white-space: nowrap;
margin-left: 4px;
margin-right: 4px;
span {
text-decoration: underline;
&::after {
content: "";
}
}
img {
margin-left: 2px;
margin-right: 2px;
display: none;
}
}
.goog-te-menu-item {
padding: 3px;
text-decoration: none;
color: var(--gt-blue);
background: #ffffff;
&:link {
color: var(--gt-blue);
background: #ffffff;
}
&:visited {
color: #551a8b;
}
&:hover {
background: #c3d9ff;
}
&:active {
color: var(--gt-blue);
}
}
.goog-te-menu2-colpad {
width: 16px;
}
.goog-te-menu2-separator {
margin: 6px 0;
height: 1px;
background-color: var(--gt-border);
overflow: hidden;
}
.goog-te-menu2-item {
div {
padding: 4px;
color: var(--gt-blue);
background: #ffffff;
}
.indicator {
display: none;
}
text-decoration: none;
&:link {
div {
color: var(--gt-blue);
background: #ffffff;
}
}
&:visited {
div {
color: var(--gt-blue);
background: #ffffff;
}
}
&:active {
div {
color: var(--gt-blue);
background: #ffffff;
}
}
&:hover {
div {
color: #ffffff;
background: #3366cc;
border-radius: 2px;
}
}
}
.goog-te-menu2-item-selected {
div {
padding: 4px;
color: #000;
font-weight: bold;
}
.indicator {
display: auto;
}
.text {
padding-left: 4px;
padding-right: 4px;
}
text-decoration: none;
&:link {
div {
color: #000;
font-weight: bold;
}
}
&:visited {
div {
color: #000;
font-weight: bold;
}
}
&:hover {
div {
color: #000;
font-weight: bold;
}
}
&:active {
div {
color: #000;
font-weight: bold;
}
}
}
.goog-te-balloon-frame {
background-color: #ffffff;
border: 1px solid #6b90da;
box-shadow: 0.5rem 0.875rem 2.375rem rgba(39, 44, 49, 0.06), 0.0625rem 0.1875rem 0.5rem rgba(39, 44, 49, 0.03);
border-radius: 8px;
}
.goog-te-balloon-text {
margin-top: 6px;
}
.goog-te-balloon-zippy {
margin-top: 6px;
white-space: nowrap;
* {
vertical-align: middle;
}
.minus {
background-image: url(//www.google.com/images/zippy_minus_sm.gif);
}
.plus {
background-image: url(//www.google.com/images/zippy_plus_sm.gif);
}
span {
color: #00c;
text-decoration: underline;
cursor: pointer;
margin: 0 4px;
}
}
.goog-te-balloon-form {
margin: 6px 0 0 0;
form {
margin: 0;
textarea {
margin-bottom: 4px;
width: 100%;
}
}
}
.goog-te-balloon-footer {
margin: 6px 0 4px 0;
}
.goog-te-spinner-pos {
z-index: 1000;
position: fixed;
transition-delay: 0.6s;
left: -1000px;
top: -1000px;
}
.goog-te-spinner-animation {
background: #ccc;
display: flex;
align-items: center;
justify-content: center;
width: 104px;
height: 104px;
border-radius: 50px;
background: #fff url(//www.gstatic.com/images/branding/product/2x/translate_24dp.png) 50% 50% no-repeat;
transition: all 0.6s ease-in-out;
transform: scale(0.4);
opacity: 0;
}
.goog-te-spinner-animation-show {
transform: scale(0.5);
opacity: 1;
}
.goog-te-spinner {
margin: 2px 0 0 2px;
animation: goog-te-spinner-rotator 1.4s linear infinite;
}
.goog-te-spinner-path {
stroke-dasharray: 187;
stroke-dashoffset: 0;
stroke: #4285f4;
transform-origin: center;
animation: goog-te-spinner-dash 1.4s ease-in-out infinite;
}
#goog-gt-tt {
color: #222;
background-color: #ffffff;
border: 1px solid #eee;
box-shadow: 0 4px 16px rgba(0,0,0,.2);
display: none;
font-family: arial;
font-size: 10pt;
width: 420px;
padding: 12px;
position: absolute;
z-index: 10000;
.original-text {
clear: both;
font-size: 10pt;
position: relative;
text-align: justify;
width: 100%;
}
.title {
color: #999;
font-family: arial,sans-serif;
margin: 4px 0;
text-align: left;
}
.close-button {
display: none;
}
.logo {
float: left;
margin: 0px;
}
.activity-links {
display: inline-block;
}
.started-activity-container {
display: none;
width: 100%;
}
.activity-root {
margin-top: 20px;
}
.left {
float: left;
}
.right {
float: right;
}
.bottom {
min-height: 15px;
position: relative;
height: 1%;
}
.status-message {
background: linear-gradient(top,#29910d 0%,#20af0e 100%);
background: #29910d;
border-radius: 4px;
box-shadow: inset 0px 2px 2px #1e6609;
color: white;
font-size: 9pt;
font-weight: bolder;
margin-top: 12px;
padding: 6px;
text-shadow: 1px 1px 1px #1e6609;
}
.activity-link {
color: #1155cc;
cursor: pointer;
font-family: arial;
font-size: 11px;
margin-right: 15px;
text-decoration: none;
}
textarea {
font-family: arial;
resize: vertical;
width: 100%;
margin-bottom: 10px;
border-radius: 1px;
border: 1px solid #d9d9d9;
border-top: 1px solid silver;
font-size: 13px;
height: auto;
overflow-y: auto;
padding: 1px;
&:focus {
box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
border: 1px solid #4d90fe;
outline: none;
}
}
.activity-cancel {
margin-right: 10px;
}
.translate-form {
min-height: 25px;
vertical-align: middle;
padding-top: 8px;
.activity-form {
margin-bottom: 5px;
margin-bottom: 0px;
input {
display: inline-block;
min-width: 54px;
*min-width: 70px;
border: 1px solid #dcdcdc;
border: 1px solid rgba(0,0,0,0.1);
text-align: center;
color: #444;
font-size: 11px;
font-weight: bold;
height: 27px;
outline: 0;
padding: 0 8px;
vertical-align: middle;
line-height: 27px;
margin: 0 16px 0 0;
box-shadow: 0 1px 2px rgba(0,0,0,.1);
border-radius: 2px;
transition: all 0.218s;
background-color: #f5f5f5;
background-image: linear-gradient(top,#f5f5f5,#f1f1f1);
-webkit-user-select: none;
-moz-user-select: none;
cursor: default;
&:hover {
border: 1px solid #c6c6c6;
color: #222;
transition: all 0.0s;
background-color: #f8f8f8;
background-image: linear-gradient(top,#f8f8f8,#f1f1f1);
border-color: #3079ed;
}
&:active {
border: 1px solid #c6c6c6;
color: #333;
background-color: #f6f6f6;
background-image: linear-gradient(top,#f6f6f6,#f1f1f1);
border-color: #3079ed;
}
&:focus {
#goog-gt-tt {
.translate-form {
.activity-form {
input.focus {
#goog-gt-tt {
.translate-form {
.activity-form {
input {
&:active {
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5);
}
}
}
}
}
}
}
}
}
&:active {
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5);
}
outline: none;
border: 1px solid #4d90fe;
z-index: 4 !important;
border-color: #3079ed;
}
&.focus {
&:active {
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5);
}
}
}
input.focus {
outline: none;
border: 1px solid #4d90fe;
z-index: 4 !important;
border-color: #3079ed;
}
input.selected {
background-color: #eeeeee;
background-image: linear-gradient(top,#eeeeee,#e0e0e0);
box-shadow: inset 0px 1px 2px rgba(0,0,0,0.1);
border: 1px solid #ccc;
color: #333;
}
input.activity-submit {
color: white;
border-color: #3079ed;
background-color: #4d90fe;
background-image: linear-gradient(top,#4d90fe,#4787ed);
&:hover {
#goog-gt-tt {
.translate-form {
.activity-form {
input.activity-submit {
&:focus {
border-color: #3079ed;
background-color: #357ae8;
background-image: linear-gradient(top,#4d90fe,#357ae8);
}
}
}
}
}
box-shadow: inset 0 0 0 1px #fff,0px 1px 1px rgba(0,0,0,0.1);
border-color: #3079ed;
}
&:focus {
border-color: #3079ed;
}
&:active {
border-color: #3079ed;
}
}
input.activity-submit.focus {
#goog-gt-tt {
.translate-form {
.activity-form {
input.activity-submit {
&:active {
border-color: #3079ed;
background-color: #357ae8;
background-image: linear-gradient(top,#4d90fe,#357ae8);
}
}
}
}
}
border-color: #3079ed;
}
}
}
.gray {
color: #999;
font-family: arial,sans-serif;
}
.alt-helper-text {
color: #999;
font-size: 11px;
font-family: arial,sans-serif;
margin: 15px 0px 5px 0px;
}
.alt-error-text {
color: #800;
display: none;
font-size: 9pt;
}
.alt-menu.goog-menu {
background: #ffffff;
border: 1px solid #dddddd;
box-shadow: 0px 2px 4px #99a;
min-width: 0;
outline: none;
padding: 0;
position: absolute;
z-index: 2000;
}
.alt-menu {
.goog-menuitem {
cursor: pointer;
padding: 2px 5px 5px;
margin-right: 0px;
border-style: none;
h1 {
font-size: 100%;
font-weight: bold;
margin: 4px 0px;
}
strong {
color: #345aad;
}
}
div.goog-menuitem {
&:hover {
background: #ddd;
}
}
}
.goog-submenu-arrow {
text-align: right;
position: absolute;
right: 0;
left: auto;
}
.goog-menuitem-rtl {
.goog-submenu-arrow {
text-align: left;
position: absolute;
left: 0;
right: auto;
}
}
.gt-hl-text {
background-color: #f1ea00;
border-radius: 4px;
box-shadow: rgba(0,0,0,.5) 3px 3px 4px;
box-sizing: border-box;
color: #f1ea00;
cursor: pointer;
margin: -2px -2px -2px -3px;
padding: 2px 2px 2px 3px;
position: relative;
}
.trans-target-highlight {
background-color: #f1ea00;
border-radius: 4px;
box-shadow: rgba(0,0,0,.5) 3px 3px 4px;
box-sizing: border-box;
color: #f1ea00;
cursor: pointer;
margin: -2px -2px -2px -3px;
padding: 2px 2px 2px 3px;
position: relative;
color: #222;
}
.gt-hl-layer {
color: white;
position: absolute !important;
}
.trans-target {
background-color: #c9d7f1;
border-radius: 4px 4px 0px 0px;
box-shadow: rgba(0,0,0,.5) 3px 3px 4px;
box-sizing: border-box;
cursor: pointer;
margin: -2px -2px -2px -3px;
padding: 2px 2px 3px 3px;
position: relative;
.trans-target-highlight {
background-color: #c9d7f1;
border-radius: 4px 4px 0px 0px;
box-shadow: rgba(0,0,0,.5) 3px 3px 4px;
box-sizing: border-box;
cursor: pointer;
margin: -2px -2px -2px -3px;
padding: 2px 2px 3px 3px;
position: relative;
}
}
.trans-edit {
background-color: transparent;
border: 1px solid #4d90fe;
border-radius: 0em;
margin: -2px;
padding: 1px;
}
.gt-trans-highlight-l {
border-left: 2px solid red;
margin-left: -2px;
}
.gt-trans-highlight-r {
border-right: 2px solid red;
margin-right: -2px;
}
#alt-input {
padding: 2px;
}
#alt-input-text {
font-size: 11px;
padding: 2px 2px 3px;
margin: 0;
background-color: #fff;
color: #333;
border: 1px solid #d9d9d9;
border-top: 1px solid #c0c0c0;
display: inline-block;
vertical-align: top;
height: 21px;
box-sizing: border-box;
&:hover {
border: 1px solid #b9b9b9;
border-top: 1px solid #a0a0a0;
box-shadow: inset 0px 1px 2px rgba(0,0,0,0.1);
}
&:focus {
box-shadow: inset 0px 1px 2px rgba(0,0,0,0.3);
outline: none;
border: 1px solid #4d90fe;
}
}
#alt-input-submit {
font-size: 11px;
padding: 2px 6px 3px;
margin: 0 0 0 2px;
height: 21px;
}
}
div#goog-gt-tt {
padding: 10px 14px;
}
.gt-hl-layer {
clear: both;
font-size: 10pt;
position: relative;
text-align: justify;
width: 100%;
}
.goog-text-highlight {
background-color: #c9d7f1;
box-shadow: 2px 2px 4px #9999aa;
box-sizing: border-box;
position: relative;
}

View File

@@ -1,6 +1,6 @@
// CSS Style Guide : https://codeguide.co/#css
// All variables from site's config content.
{{- $P := .Site.Params }}
{{ $P := .Site.Params }}
// Base
$scheme : {{ $P.scheme }};
$darkmode : {{ $P.darkmode }};
@@ -70,6 +70,7 @@ $social_icons_only : {{ $P.socialIcons.iconsOnly }};
$social_icons_transition : {{ $P.socialIcons.transition }};
$links_settings_layout : {{ $P.linksSets.layout }};
$toc_enable : {{ $P.toc.enable }};
$toc_number : {{ $P.toc.number }};
$toc_expand_all : {{ $P.toc.expandAll }};
$toc_wrap : {{ $P.toc.wrap }};
@@ -128,18 +129,18 @@ $disqusjs_enable : false;
$livere_enable : {{ isset $P "livere" }};
$utterances_enable : {{ isset $P "utterances" }};
$waline_enable : {{ isset $P "waline" }};
{{- with .Site.Params.comments }}
{{- $tce := and (isset . "nav") (and .storage (gt (len .nav) 1)) }}
{{ with .Site.Params.comments }}
{{ $tce := and (isset . "nav") (and .storage (gt (len .nav) 1)) }}
$two_comments_enable : {{ $tce }};
{{- if $tce }}
{{- $sortNav := sort .nav "weight" }}
{{ if $tce }}
{{ $sortNav := sort .nav "weight" }}
$two_comments_actived : {{ .active }};
$first_comment_color : {{ (index $sortNav 0).color }};
$first_comment_name : {{ lower (index $sortNav 0).name }};
$second_comment_color : {{ (index $sortNav 1).color }};
$second_comment_name : {{ lower (index $sortNav 1).name }};
{{- end }}
{{- end }}
{{ end }}
{{ end }}
//
// Variables Layer
@@ -174,9 +175,4 @@ $second_comment_name : {{ lower (index $sortNav 1).name }};
// Schemes Layer
// --------------------------------------------------
{{ printf "@import '_schemes/%s/';" $P.scheme }}
// Custom Layer
// TODO
// --------------------------------------------------
// @import 'theme.injects.style';
{{ printf "@import '_schemes/%s/';" $P.scheme }}

View File

@@ -1,4 +1,52 @@
if (!window.NexT) window.NexT = {};
/* global NexT, boot, CONFIG */
window.NexT = {};
NexT.boot = {};
NexT.plugins = {};
// Defined comment component & add register event
NexT.plugins.comments = {};
NexT.plugins.comments.register = function() {
if (!NexT.CONFIG.page.comments) return;
for(var c in NexT.plugins.comments) {
if (c === 'register') continue;
eval('NexT.plugins.comments.'+c)();
};
}
// Defined search engine & add register event
NexT.plugins.search = {}
NexT.plugins.search.register = function() {
for(var s in NexT.plugins.search) {
if (s === 'register') continue;
eval('NexT.plugins.search.'+s)();
};
}
// Defined share plugin & add register event
NexT.plugins.share = {}
NexT.plugins.share.register = function() {
for(var s in NexT.plugins.share) {
if (s === 'register') continue;
eval('NexT.plugins.share.'+s)();
};
}
// Defined other plugin & add register event
NexT.plugins.others = {}
NexT.plugins.others.register = function() {
for(var o in NexT.plugins.others) {
if (o === 'register') continue;
eval('NexT.plugins.others.'+o)();
};
}
// Add event to register all third party plugins
NexT.plugins.register = function() {
for(var p in NexT.plugins) {
if (p === 'register') continue;
eval('NexT.plugins.'+p+'.register')();
}
};
(function() {
const className = 'next-config';

View File

@@ -1,15 +1,36 @@
/* global NexT, CONFIG */
/* boot starup */
NexT.boot = {};
(function () {
const onPageLoaded = () => document.dispatchEvent(
new Event('page:loaded', {
bubbles: true
})
);
NexT.boot.activeThemeMode = function(){
NexT.utils.activeThemeMode();
};
if (document.readyState === 'loading') {
document.addEventListener('readystatechange', onPageLoaded, { once: true });
} else {
onPageLoaded();
}
document.addEventListener('pjax:success', onPageLoaded);
})();
NexT.boot.registerEvents = function() {
NexT.utils.registerImageLoadEvent();
NexT.utils.registerScrollPercent();
// NexT.utils.registerCanIUseTag();
NexT.utils.registerToolButtons();
// Register comment's components
NexT.plugins.register();
// Register comment counter click event
const commentCnt = document.querySelector('#comments-count');
if (commentCnt && NexT.CONFIG.page.isPage) {
commentCnt.addEventListener('click', event => {
NexT.utils.slidScrollBarAnime('comments');
});
}
// Mobile top menu bar.
document.querySelector('.site-nav-toggle .toggle').addEventListener('click', event => {
@@ -37,14 +58,11 @@ NexT.boot.registerEvents = function() {
NexT.boot.refresh = function() {
NexT.utils.calSiteInfo();
NexT.utils.regSwitchThemeBtn();
NexT.utils.fmtSiteInfo();
if (!NexT.CONFIG.page.isPage) return;
NexT.utils.registerSidebarTOC();
NexT.utils.replacePostCRLink();
NexT.utils.registerCopyCode();
NexT.utils.registerPostReward();
if(NexT.CONFIG.page.comments) {
@@ -52,8 +70,9 @@ NexT.boot.refresh = function() {
NexT.utils.registerCommonSwitch();
NexT.utils.domAddClass('#goto-comments', 'goto-comments-on');
} else {
NexT.utils.hideCommontes();
NexT.utils.hideComments();
}
NexT.utils.registerImageViewer();
//TODO
/**
@@ -88,7 +107,6 @@ NexT.boot.motion = function() {
};
document.addEventListener('DOMContentLoaded', () => {
NexT.boot.activeThemeMode();
NexT.boot.registerEvents();
NexT.boot.motion();
NexT.boot.refresh();

View File

@@ -1,13 +1,9 @@
document.addEventListener('DOMContentLoaded', () => {
/* Artalk comment plugin */
NexT.plugins.comments.artalk = function() {
const element = '.artalk-container';
if (!NexT.CONFIG.page.comments
|| !NexT.CONFIG.artalk
if (!NexT.CONFIG.artalk
|| !NexT.utils.checkDOMExist(element)) return;
const artalk_css = NexT.utils.getCDNResource(NexT.CONFIG.artalk.css);
NexT.utils.getStyle(artalk_css, null);
const artalk_js = NexT.utils.getCDNResource(NexT.CONFIG.artalk.js);
const {
site,
@@ -15,10 +11,10 @@ document.addEventListener('DOMContentLoaded', () => {
server,
} = NexT.CONFIG.artalk.cfg;
NexT.utils.loadComments(element)
.then(() => NexT.utils.getScript(artalk_js, {
}))
.then(() => {
NexT.utils.lazyLoadComponent(element, function() {
NexT.utils.getScript(artalk_js, function(){
const artalk_css = NexT.utils.getCDNResource(NexT.CONFIG.artalk.css);
NexT.utils.getStyle(artalk_css);
new Artalk({
el : element,
@@ -29,8 +25,9 @@ document.addEventListener('DOMContentLoaded', () => {
locale : NexT.CONFIG.lang,
placeholder : placeholder,
darkMode : 'auto'
});
});
});
NexT.utils.hiddeLodingCmp(element);
NexT.utils.hiddeLodingCmp(element);
});
});
}

View File

@@ -1,5 +1,5 @@
document.addEventListener('DOMContentLoaded', () => {
/* Giscus comment plugin */
NexT.plugins.comments.giscus = function() {
const element = '.giscus-container';
if (!NexT.CONFIG.page.comments
|| !NexT.CONFIG.giscus
@@ -17,8 +17,8 @@ document.addEventListener('DOMContentLoaded', () => {
theme } = NexT.CONFIG.giscus.cfg;
NexT.utils.loadComments(element)
.then(() => NexT.utils.getScript(NexT.CONFIG.giscus.js, {
NexT.utils.lazyLoadComponent(element, function() {
NexT.utils.getScript(NexT.CONFIG.giscus.js, {
attributes: {
'async' : true,
'crossorigin' : 'anonymous',
@@ -35,7 +35,8 @@ document.addEventListener('DOMContentLoaded', () => {
'data-loading' : 'lazy'
},
parentNode: document.querySelector(element)
}));
});
NexT.utils.hiddeLodingCmp(element);
});
});
}

View File

@@ -1,11 +1,10 @@
document.addEventListener('DOMContentLoaded', () => {
/* LiveRe comment plugin */
NexT.plugins.comments.livere = function() {
const element = '#lv-container';
if (!NexT.CONFIG.page.comments
|| !NexT.CONFIG.livere
if (!NexT.CONFIG.livere
|| !NexT.utils.checkDOMExist(element)) return;
NexT.utils.loadComments(element).then(() => {
NexT.utils.lazyLoadComponent(element, function() {
NexT.utils.getScript(NexT.CONFIG.livere.js, {
attributes: {
async: true
@@ -15,4 +14,4 @@ document.addEventListener('DOMContentLoaded', () => {
NexT.utils.hiddeLodingCmp(element);
});
});
}

View File

@@ -1,8 +1,7 @@
document.addEventListener('DOMContentLoaded', () => {
/* Utterances comment plugin */
NexT.plugins.comments.utterances = function() {
const element = '.utterances-container';
if (!NexT.CONFIG.page.comments
|| !NexT.CONFIG.utterances
if (!NexT.CONFIG.utterances
|| !NexT.utils.checkDOMExist(element)) return;
const {
@@ -11,17 +10,19 @@ document.addEventListener('DOMContentLoaded', () => {
label,
theme } = NexT.CONFIG.utterances.cfg;
NexT.utils.loadComments(element)
.then(() => NexT.utils.getScript(NexT.CONFIG.utterances.js, {
NexT.utils.lazyLoadComponent(element, function() {
NexT.utils.getScript(NexT.CONFIG.utterances.js, {
attributes: {
'async' : true,
'crossorigin' : 'anonymous',
'repo' : repo,
'issue-term' : issueterm,
'label' : label,
'theme' : theme
},
parentNode: document.querySelector(element)
}));
});
NexT.utils.hiddeLodingCmp(element);
});
});
}

View File

@@ -1,11 +1,11 @@
document.addEventListener('DOMContentLoaded', () => {
/* Waline comment plugin */
NexT.plugins.comments.waline = function() {
const element = '.waline-container';
if (!NexT.CONFIG.page.comments
|| !NexT.CONFIG.waline
if (!NexT.CONFIG.waline
|| !NexT.utils.checkDOMExist(element)) return;
const {
comment,
emoji,
imguploader,
pageview,
@@ -19,10 +19,6 @@ document.addEventListener('DOMContentLoaded', () => {
reactiontitle
} = NexT.CONFIG.waline.cfg;
const waline_css = NexT.utils.getCDNResource(NexT.CONFIG.waline.css);
NexT.utils.getStyle(waline_css, null);
const waline_js = NexT.utils.getCDNResource(NexT.CONFIG.waline.js);
let locale = {
@@ -35,15 +31,16 @@ document.addEventListener('DOMContentLoaded', () => {
locale['reaction'+index] = value;
});
NexT.utils.loadComments(element)
.then(() => NexT.utils.getScript(waline_js, {
}))
.then(() => {
NexT.utils.lazyLoadComponent(element, function () {
NexT.utils.getScript(waline_js, function(){
const waline_css = NexT.utils.getCDNResource(NexT.CONFIG.waline.css);
NexT.utils.getStyle(waline_css, 'before');
Waline.init({
locale,
el : element,
pageview : pageview,
comment : comment,
emoji : emoji,
imageUploader : imguploader,
wordLimit : wordlimit,
@@ -55,5 +52,6 @@ document.addEventListener('DOMContentLoaded', () => {
});
NexT.utils.hiddeLodingCmp(element);
})
});
});
}

31
assets/js/third-party/others/counter.js vendored Normal file
View File

@@ -0,0 +1,31 @@
/* Page's view & comment counter plugin */
NexT.plugins.others.counter = function() {
let pageview_js = undefined;
let comment_js = undefined;
const post_meta = NexT.CONFIG.postmeta;
const views = post_meta.views;
if(views != undefined && views.enable) {
if (views.plugin == 'waline') {
pageview_js = NexT.utils.getCDNResource(NexT.CONFIG.page.waline.js[0]);
NexT.utils.getScript(pageview_js, function(){
Waline.pageviewCount({
serverURL: NexT.CONFIG.waline.cfg.serverurl
});
});
}
}
const comments = post_meta.comments;
if (comments != undefined && comments.enable) {
if (comments.plugin == 'waline') {
comment_js = NexT.utils.getCDNResource(NexT.CONFIG.page.waline.js[1]);
NexT.utils.getScript(comment_js, function(){
Waline.commentCount({
serverURL: NexT.CONFIG.waline.cfg.serverurl
});
});
}
}
}

View File

@@ -1,173 +0,0 @@
(function () {
var gtConstEvalStartTime = new Date();
var h = this || self,
l = /^[\w+/_-]+[=]{0,2}$/,
m = null;
function n(a) {
return (a = a.querySelector && a.querySelector("script[nonce]")) && (a = a.nonce || a.getAttribute("nonce")) &&
l.test(a) ? a : ""
}
function p(a, b) {
function c() {}
c.prototype = b.prototype;
a.i = b.prototype;
a.prototype = new c;
a.prototype.constructor = a;
a.h = function (g, f, k) {
for (var e = Array(arguments.length - 2), d = 2; d < arguments.length; d++) e[d - 2] = arguments[d];
return b.prototype[f].apply(g, e)
}
}
function q(a) {
return a
};
function r(a) {
if (Error.captureStackTrace) Error.captureStackTrace(this, r);
else {
var b = Error().stack;
b && (this.stack = b)
}
a && (this.message = String(a))
}
p(r, Error);
r.prototype.name = "CustomError";
function u(a, b) {
a = a.split("%s");
for (var c = "", g = a.length - 1, f = 0; f < g; f++) c += a[f] + (f < b.length ? b[f] : "%s");
r.call(this, c + a[g])
}
p(u, r);
u.prototype.name = "AssertionError";
function v(a, b) {
throw new u("Failure" + (a ? ": " + a : ""), Array.prototype.slice.call(arguments, 1));
};
var w;
function x(a, b) {
this.g = b === y ? a : ""
}
x.prototype.toString = function () {
return this.g + ""
};
var y = {};
function z(a) {
var b = document.getElementsByTagName("head")[0];
b || (b = document.body.parentNode.appendChild(document.createElement("head")));
b.appendChild(a)
}
function _loadJs(a) {
var b = document;
var c = "SCRIPT";
"application/xhtml+xml" === b.contentType && (c = c.toLowerCase());
c = b.createElement(c);
c.type = "text/javascript";
c.charset = "UTF-8";
if (void 0 === w) {
b = null;
var g = h.trustedTypes;
if (g && g.createPolicy) {
try {
b = g.createPolicy("goog#html", {
createHTML: q,
createScript: q,
createScriptURL: q
})
} catch (t) {
h.console && h.console.error(t.message)
}
w = b
} else w = b
}
a = (b = w) ? b.createScriptURL(a) : a;
a = new x(a, y);
a: {
try {
var f = c && c.ownerDocument,
k = f && (f.defaultView || f.parentWindow);
k = k || h;
if (k.Element && k.Location) {
var e = k;
break a
}
} catch (t) {}
e = null
}
if (e && "undefined" != typeof e.HTMLScriptElement && (!c || !(c instanceof e.HTMLScriptElement) && (c instanceof e
.Location || c instanceof e.Element))) {
e = typeof c;
if ("object" == e && null != c || "function" == e) try {
var d = c.constructor.displayName || c.constructor.name || Object.prototype.toString.call(c)
} catch (t) {
d = "<object could not be stringified>"
} else d = void 0 === c ? "undefined" : null === c ? "null" : typeof c;
v("Argument is not a %s (or a non-Element, non-Location mock); got: %s",
"HTMLScriptElement", d)
}
a instanceof x && a.constructor === x ? d = a.g : (d = typeof a, v(
"expected object of type TrustedResourceUrl, got '" + a + "' of type " + ("object" != d ? d : a ?
Array.isArray(a) ? "array" : d : "null")), d = "type_error:TrustedResourceUrl");
c.src = d;
(d = c.ownerDocument && c.ownerDocument.defaultView) && d != h ? d = n(d.document) : (null === m && (m = n(
h.document)), d = m);
d && c.setAttribute("nonce", d);
z(c)
}
function _loadCss(a) {
var b = document.createElement("link");
b.type = "text/css";
b.rel = "stylesheet";
b.charset = "UTF-8";
b.href = a;
z(b)
}
function _isNS(a) {
a = a.split(".");
for (var b = window, c = 0; c < a.length; ++c)
if (!(b = b[a[c]])) return !1;
return !0
}
function _setupNS(a) {
a = a.split(".");
for (var b = window, c = 0; c < a.length; ++c) b.hasOwnProperty ? b.hasOwnProperty(a[c]) ? b = b[a[c]] : b =
b[a[c]] = {} : b = b[a[c]] || (b[a[c]] = {});
return b
}
window.addEventListener && "undefined" == typeof document.readyState && window.addEventListener(
"DOMContentLoaded",
function () {
document.readyState = "complete"
}, !1);
if (_isNS('google.translate.Element')) {
return
}(function () {
var c = _setupNS('google.translate._const');
c._cest = gtConstEvalStartTime;
gtConstEvalStartTime = undefined;
c._cl = navigator.language || navigator.userLanguage;
c._cuc = 'googleTranslateElementInit';
c._cac = '';
c._cam = '';
c._ctkk = '449649.3822363247';
var h = 'translate.googleapis.com';
var s = (true ? 'https' : window.location.protocol == 'https:' ? 'https' : 'http') + '://';
var b = s + h;
c._pah = h;
c._pas = s;
// c._pbi = b + '/translate_static/img/te_bk.gif';
c._pbi = '';
c._pci = b + '/translate_static/img/te_ctrl3.gif';
c._pli = b + '/translate_static/img/loading.gif';
c._plla = h + '/translate_a/l';
c._pmi = b + '/translate_static/img/mini_google.png';
c._ps = window.translateelement_styles;
c._puh = 'translate.google.cn';
_loadCss(c._ps);
_loadJs(b + `/translate_static/js/element/main_${navigator.language || navigator.userLanguage}.js`);
})();
})();
function googleTranslateElementInit(){
new google.translate.TranslateElement({
includedLanguages: 'zh-CN,zh-TW,en,ru',
autoDisplay:false
},'google_translate_element');
}

View File

@@ -0,0 +1,17 @@
/* 51La sidebar data widget */
NexT.plugins.others.lawidget = function() {
const element = '#siteinfo-card-widget';
const lawt_js = NexT.CONFIG.lawidget.js.replace('laId', NexT.CONFIG.lawidget.id);
NexT.utils.lazyLoadComponent(element, function () {
NexT.utils.getScript(lawt_js,{
attributes: {
id: 'LA-DATA-WIDGET',
crossorigin: 'anonymous',
charset: 'UTF-8',
defer: true
},
parentNode: document.getElementById('la-siteinfo-widget')
}, NexT.utils.fmtLaWidget());
});
}

38
assets/js/third-party/others/math.js vendored Normal file
View File

@@ -0,0 +1,38 @@
/* Math render plugin */
NexT.plugins.others.math = function() {
const render = NexT.CONFIG.page.math.render;
if (render === 'mathjax') {
const render_js = NexT.utils.getCDNResource(NexT.CONFIG.page.math.js);
NexT.utils.getScript(render_js, function(){
window.MathJax = {
tex: {
inlineMath: [["$", "$"]],
}
};
});
}
if (render === 'katex') {
const render_css = NexT.utils.getCDNResource(NexT.CONFIG.page.math.css);
NexT.utils.getStyle(render_css);
const render_js_list = NexT.CONFIG.page.math.js;
render_js_list.forEach(js => {
const js_loader = NexT.utils.getScript(NexT.utils.getCDNResource(js));
if(js.name === 'auto-render') {
js_loader.then(function(){
renderMathInElement(document.body, {
delimiters: [
{left: '$$', right: '$$', display: true},
{left: '$', right: '$', display: false},
{left: '\\(', right: '\\)', display: false},
{left: '\\[', right: '\\]', display: true}
],
throwOnError : false
})
});
}
});
}
}

15
assets/js/third-party/others/mermaid.js vendored Normal file
View File

@@ -0,0 +1,15 @@
/* Mermaid plugin */
NexT.plugins.others.mermaid = function() {
const mermaid_js = NexT.utils.getCDNResource(NexT.CONFIG.page.mermaid.js);
NexT.utils.getScript(mermaid_js, function(){
mermaid.initialize({
sequence: {
showSequenceNumbers: true,
actorMargin: 50,
diagramMarginX:10,
diagramMarginY:10
}
});
});
}

View File

@@ -0,0 +1,9 @@
/* Google translate plugin */
NexT.plugins.others.translate = function() {
const element = '#gtranslate';
if (!NexT.utils.checkDOMExist(element)) return;
NexT.utils.lazyLoadComponent(element, function() {
window.translateelement_styles='/css/google-translate.min.css';
NexT.utils.getScript('/js/third-party/google-translate.min.js');
});
}

View File

@@ -1,12 +1,11 @@
/* global instantsearch, algoliasearch, CONFIG, pjax */
/* Algolia search engine */
NexT.plugins.search.algolia = function() {
document.addEventListener('DOMContentLoaded', () => {
const algoiajs = NexT.utils.getCDNResource(NexT.CONFIG.algolia.js);
const algoliajs = NexT.utils.getCDNResource(NexT.CONFIG.algolia.js);
const instantschjs = NexT.utils.getCDNResource(NexT.CONFIG.algolia.instantjs);
NexT.utils.getScript(algoiajs, {});
NexT.utils.getScript(instantschjs, {}).then(() => {
NexT.utils.getScript(algoliajs);
NexT.utils.getScript(instantschjs, function() {
const { indexname, appid, apikey, hits } = NexT.CONFIG.algolia.cfg;
const indexName = indexname;
@@ -56,7 +55,7 @@ document.addEventListener('DOMContentLoaded', () => {
const stats = NexT.CONFIG.i18n.hits_time
.replace('${hits}', data.nbHits)
.replace('${time}', data.processingTimeMS);
return `<span>${stats}</span><img src="/imgs/algolia-logo.svg" alt="Algolia">`;
return `${stats}`;
}
},
cssClasses: {
@@ -138,7 +137,6 @@ document.addEventListener('DOMContentLoaded', () => {
onPopupClose();
}
});
});;
});
});
}

View File

@@ -1,4 +1,4 @@
/* global CONFIG, pjax, LocalSearch */
/* LocalSearch engine */
class LocalSearch {
constructor({
path = '',
@@ -227,7 +227,7 @@ class LocalSearch {
}
}
document.addEventListener('DOMContentLoaded', () => {
NexT.plugins.search.localsearch = function() {
if (! NexT.CONFIG.localSearch.path) {
// Search DB path
console.warn('`search indexes file` is not configurate!');
@@ -323,4 +323,4 @@ document.addEventListener('DOMContentLoaded', () => {
onPopupClose();
}
});
});
}

View File

@@ -1,16 +1,16 @@
document.addEventListener('DOMContentLoaded', () => {
/* AddThis share plugin */
NexT.plugins.share.addthis = function() {
const element = '.addthis_inline_share_toolbox';
if (!NexT.CONFIG.addthis || !NexT.utils.checkDOMExist(element)) return;
const addthis_js = NexT.CONFIG.addthis.js + '?pubid=' + NexT.CONFIG.addthis.cfg.pubid;
NexT.utils.loadComments(element).then(() => {
NexT.utils.lazyLoadComponent(element, function() {
NexT.utils.getScript(addthis_js, {
attributes: {
async: true
async: false
},
parentNode: document.querySelector(element)
});
});
});
}

View File

@@ -1,103 +1,75 @@
/* global NexT, CONFIG */
/* util tools */
HTMLElement.prototype.wrap = function(wrapper) {
HTMLElement.prototype.wrap = function (wrapper) {
this.parentNode.insertBefore(wrapper, this);
this.parentNode.removeChild(this);
wrapper.appendChild(this);
};
(function() {
const onPageLoaded = () => document.dispatchEvent(
new Event('page:loaded', {
bubbles: true
})
);
if (document.readyState === 'loading') {
document.addEventListener('readystatechange', onPageLoaded, { once: true });
} else {
onPageLoaded();
}
document.addEventListener('pjax:success', onPageLoaded);
})();
NexT.utils = {
regSwitchThemeBtn: function() {
const switchThemeBtn = document.getElementById('switch-theme');
if (!switchThemeBtn) return;
switchThemeBtn.addEventListener('click', () => {
const colorTheme = document.documentElement.getAttribute('data-theme');
NexT.utils.toggleDarkMode(!(colorTheme == 'dark'));
});
},
activeThemeMode: function() {
const useDark = window.matchMedia("(prefers-color-scheme: dark)");
let darkModeState = NexT.CONFIG.darkmode || useDark.matches;
const localState = NexT.utils.getLocalStorage('theme');
if (localState == 'light'
|| (localState == undefined && !NexT.CONFIG.darkmode)) {
darkModeState = false;
}
NexT.utils.toggleDarkMode(darkModeState);
useDark.addListener(function(evt) {
toggleDarkMode(evt.matches);
registerImageLoadEvent: function() {
const images = document.querySelectorAll('.sidebar img, .post-block img, .vendors-list img');
const callback = (entries) => {
entries.forEach(item => {
if (item.intersectionRatio > 0) {
let ele = item.target;
let imgSrc = ele.getAttribute('data-src');
if (imgSrc) {
let img = new Image();
img.addEventListener('load', function() {
ele.src = imgSrc;
}, false);
ele.src = imgSrc;
// Prevent load image again
ele.removeAttribute('data-src');
}
}
})
};
const observer = new IntersectionObserver(callback);
images.forEach(img => {
observer.observe(img);
});
},
toggleDarkMode: function(state) {
if(state) {
document.documentElement.setAttribute('data-theme', 'dark');
NexT.utils.setLocalStorage('theme', 'dark', 2);
} else {
document.documentElement.setAttribute('data-theme', 'light');
NexT.utils.setLocalStorage('theme', 'light', 2);
}
const theme = state ? 'dark' : 'light';
NexT.utils.toggleGiscusDarkMode(theme);
registerImageViewer: function() {
new Viewer(document.querySelector('.post-body'),{ navbar:2, toolbar:2 });
},
toggleGiscusDarkMode: function(theme) {
const iframe = document.querySelector('iframe.giscus-frame');
if (iframe) {
const config = { setConfig: { theme: theme } };
iframe.contentWindow.postMessage({ giscus: config }, 'https://giscus.app');
}
registerToolButtons: function () {
const buttons = document.querySelector('.tool-buttons');
const scrollbar_buttons = buttons.querySelectorAll('div:not(#toggle-theme)');
scrollbar_buttons.forEach(button => {
let targetId = button.id;
if (targetId != '') {
targetId = targetId.substring(5);
}
button.addEventListener('click', () => {
this.slidScrollBarAnime(targetId);
});
});
buttons.querySelector('div#toggle-theme').addEventListener('click', () => {
const cur_theme = document.documentElement.getAttribute('data-theme');
window.theme.toggle(cur_theme === 'dark' ? 'light' : 'dark');
});
},
setLocalStorage: function(key, value, ttl) {
if (ttl === 0) return;
const now = new Date();
const expiryDay = ttl * 86400000;
const item = {
value: value,
expiry: now.getTime() + expiryDay
};
localStorage.setItem(key, JSON.stringify(item));
slidScrollBarAnime: function (targetId, easing = 'linear', duration = 500) {
const targetObj = document.getElementById(targetId);
window.anime({
targets: document.scrollingElement,
duration: duration,
easing: easing,
scrollTop: targetId == '' || !targetObj ? 0 : targetObj.getBoundingClientRect().top + window.scrollY
});
},
getLocalStorage: function(key) {
const itemStr = localStorage.getItem(key);
if (!itemStr) {
return undefined;
}
const item = JSON.parse(itemStr);
const now = new Date();
if (now.getTime() > item.expiry) {
localStorage.removeItem(key);
return undefined;
}
return item.value;
},
domAddClass: function(selector, cls) {
domAddClass: function (selector, cls) {
const doms = document.querySelectorAll(selector);
if (doms) {
doms.forEach(dom => {
@@ -106,24 +78,24 @@ NexT.utils = {
}
},
calSiteInfo: function() {
fmtSiteInfo: function () {
const runtimeCount = document.getElementById('runTimes');
if (runtimeCount) {
const publishDate = runtimeCount.getAttribute('data-publishDate');
const runTimes = NexT.utils.diffDate(publishDate, 2);
const runTimes = this.diffDate(publishDate, 2);
runtimeCount.innerText = runTimes;
}
const wordsCount = document.getElementById('wordsCount');
if (wordsCount) {
const words = wordsCount.getAttribute('data-count');
wordsCount.innerText = NexT.utils.numberFormat(words);
wordsCount.innerText = this.numberFormat(words);
}
const readTimes = document.getElementById('readTimes');
if (readTimes) {
const times = readTimes.getAttribute('data-times');
const hour = 60;
const day = hour * 24;
@@ -132,7 +104,7 @@ NexT.utils = {
let timesLabel;
if (daysCount >= 1) {
timesLabel = daysCount + NexT.CONFIG.i18n.ds_days + parseInt((times - daysCount * day)/hour) + NexT.CONFIG.i18n.ds_hours;
timesLabel = daysCount + NexT.CONFIG.i18n.ds_days + parseInt((times - daysCount * day) / hour) + NexT.CONFIG.i18n.ds_hours;
} else if (hoursCount >= 1) {
timesLabel = hoursCount + NexT.CONFIG.i18n.ds_hours + (times - hoursCount * hour) + NexT.CONFIG.i18n.ds_mins;
} else {
@@ -144,40 +116,44 @@ NexT.utils = {
const lastPushDate = document.getElementById('last-push-date');
if (lastPushDate) {
const pushDateVal = NexT.utils.diffDate(lastPushDate.getAttribute('data-lastPushDate'), 1);
const pushDateVal = this.diffDate(lastPushDate.getAttribute('data-lastPushDate'), 1);
lastPushDate.innerText = pushDateVal;
}
},
const statisWidget = document.querySelectorAll('#la-siteinfo-widget span');
if (statisWidget.length > 0) {
const valIds = [0,2,4,6];
const domIds = ['today_site_pv', 'yesterday_site_pv', 'month_site_pv', 'total_site_pv']
for (var i in valIds) {
let pv = NexT.utils.numberFormat(statisWidget[valIds[i]].innerText);
document.getElementById(domIds[i]).innerText = pv;
fmtLaWidget: function(){
setTimeout(function(){
const laWidget = document.querySelectorAll('#la-siteinfo-widget span');
if (laWidget.length > 0) {
const valIds = [0, 2, 4, 6];
const domIds = ['today_site_pv', 'yesterday_site_pv', 'month_site_pv', 'total_site_pv']
for (let i in valIds) {
let pv = NexT.utils.numberFormat(laWidget[valIds[i]].innerText);
document.getElementById(domIds[i]).innerText = pv;
}
}
}
setTimeout(()=>{ NexT.utils.fmtBusuanzi(); }, 500);
}, 800);
},
fmtBusuanzi: function() {
const bszUV = document.getElementById('busuanzi_value_site_uv');
if (bszUV) {
bszUV.innerText = NexT.utils.numberFormat(bszUV.innerText);
}
const bszPV = document.getElementById('busuanzi_value_site_pv');
if (bszPV) {
bszPV.innerText = NexT.utils.numberFormat(bszPV.innerText);
}
fmtBusuanzi: function () {
setTimeout(function(){
const bszUV = document.getElementById('busuanzi_value_site_uv');
if (bszUV) {
bszUV.innerText = NexT.utils.numberFormat(bszUV.innerText);
}
const bszPV = document.getElementById('busuanzi_value_site_pv');
if (bszPV) {
bszPV.innerText = NexT.utils.numberFormat(bszPV.innerText);
}
}, 800);
},
numberFormat: function(number) {
numberFormat: function (number) {
let result;
if (number.indexOf(',') > 0) {
number = number.replaceAll(",", "");
}
if (number > 10000) {
result = (number / 10000.0).toFixed(2) + ' w';
} else if (number > 1000) {
@@ -188,7 +164,7 @@ NexT.utils = {
return result;
},
diffDate: function(date, mode = 0) {
diffDate: function (date, mode = 0) {
const dateNow = new Date();
const datePost = new Date(date);
const dateDiff = dateNow.getTime() - datePost.getTime();
@@ -218,15 +194,15 @@ NexT.utils = {
} else {
result = NexT.CONFIG.i18n.ds_just;
}
} else if (mode == 2) {
} else if (mode == 2) {
const yearCount = parseInt(dateDiff / year);
if (yearCount >= 1) {
const dayCount = parseInt((dateDiff - (yearCount * year))/day);
const dayCount = parseInt((dateDiff - (yearCount * year)) / day);
result = yearCount + NexT.CONFIG.i18n.ds_years + dayCount + NexT.CONFIG.i18n.ds_days;
} else {
const dayCount = parseInt(dateDiff/day);
const dayCount = parseInt(dateDiff / day);
result = dayCount + NexT.CONFIG.i18n.ds_days;
}
}
} else {
result = parseInt(dateDiff / day);
}
@@ -234,20 +210,26 @@ NexT.utils = {
return result;
},
checkDOMExist: function(selector) {
checkDOMExist: function (selector) {
return document.querySelector(selector) != null;
},
getCDNResource: function(res) {
getCDNResource: function (res) {
let { plugins, router } = NexT.CONFIG.vendor;
let { name, version, file, alias } = res;
let { name, version, file, alias, alias_name } = res;
let npm_name = name;
if (alias_name) npm_name = alias_name;
let res_src = '';
switch(plugins) {
switch (plugins) {
case 'cdnjs':
case 'bootcdn':
case 'qiniu':
let cdnjs_name = alias || name;
let cdnjs_file = file.replace(/\.js$/, '.min.js').replace(/^(dist|lib|source\/js|)\/(browser\/|)/, '');
let cdnjs_file = file.replace(/^(dist|lib|source|\/js|)\/(browser\/|)/, '');
if (cdnjs_file.indexOf('min') == -1) {
cdnjs_file = cdnjs_file.replace(/\.js$/, '.min.js');
}
res_src = `${router}/${cdnjs_name}/${version}/${cdnjs_file}`
break;
default:
@@ -257,23 +239,10 @@ NexT.utils = {
return res_src;
},
replacePostCRLink: function() {
if (NexT.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.
*/
registerCopyCode: function() {
registerCopyCode: function () {
if (!NexT.CONFIG.copybtn) return;
let figure = document.querySelectorAll('.highlight pre');
@@ -320,7 +289,7 @@ NexT.utils = {
});
},
wrapTableWithBox: function() {
wrapTableWithBox: function () {
document.querySelectorAll('table').forEach(element => {
const box = document.createElement('div');
box.className = 'table-container';
@@ -328,7 +297,7 @@ NexT.utils = {
});
},
registerVideoIframe: function() {
registerVideoIframe: function () {
document.querySelectorAll('iframe').forEach(element => {
const supported = [
'www.youtube.com',
@@ -350,7 +319,7 @@ NexT.utils = {
});
},
registerScrollPercent: function() {
registerScrollPercent: function () {
const backToTop = document.querySelector('.back-to-top');
const readingProgressBar = document.querySelector('.reading-progress-bar');
// For init back to top in sidebar if page was scrolled after page refresh.
@@ -360,7 +329,7 @@ NexT.utils = {
const scrollPercent = contentHeight > 0 ? Math.min(100 * window.scrollY / contentHeight, 100) : 0;
if (backToTop) {
const scrollPercentRound = Math.round(scrollPercent)
const isShow = scrollPercentRound >= 5;
const isShow = scrollPercentRound >= 5;
backToTop.classList.toggle('back-to-top-on', isShow);
backToTop.querySelector('span').innerText = scrollPercentRound + '%';
}
@@ -379,21 +348,12 @@ NexT.utils = {
}
this.activateNavByIndex(index);
}, { passive: true });
backToTop && backToTop.addEventListener('click', () => {
window.anime({
targets : document.scrollingElement,
duration : 500,
easing : 'linear',
scrollTop: 0
});
});
},
/**
* Tabs tag listener (without twitter bootstrap).
*/
registerTabsTag: function() {
registerTabsTag: function () {
// Binding `nav-tabs` & `tab-content` by real time permalink changing.
document.querySelectorAll('.tabs ul.nav-tabs .tab').forEach(element => {
element.addEventListener('click', event => {
@@ -408,7 +368,7 @@ NexT.utils = {
// https://stackoverflow.com/questions/20306204/using-queryselector-with-ids-that-are-numbers
const tActive = document.getElementById(element.querySelector('a').getAttribute('href').replace('#', ''));
[...tActive.parentNode.children].forEach(target => {
// Array.prototype.slice.call(tActive.parentNode.children).forEach(target => {
// Array.prototype.slice.call(tActive.parentNode.children).forEach(target => {
target.classList.toggle('active', target === tActive);
});
// Trigger event
@@ -418,9 +378,9 @@ NexT.utils = {
if (!NexT.CONFIG.stickytabs) return;
const offset = nav.parentNode.getBoundingClientRect().top + window.scrollY + 10;
window.anime({
targets : document.scrollingElement,
duration : 500,
easing : 'linear',
targets: document.scrollingElement,
duration: 500,
easing: 'linear',
scrollTop: offset
});
});
@@ -429,7 +389,7 @@ NexT.utils = {
window.dispatchEvent(new Event('tabs:register'));
},
registerCanIUseTag: function() {
registerCanIUseTag: function () {
// Get responsive height passed from iframe.
window.addEventListener('message', ({ data }) => {
if (typeof data === 'string' && data.includes('ciu_embed')) {
@@ -447,7 +407,7 @@ NexT.utils = {
target.classList.toggle('menu-item-active', target.hostname === location.hostname && (isSamePath || isSubPath));
});
},
registerLangSelect: function() {
const selects = document.querySelectorAll('.lang-select');
selects.forEach(sel => {
@@ -463,19 +423,25 @@ NexT.utils = {
});
},*/
registerSidebarTOC: function() {
this.sections = [...document.querySelectorAll('.post-toc li a.nav-link')].map(element => {
registerSidebarTOC: function () {
const toc = document.getElementById('TableOfContents');
if (!toc.hasChildNodes()) {
const tocActive = document.querySelector('.sidebar-inner');
tocActive.classList.remove('sidebar-nav-active', 'sidebar-toc-active');
tocActive.classList.add('sidebar-overview-active');
}
this.sections = [...document.querySelectorAll('.post-toc li a')].map(element => {
const target = document.getElementById(decodeURI(element.getAttribute('href')).replace('#', ''));
// TOC item animation navigate.
element.addEventListener('click', event => {
event.preventDefault();
const offset = target.getBoundingClientRect().top + window.scrollY;
window.anime({
targets : document.scrollingElement,
duration : 500,
easing : 'linear',
targets: document.scrollingElement,
duration: 500,
easing: 'linear',
scrollTop: offset,
complete : () => {
complete: () => {
history.pushState(null, document.title, element.href);
}
});
@@ -484,7 +450,7 @@ NexT.utils = {
});
},
registerPostReward: function() {
registerPostReward: function () {
const button = document.querySelector('.reward-container button');
if (!button) return;
button.addEventListener('click', () => {
@@ -492,22 +458,22 @@ NexT.utils = {
});
},
initCommontesDispaly: function(){
initCommontesDispaly: function () {
const comms = document.querySelectorAll('.comment-wrap > div');
if (comms.length<=1) return;
comms.forEach(function(item){
var dis = window.getComputedStyle(item, null).display;
if (comms.length <= 1) return;
comms.forEach(function (item) {
let dis = window.getComputedStyle(item, null).display;
item.style.display = dis;
});
},
registerCommonSwitch: function() {
registerCommonSwitch: function () {
const button = document.querySelector('.comment-switch .switch-btn');
if (!button) return;
const comms = document.querySelectorAll('.comment-wrap > div');
button.addEventListener('click', () => {
button.classList.toggle('move');
comms.forEach(function(item){
comms.forEach(function (item) {
if (item.style.display === 'none') {
item.style.cssText = "display: block; animation: tabshow .8s";
} else {
@@ -517,17 +483,20 @@ NexT.utils = {
});
},
hideCommontes:function() {
document.querySelector('.post-comments').style.display = 'none';
hideComments: function () {
let postComments = document.querySelector('.post-comments');
if (postComments !== null) {
postComments.style.display = 'none';
}
},
hiddeLodingCmp: function(selector) {
hiddeLodingCmp: function (selector) {
const loadding = document.querySelector(selector).previousElementSibling;
loadding.style.display = 'none';
},
activateNavByIndex: function(index) {
const target = document.querySelectorAll('.post-toc li a.nav-link')[index];
activateNavByIndex: function (index) {
const target = document.querySelectorAll('.post-toc li a')[index];
if (!target || target.classList.contains('active-current')) return;
document.querySelectorAll('.post-toc .active').forEach(element => {
@@ -543,14 +512,14 @@ NexT.utils = {
const tocElement = document.querySelector('.sidebar-panel-container');
if (!tocElement.parentNode.classList.contains('sidebar-toc-active')) return;
window.anime({
targets : tocElement,
duration : 200,
easing : 'linear',
targets: tocElement,
duration: 200,
easing: 'linear',
scrollTop: tocElement.scrollTop - (tocElement.offsetHeight / 2) + target.getBoundingClientRect().top - tocElement.getBoundingClientRect().top
});
},
updateSidebarPosition: function() {
updateSidebarPosition: function () {
if (window.innerWidth < 992 || NexT.CONFIG.scheme === 'Pisces' || NexT.CONFIG.scheme === 'Gemini') return;
// Expand sidebar on post detail page by default, when post has a toc.
const hasTOC = document.querySelector('.post-toc');
@@ -564,7 +533,7 @@ NexT.utils = {
}
},
activateSidebarPanel: function(index) {
activateSidebarPanel: function (index) {
const duration = 200;
const sidebar = document.querySelector('.sidebar-inner');
const panel = document.querySelector('.sidebar-panel-container');
@@ -574,34 +543,39 @@ NexT.utils = {
window.anime({
duration,
targets : panel,
easing : 'linear',
opacity : 0,
targets: panel,
easing: 'linear',
opacity: 0,
translateY: [0, -20],
complete : () => {
complete: () => {
// Prevent adding TOC to Overview if Overview was selected when close & open sidebar.
sidebar.classList.replace(activeClassName[1 - index], activeClassName[index]);
window.anime({
duration,
targets : panel,
easing : 'linear',
opacity : [0, 1],
targets: panel,
easing: 'linear',
opacity: [0, 1],
translateY: [-20, 0]
});
}
});
},
getStyle: function(src, parent) {
getStyle: function (src, position='after', parent) {
const link = document.createElement('link');
link.setAttribute('rel', 'stylesheet');
link.setAttribute('type', 'text/css');
link.setAttribute('href', src);
(parent || document.head).appendChild(link);
const head = (parent || document.head);
if (position === 'before') {
head.prepend(link);
} else {
head.append(link);
}
},
getScript: function(src, options = {}, legacyCondition) {
getScript: function (src, options = {}, legacyCondition) {
if (typeof options === 'function') {
return this.getScript(src, {
condition: legacyCondition
@@ -619,7 +593,7 @@ NexT.utils = {
} = {},
parentNode = null
} = options;
return new Promise((resolve, reject) => {
if (condition) {
resolve();
@@ -653,9 +627,9 @@ NexT.utils = {
});
},
loadComments: function(selector, legacyCallback) {
lazyLoadComponent: function(selector, legacyCallback) {
if (legacyCallback) {
return this.loadComments(selector).then(legacyCallback);
return this.lazyLoadComponent(selector).then(legacyCallback);
}
return new Promise(resolve => {
const element = document.querySelector(selector);
@@ -673,4 +647,4 @@ NexT.utils = {
intersectionObserver.observe(element);
});
}
};
};

View File

@@ -1,3 +1,5 @@
# Hugo NexT theme's custom config
version: 4.3.1
version: 4.5.0
domain: hugo-next.eu.org

View File

@@ -3,6 +3,8 @@
vendors:
cdnjs: "https://cdnjs.cloudflare.com/ajax/libs"
unpkg: "https://unpkg.com"
bootcdn: "https://cdn.bootcdn.net/ajax/libs"
qiniu: "https://cdn.staticfile.org"
# JavaScript 资源
# JavaScript Resources
@@ -10,6 +12,9 @@ js:
- name: animejs
version: 3.2.1
file: lib/anime.min.js
- name: viewerjs
version: 1.11.0
file: dist/viewer.min.js
# CSS 资源
# CSS Resources
@@ -21,6 +26,9 @@ css:
- name: animate.css
version: 3.1.1
file: animate.min.css
- name: viewerjs
version: 1.11.0
file: dist/viewer.min.css
# 第三方服务组件资源
# 3rd servcies Resource
@@ -44,12 +52,12 @@ addthis:
waline:
js:
name: '@waline/client'
version: 2.11.3
version: 2.13.0
file: dist/waline.js
alias: waline
css:
name: '@waline/client'
version: 2.11.3
version: 2.13.0
file: dist/waline.css
alias: waline
@@ -76,38 +84,49 @@ livere:
# Full text search
algolia:
name: algoliasearch
version: 4.13.0
version: 4.14.2
file: dist/algoliasearch-lite.umd.js
instant:
name: instantsearch.js
version: 4.40.5
version: 4.49.0
file: dist/instantsearch.production.min.js
plugins:
# 数学公式渲染
mathjax:
js:
- name: mathjax
version: 3.2.0
file: es5/tex-mml-chtml.js
name: mathjax
version: 3.2.0
file: es5/tex-mml-chtml.js
katex:
js:
- name: katex
version: 0.16.0
file: dist/katex.min.js
- name: auto-render
alias2: katex
alias_name: katex
version: 0.16.0
file: dist/contrib/auto-render.min.js
css:
- name: katex
version: 0.16.0
file: dist/katex.min.css
name: katex
version: 0.16.0
file: dist/katex.min.css
# 画图渲染
mermaid:
js:
- name: mermaid
version: 9.1.7
file: dist/mermaid.min.js
name: mermaid
version: 9.1.7
file: dist/mermaid.min.js
# 文章访问/评论统计
waline:
js:
- name: pageview
alias_name: '@waline/client'
version: 2.13.0
file: dist/pageview.js
alias: waline
- name: comment
alias_name: '@waline/client'
version: 2.13.0
file: dist/comment.js
alias: waline

View File

@@ -39,10 +39,6 @@ markup:
renderer:
unsafe: true
highlight:
# codeFences: true
# lineNos: true
# lineNumbersInTable: true
# noClasses: true
# # 高亮代码的样式名称可选monokai | emacs | api | dracula | friendly
# # 更多的样式https://xyproto.github.io/splash/docs/all.html
# # Highlight style: monokai | emacs | api | dracula | friendly
@@ -107,6 +103,7 @@ enableRobotsTXT: true
# 强制输出时压缩文件
# Compress all files when output
minify:
minifyOutput: true
#--------------------------------------
# 菜单配置说明
@@ -301,12 +298,12 @@ params:
# Posts / Categories / Tags in sidebar.
basic: true
# 站点访问信息
# Site information
statistic:
# Site's view information
views:
enable: true
# 组件类型,可选值为: 51la, busuanzi
# 使用51la时需要注册账号https://invite.51.la/1NUfGTS1?target=V6
# Plguin value is: 51la, busuzazi
# 使用51la时需要注册账号https://invite.51.la/
# Plguin value is: 51la, busuanzi
plugin: busuanzi
# 社交链接地址
@@ -481,6 +478,18 @@ params:
categories: true
wordCount: true
readTime: true
# 是否开启评论数显示
comments:
enable: true
# 评论统计插件暂只支持waline
# Comment counter plugin, only support waline
plugin: waline
# 是否开启页面访问数显示
views:
enable: true
# 页面访问统计插件支持busuanzi, waline, leancloud
# Page views counter plugin, support: busuanzi, waline, leancloud
plugin: busuanzi
# 文章底部的设置
# Post footer settings
@@ -813,7 +822,8 @@ params:
# Waline comments system
# More info seee: https://waline.js.org/
waline:
pageView: '#waline-pageview-count'
pageView: true
comment: true
placeholder: "请文明发言哟 ヾ(≧▽≦*)o"
sofa: "快来发表你的意见吧 (≧∀≦)ゞ"
emoji: false
@@ -939,8 +949,6 @@ params:
busuanzi:
visitorsIcon: fa fa-user
viewsIcon: fa fa-eye
postViews: true
# ---------------------------------------------------------------
# 内容搜索服务
@@ -1095,14 +1103,15 @@ params:
# ---------------------------------------------------------------
vendors:
vendors:
# The CDN provider of NexT internal scripts.
# Available values: local | unpkg | cdnjs | custom
# Available values: local | unpkg | cdnjs | qiniu | bootcdn | custom
# Warning: If you are using the latest master branch of NexT, please set `internal: local`
internal: local
# The default CDN provider of third-party plugins.
# Available values: local | unpkg | cdnjs | custom
# Available values: local | unpkg | cdnjs| qiniu | bootcdn | custom
# Dependencies for `plugins: local`: https://github.com/next-theme/plugins
plugins: unpkg
plugins: qiniu
# TODO
# Custom CDN URL
# For example:

View File

@@ -7,7 +7,8 @@ date: 2022-09-10T21:02:32+08:00
lastmod: 2022-09-10T21:02:32+08:00
categories:
- 示例
- 示例文章
tags:
- 自定义
- 个性化

View File

@@ -7,7 +7,9 @@ date: 2022-06-04T19:46:45+08:00
lastmod: 2022-06-04T19:46:45+08:00
categories:
- 示例
- 示例文章
- 语法
tags:
- 表情
- emoji

View File

@@ -7,7 +7,7 @@ date: 2022-06-01T15:59:41+08:00
lastmod: 2022-06-01T15:59:41+08:00
categories:
- 示例
- 示例文章
tags:
- Hugo
- NexT

View File

@@ -6,10 +6,11 @@ lastmod: 2022-06-03T16:43:23+08:00
date: 2022-06-02T11:52:03+08:00
categories:
- 博客
- 开始建站
tags:
- Hugo
- 开始
- Hugo
- 开始
url: post/hello-world.html
toc: true

View File

@@ -10,7 +10,9 @@ author: Mainroad
originLink: https://mainroad-demo.netlify.app/post/basic-elements/
categories:
- 示例
- 示例文章
- 语法
tags:
- Markdown
- 语法

View File

@@ -7,7 +7,8 @@ date: 2022-09-11T10:16:02+08:00
lastmod: 2022-09-11T10:16:02+08:00
categories:
- 示例
- 第三方引入
- 数学公式
tags:
- 数学公式
- mathjax
@@ -32,25 +33,25 @@ math: mathjax
{{< /note >}}
**注意:** 使用[支持的TeX功能](https://docs.mathjax.org/en/latest/input/tex/index.html)的联机参考资料。
**注意:** 使用[支持的TeX功能](https://docs.mathjax.org/en/latest/input/tex/index.html)的联机参考资料。
### 例子
## 例子
## 重复的分数
### 重复的分数
$$
\frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} \equiv 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}} {1+\frac{e^{-8\pi}} {1+\cdots} } } }
$$
## 总和记号
### 总和记号
$$
\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)
$$
## 几何级数之和
我把接下来的两个例子分成了几行,这样它在手机上表现得更好。这就是为什么它们包含 `\displaystyle`
### 几何级数之和
我把接下来的两个例子分成了几行,这样它在手机上表现得更好。这就是为什么它们包含 `\displaystyle`或者可使用类似 `\displaylines{x = a + b \\\ y = b + c}` 语法进行截断,具体信息可见:[mathjax-issues2312](https://github.com/mathjax/MathJax/issues/2312)
$$
\displaystyle\sum_{i=1}^{k+1}i
@@ -76,31 +77,36 @@ $$
\displaystyle= \frac{(k+1)((k+1)+1)}{2}
$$
## 乘记号
### 乘记号
$$
\displaystyle 1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots = \displaystyle \prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})}, \displaystyle\text{ for }\lvert q\rvert < 1.
\displaystyle 1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots =
$$
$$
\displaystyle \prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})},
\displaystyle\text{ for }\lvert q\rvert < 1.
$$
## 随文数式
### 随文数式
这是一些线性数学: $$ k_{n+1} = n^2 + k_n^2 - k_{n-1} $$ 然后是更多的文本。
## 希腊字母
### 希腊字母
$$
\Gamma\ \Delta\ \Theta\ \Lambda\ \Xi\ \Pi\ \Sigma\ \Upsilon\ \Phi\ \Psi\ \Omega
\alpha\ \beta\ \gamma\ \delta\ \epsilon\ \zeta\ \eta\ \theta\ \iota\ \kappa\ \lambda\ \mu\ \nu\ \xi \ \omicron\ \pi\ \rho\ \sigma\ \tau\ \upsilon\ \phi\ \chi\ \psi\ \omega\ \varepsilon\ \vartheta\ \varpi\ \varrho\ \varsigma\ \varphi
\displaylines{\Gamma\ \Delta\ \Theta\ \Lambda\ \Xi\ \Pi\ \Sigma\ \Upsilon\ \Phi\ \Psi\ \Omega
\alpha\ \beta\ \gamma\ \delta\ \epsilon\ \zeta\ \\\\ \eta\ \theta\ \iota\ \kappa\ \lambda\ \mu\ \nu\ \xi \ \omicron\ \pi\ \rho\ \sigma\ \tau\ \upsilon\ \phi\ \chi\ \psi\ \omega\ \varepsilon\ \vartheta\ \varpi\ \varrho\ \varsigma\ \varphi}
$$
## 箭头
### 箭头
$$
\gets\ \to\ \leftarrow\ \rightarrow\ \uparrow\ \Uparrow\ \downarrow\ \Downarrow\ \updownarrow\ \Updownarrow
$$
$$
\Leftarrow\ \Rightarrow\ \leftrightarrow\ \Leftrightarrow\ \mapsto\ \hookleftarrow
\leftharpoonup\ \leftharpoondown\ \rightleftharpoons\ \longleftarrow\ \Longleftarrow\ \longrightarrow
\displaylines{\Leftarrow\ \Rightarrow\ \leftrightarrow\ \Leftrightarrow\ \mapsto\ \hookleftarrow
\leftharpoonup\ \leftharpoondown\ \\\\\ \rightleftharpoons\ \longleftarrow\ \Longleftarrow\ \longrightarrow}
$$
$$
@@ -122,7 +128,7 @@ $$
$$
## 微积分学
### 微积分学
$$
\int u \frac{dv}{dx}\,dx=uv-\int \frac{du}{dx}v\,dx
$$
@@ -136,13 +142,13 @@ $$
$$
## 洛伦茨方程
### 洛伦茨方程
$$
\begin{aligned} \dot{x} & = \sigma(y-x) \\\\ \dot{y} & = \rho x - y - xz \\\\ \dot{z} & = -\beta z + xy \end{aligned}
$$
## 交叉乘积
### 交叉乘积
这在KaTeX中是可行的但在这种环境中馏分的分离不是很好。
$$
@@ -162,25 +168,25 @@ $$
$$
## 有弹性的括号
### 有弹性的括号
$$
\left(\frac{x^2}{y^3}\right)
$$
## 评估范围
### 评估范围
$$
\left.\frac{x^3}{3}\right|_0^1
$$
## 诊断标准
### 诊断标准
$$
f(n) = \begin{cases} \frac{n}{2}, & \text{if } n\text{ is even} \\\\ 3n+1, & \text{if } n\text{ is odd} \end{cases}
$$
## 麦克斯韦方程组
### 麦克斯韦方程组
$$
\begin{aligned} \nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\\\ \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\\\ \nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\\\ \nabla \cdot \vec{\mathbf{B}} & = 0 \end{aligned}
$$
@@ -194,19 +200,19 @@ $$
{n \choose k}
$$
## 分数在分数
### 分数在分数
$$
\frac{\frac{1}{x}+\frac{1}{y}}{y-z}
$$
## n次方根
### n次方根
$$
\sqrt[n]{1+x+x^2+x^3+\ldots}
$$
## 矩阵
### 矩阵
$$
\begin{pmatrix} a_{11} & a_{12} & a_{13}\\\\ a_{21} & a_{22} & a_{23}\\\\ a_{31} & a_{32} & a_{33} \end{pmatrix}
\begin{bmatrix} 0 & \cdots & 0 \\\\ \vdots & \ddots & \vdots \\\\ 0 & \cdots & 0 \end{bmatrix}

View File

@@ -7,7 +7,8 @@ date: 2022-09-18T20:58:13+08:00
lastmod: 2022-09-18T20:58:13+08:00
categories:
- 示例
- 第三方引入
- 图序功能
tags:
- 流程图
- 时序图

View File

@@ -0,0 +1,43 @@
---
title: "没有H1-6标题头和评论的文章"
description: "用于测试在没有H1-6标题头时文章的目录导航是否会直接关闭并关闭评论功能。"
keywords: "toc,header"
date: 2022-10-06T09:02:26+08:00
lastmod: 2022-10-30T21:03:16+08:00
categories:
- 示例文章
tags:
- toc
- 标题
comment:
enable: false
url: "post/no-header-title.html"
---
刘慈欣2018克拉克奖获奖感言部分内容节选
> 用于测试在没有H1-6标题头时文章的目录导航是否会直接关闭并关闭评论功能。
<!--more-->
先生们、女士们,晚上好,
很荣幸获得Clarke Award for Imagination in Service to Society Award。
这个奖项是对想象力的奖励,而想象力是人类所拥有的一种似乎只应属于神的能力,它存在的意义也远超出我们的想象。有历史学家说过,人类之所以能够超越地球上的其它物种建立文明,主要是因为他们能够在自己的大脑中创造出现实中不存在的东西。在未来,当人工智能拥有超过人类的智力时,想象力也许是我们对于它们所拥有的惟一优势。
科幻小说是基于想象力的文学而最早给我留下深刻印象的是Arthur . Clarke的作品。除了Jules Verne和George Wells外Clarke的作品是最早进入中国的西方现代科幻小说。在上世纪八十年代初中国出版了他的《2001:A Space Odyssey》和《Rendezvous With Rama》。当时文革刚刚结束旧的生活和信仰已经崩塌新的还没有建立起来我和其他年轻人一样心中一片迷茫。这两本书第一次激活了我想象力思想豁然开阔许多有小溪流进大海的感觉。读完《2001:A Space Odyssey》的那天深夜我走出家门仰望星空那时的中国的天空还没有太多的污染能够看到银河在我的眼中星空与过去完全不一样了我第一次对宇宙的宏大与神秘产生了敬畏感这是一种宗教般的感觉。而后来读到的《Rendezvous With Rama》也让我惊叹如何可以用想象力构造一个栩栩如生的想象世界。正是Clarke带给我的这些感受让我后来成为一名科幻作家。
现在,三十多年过去了,我渐渐发现,我们这一代在上世纪六十年代出生于中国的人,很可能是人类历史上最幸运的人,因为之前没有任何一代人,像我们这样目睹周围的世界发生了如此巨大的变化,我们现在生活的世界,与我们童年的世界已经完全是两个不同的世界,而这种变化还在加速发生着。中国是一个充满着未来感的国度,中国的未来可能充满着挑战和危机,但从来没有像现在这样具有吸引力,这就给科幻小说提供了肥沃的土壤,使其在中国受到了空前的关注,作为一个在六十年代出生在中国的科幻小说家,则是幸运中的幸运。
我期待有那么一天,像那些曾经描写过信息时代的科幻小说一样,描写太空航行的科幻小说也变的平淡无奇了,那时的火星和小行星带都是乏味的地方,有无数的人在那里谋生;木星和它众多的卫星已成为旅游胜地,阻止人们去那里的唯一障碍就是昂贵的价格。
但即使在这个时候,宇宙仍是一个大的无法想象的存在,距我们最近的恒星仍然遥不可及。浩瀚的星空永远能够承载我们无穷的想象力。
谢谢大家。
> [点击阅读全文](https://weread.qq.com/web/reader/ce032b305a9bc1ce0b0dd2akecc32f3013eccbc87e4b62e)

View File

@@ -7,7 +7,8 @@ date: 2022-08-06T14:41:50+08:00
lastmod: 2022-08-06T14:41:50+08:00
categories:
- 示例
- 示例文章
- 语法
tags:
- 短代码
- 语法

View File

@@ -7,7 +7,8 @@ date: 2022-06-07T19:09:52+08:00
lastmod: 2022-06-07T19:09:52+08:00
categories:
- 示例
- 示例文章
- 语法
tags:
- 语法
- 高亮

View File

@@ -7,7 +7,7 @@ date: 2022-06-08T21:12:52+08:00
lastmod: 2022-06-08T21:12:52+08:00
categories:
- 示例
- 示例文章
tags:
- 目录
- 导航

View File

@@ -18,119 +18,83 @@ CateTitle:
AllSome:
other: "All {{ .Some }}"
NavToggleLabel:
other: Toggle navigation bar
MSearchLabel:
other: Search
Symbol:
colon: ":"
comma: ","
period: "."
SymbolColon:
other: ":"
SymbolComma:
other: ","
SymbolPeriod:
other: "."
Sidebar:
label:
posts: Posts
categories: Categories
tags: Tags
rss: RSS
ccommons: "Creative Commons"
toc: TOC
overview: Overview
navToggle: "Toggle Navigation Bar"
search: Search
SbPostsLable:
other: "Posts"
SbCatesTitle:
other: "Categories"
SbTagsTitle:
other: "Tags"
TableOfContents:
other: "TOC"
SiteOverview:
other: "Overview"
RSSLable:
other: "RSS Subscribe"
CCLinkTitle:
other: "Creative Commons"
Terms:
archives: "{{ .Count }} posts in total"
categories: "{{ .Count }} categories in total"
tags: "{{ .Count }} tags in total"
TagsCounterTitle:
zero: No tags
other: "{{ .Count }} tags in total"
CatesCounterTitle:
zero: No categories
other: "{{ .Count }} categories in total"
ArchiveCounterTitle:
zero: No posts.
other: "{{ .Count }} posts in total"
PostArchive:
cheers:
um: Um...
ok: Ok
nice: Nice
good: Good
great: Greate
excellent: Excellent
keepOn: Keep on posting.╰(*°▽°*)╯
PostArchiveCheersUm:
other: Um..
PostArchiveCheersOk:
other: Ok
PostArchiveCheersNice:
other: Nice
PostArchiveCheersGood:
other: Good
PostArchiveCheersGreat:
other: Great
PostArchiveCheersExcellent:
other: Excellent
PostArchiveKeepOn:
other: Keep on posting.╰(*°▽°*)╯
PostMeta:
sticky: Stickys
publish:
date: "Publish on"
time: "Create Time"
lastmod:
date: "Update on"
time: "Modify Time"
category: "Classify at"
words:
title: Words
count: "{{- .WordCount -}}"
reading:
title: Read
time: "{{- .ReadingTime -}}mins"
views: Views
comments: Comments
tags: Tags
more: "Read More"
edit: "Edit this post"
PostStickyTitle:
other: Strickys
PostPublishDate:
other: "Publish on"
PostPublishTime:
other: "Create Time"
PostLastModDate:
other: "Update on"
PostLastModTime:
other: "Modify Time"
PostCategory:
other: "Classify at"
PostWords:
other: "Words"
PostWordCount:
other: "{{- .WordCount -}}"
PostReading:
other: "Read"
PostReadTime:
other: "{{- .ReadingTime -}}min"
PostViews:
other: "Views"
PostTag:
other: "Tags"
PostReadMore:
other: "Read More"
PostEditTitle:
other: Edit this post
Reward:
title: Donate
wechatpay: WechatPay
alipay: Alipay
paypal: Paypal
bitcoin: Bitcoin
PostCRTitle:
other: Post Title
PostCRAuthor:
other: Post Author
PostCRLink:
other: Post Link
PostCROriginAuthor:
other: Written By
PostCROriginLink:
other: Originally From
PostCRLicenseTitle:
other: Copyright Notice
PostCRLicenseContent:
other: "All articles in this blog are licensed under <i class=\"fab fa-fw fa-creative-commons\"></i>%s unless stating additionally."
PostCopyRight:
title: Post Title
author: Post Author
link: Post Link
origin:
author: Written By
link: Originally From
license:
title: Copyright Notice
content: "All articles in this blog are licensed under <i class=\"fab fa-fw fa-creative-commons\"></i>%s unless stating additionally."
PostFollowMe:
other: Welcome to my other publishing channels
RewardDonate:
other: Donate
RewardWechatpay:
other: Wechat Pay
RewardAlipay:
other: Alipay
RewardPaypal:
other: PayPal
RewardBitcoin:
other: Bitcoin
PostCommentTitle:
other: Comments
PostComments:
title: Comments
SiteInfoItems:
title: "Web Status"
@@ -145,17 +109,14 @@ SiteInfoItems:
totalViews: "Total Views"
lastUpdate: "Last Update:"
FooterPowerby:
other: "Power by %s"
Footer:
powerby: "Power by %s"
SearchPh:
other: Searching...
SearchEmpty:
other: "We didn't find any results for the search: ${query}"
SearchHits:
Search:
placeholder: Searching...
empty: "We didn't find any results for the search: ${query}"
hits: "${hits} results found"
SearchHitsTime:
other: "${hits} results found in ${time} ms"
time: "${hits} results found in ${time} ms"
DateSuffix:
years: " Year "

View File

@@ -19,119 +19,82 @@ CateTitle:
AllSome:
other: "所有 {{ .Some }}"
NavToggleLabel:
other: 切换导航栏
Symbol:
colon: ""
comma: ""
period: "。"
MSearchLabel:
other: 搜索
Sidebar:
label:
posts: 日志
categories: 分类
tags: 标签
rss: RSS 订阅
ccommons: 共享知识
toc: 文章目录
overview: 站点概览
navToggle: 切换导航栏
search: 搜索
SymbolColon:
other: ""
SymbolComma:
other: ""
SymbolPeriod:
other: "。"
SbPostsLable:
other: 日志
SbCatesTitle:
other: 分类
SbTagsTitle:
other: 标签
TableOfContents:
other: 文章目录
SiteOverview:
other: 站点概览
RSSLable:
other: RSS 订阅
CCLinkTitle:
other: 共享知识
Terms:
archives: "目前共计 <strong>{{ .Count }}</strong> 篇日志"
categories: "目前共计 <strong>{{ .Count }}</strong> 个分类"
tags: "目前共计 <strong>{{ .Count }}</strong> 个标签"
TagsCounterTitle:
zero: 暂无标签
other: "目前共计 <strong>{{ .Count }}</strong> 个标签"
CatesCounterTitle:
zero: 暂无分类
other: "目前共计 <strong>{{ .Count }}</strong> 个分类"
ArchiveCounterTitle:
zero: 暂无日志
other: "目前共计 <strong>{{ .Count }}</strong> 篇日志"
PostArchive:
cheers:
um: 嗯..
ok: 还行
nice: 不错
good: 很好
great: 非常好
excellent: 太棒了
keepOn: 继续努力哟。╰(*°▽°*)╯
PostArchiveCheersUm:
other: 嗯..
PostArchiveCheersOk:
other: 还行
PostArchiveCheersNice:
other: 不错
PostArchiveCheersGood:
other: 很好
PostArchiveCheersGreat:
other: 非常好
PostArchiveCheersExcellent:
other: 太棒了
PostArchiveKeepOn:
other: 继续努力哟。╰(*°▽°*)╯
PostMeta:
sticky: 置顶
publish:
date: 发表于
time: 创建时间
lastmod:
date: 更新于
time: 修改时间
category: 分类于
words:
title: 字数
count: "{{- .WordCount -}}"
reading:
title: 阅读
time: "{{- .ReadingTime -}}分钟"
views: 浏览
comments: 评论
tags: 标签
more: 阅读全文
edit: 编辑
PostStickyTitle:
other: 置顶
PostPublishDate:
other: 发表于
PostPublishTime:
other: 创建时间
PostLastModDate:
other: 更新于
PostLastModTime:
other: 修改时间
PostCategory:
other: "分类于"
PostWords:
other: 字数
PostWordCount:
other: "{{- .WordCount -}}"
PostReading:
other: 阅读
PostReadTime:
other: "{{- .ReadingTime -}}分钟"
PostViews:
other: 浏览
PostTags:
other: 标签
PostReadMore:
other: 阅读全文
PostEditTitle:
other: 编辑
Reward:
title: 赞赏
wechatpay: 微信
alipay: 支付宝
paypal: Paypal
bitcoin: 比特币
PostCRTitle:
other: 文章标题
PostCRAuthor:
other: 本文作者
PostCRLink:
other: 本文链接
PostCROriginAuthor:
other: 原文作者
PostCROriginLink:
other: 原文链接
PostCRLicenseTitle:
other: 版权声明
PostCRLicenseContent:
other: "本博客所有文章除特别声明外,均采用 <i class=\"fab fa-fw fa-creative-commons\"></i>%s 许可协议。转载请注明出处!"
PostCopyRight:
title: 文章标题
author: 本文作者
link: 本文链接
origin:
author: 原文作者
link: 原文链接
license:
title: 版权声明
content: "本博客所有文章除特别声明外,均采用 <i class=\"fab fa-fw fa-creative-commons\"></i>%s 许可协议。转载请注明出处!"
PostFollowMe:
other: 欢迎关注我的其它发布渠道
RewardDonate:
other: 赞赏
RewardWechatpay:
other: 微信
RewardAlipay:
other: 支付宝
RewardPaypal:
other: PayPal
RewardBitcoin:
other: 比特币
PostCommentTitle:
other: 评论交流
PostComments:
title: 评论交流
SiteInfoItems:
title: "网站资讯"
@@ -146,17 +109,14 @@ SiteInfoItems:
totalViews: "总访问量:"
lastUpdate: "最后更新于:"
FooterPowerby:
other: 由 %s 强力驱动
Footer:
powerby: 由 %s 强力驱动
SearchPh:
other: 搜索...
SearchEmpty:
other: "没有找到任何搜索结果:${query}"
SearchHits:
Search:
placeholder: 搜索...
empty: "没有找到任何搜索结果:${query}"
hits: "找到 ${hits} 个搜索结果"
SearchHitsTime:
other: "找到 ${hits} 个搜索结果(用时 ${time} 毫秒)"
time: "找到 ${hits} 个搜索结果(用时 ${time} 毫秒)"
DateSuffix:
years: " 年 "

136
i18n/zh-tw.yaml Normal file
View File

@@ -0,0 +1,136 @@
#--------------------------------------
# 繁體版本
#--------------------------------------
archives:
other: 文章
tag:
other: 標籤
tags:
other: 標籤
TagTitle:
other: 標籤集錦
category:
other: 分類
categories:
other: 分類
CateTitle:
other: 分類欄目
AllSome:
other: "所有 {{ .Some }}"
Symbol:
colon: ""
comma: ""
period: "。"
Sidebar:
label:
posts: 日誌
categories: 分類
tags: 標籤
rss: RSS 訂閱
ccommons: 共享知識
toc: 文章目錄
overview: 站點概覽
navToggle: 切換導航欄
search: 搜索
Terms:
archives: "目前共計 <strong>{{ .Count }}</strong> 篇日誌"
categories: "目前共計 <strong>{{ .Count }}</strong> 個分類"
tags: "目前共計 <strong>{{ .Count }}</strong> 個標籤"
PostArchive:
cheers:
um: 嗯..
ok: 還行
nice: 不错
good: 很好
great: 非常好
excellent: 太棒了
keepOn: 繼續努力喲。╰(*°▽°*)╯
PostMeta:
sticky: 置頂
publish:
date: 發表於
time: 創建時間
lastmod:
date: 更新於
time: 修改時間
category: 分類於
words:
title: 字數
count: "{{- .WordCount -}}"
reading:
title: 閱讀
time: "{{- .ReadingTime -}}分鐘"
views: 瀏覽
comments: 評論
tags: 標籤
more: 閱讀全文
edit: 編輯
Reward:
title: 讚賞
wechatpay: 微信
alipay: 支付寶
paypal: Paypal
bitcoin: 比特幣
PostCopyRight:
title: 文章標題
author: 本文作者
link: 本文鏈接
origin:
author: 原文作者
link: 原文鏈接
license:
title: 版權聲明
content: "本博客所有文章除特別聲明外,均採用 <i class=\"fab fa-fw fa-creative-commons\"></i>%s 許可協議。轉載請註明出處!"
PostFollowMe:
other: 歡迎關注我的其它發布渠道
PostCommentTitle:
other: 評論交流
SiteInfoItems:
title: "網站資訊"
runTimes: "已運行:"
words: "總字數:"
readTimes: "閱讀約:"
visitors: "總訪客數:"
pageViews: "頁面瀏覽:"
todayViews: "今日訪問:"
yesterdayViews: "昨日訪問:"
monthViews: "本月訪問:"
totalViews: "總訪問量:"
lastUpdate: "最後更新於:"
FooterPowerby:
other: 由 %s 強力驅動
Search:
placeholder: 搜索...
empty: "沒有找到任何搜索結果:${query}"
hits: "找到 ${hits} 個搜索結果"
time: "找到 ${hits} 個搜索結果(用時 ${time} 毫秒)"
DateSuffix:
years: " 年 "
days: " 天 "
hours: " 小時 "
mins: " 分鐘"
month: " 個月前"
day: " 天前"
hour: " 小時前"
min: " 分鐘前"
just: "剛剛"
ToolBtns:
comment: "直達評論"
theme: "深淺模式切換"
lang: "多語言翻譯"
backTop: "返回頂部"

View File

@@ -0,0 +1,3 @@
<h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }}
<a class="header-anchor" href="#{{ .Anchor | safeURL }}"></a>
</h{{ .Level }}>

View File

@@ -0,0 +1 @@
<img src="/imgs/img-lazy-loading.gif" data-src="{{ .Destination | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}"{{ end }} />

View File

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

View File

@@ -1,11 +1,13 @@
{{- range $k, $v := (partialCached "init.html" .) -}}
{{- $.Scratch.Set $k $v -}}
{{- end -}}
{{ range $k, $v := (partialCached "init.html" .) }}
{{ $.Scratch.Set $k $v }}
{{ end }}
{{ $isComment := .Params.comment.enable | default .Site.Params.comments.enable }}
{{ .Scratch.Set "isComment" $isComment }}
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
<html lang="{{ .Site.LanguageCode }}" data-theme="{{ .Scratch.Get "theme" }}">
<head>
{{- partial "head.html" . }}
{{ partial "head.html" . }}
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title>
<noscript>
<link rel="stylesheet" href="/css/noscript.css">
@@ -17,30 +19,30 @@
<main class="main">
<header class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner">
{{- partial "header.html" . }}
{{ partial "header.html" . }}
</div>
<!-- Sidebar -->
{{- if ne .Site.Params.sidebar.display "remove" }}
{{- partial "sidebar.html" . }}
{{- end }}
{{ if ne .Site.Params.sidebar.display "remove" }}
{{ partial "sidebar.html" . }}
{{ end }}
</header>
<!-- Widgets -->
{{ partial "widgets.html" . }}
<div class="main-inner {{ block "main_inner_class" . }}{{ end }}">
<!-- Submenu,Content,Comment -->
{{- block "main" . }}{{- end }}
{{- if .IsPage }}
{{- partialCached "comments.html" . }}
{{- end }}
{{ block "main" . }}{{ end }}
{{ if and .IsPage $isComment }}
{{ partialCached "comments.html" . }}
{{ end }}
</div>
</main>
<footer class="footer">
<div class="footer-inner">
{{- partialCached "footer.html" . }}
{{ partialCached "footer.html" . }}
</div>
</footer>
{{- partial "scripts.html" . }}
{{ partial "scripts.html" . }}
</body>
</html>

View File

@@ -1,12 +1,13 @@
[
{{- range $index, $entry := where .Site.RegularPages "Kind" "page" }}
{{- if $index }}, {{ end }}
{{ range $index, $entry := where .Site.RegularPages "Kind" "page" }}
{{ if $index }}, {{ end }}
{
"objectID": "{{ .Date.Unix }}",
"permalink": "{{ .Permalink | relURL }}",
"title": {{ .Title | jsonify }},
"content": {{ .Plain | jsonify }},
"content": {{ .Plain | jsonify | safeJS }},
"date": {{ .Date.Format $.Site.Params.timeFormat | jsonify }},
"updated": {{ .Lastmod.Format $.Site.Params.timeFormat | jsonify }}
}
{{- end }}
{{ end }}
]

View File

@@ -5,12 +5,12 @@
<title>{{ .Title }}</title>
<url>{{ .RelPermalink | relLangURL }}</url>
<categories>
{{- range .Params.categories }}<category>{{ . }}</category>{{- end }}
{{ range .Params.categories }}<category>{{ . }}</category>{{ end }}
</categories>
<tags>
{{- range .Params.tags }}
{{ range .Params.tags }}
<tag>{{ . }}</tag>
{{- end }}
{{ end }}
</tags>
<content type="html"><![CDATA[{{ .Content | plainify }}]]></content>
</entry>

View File

@@ -1,15 +1,15 @@
{{- define "title" }}
{{- .Params.Title | default (T .Section) | default .Section }} - {{ .Site.Title -}}
{{- end -}}
{{ define "title" }}
{{ .Params.Title | default (T .Section) | default .Section }} - {{ .Site.Title }}
{{ end }}
{{ define "main_inner_class" }}index posts-expand{{ end }}
{{- define "main" }}
{{ define "main" }}
{{ $paginator := .Paginate (where .Site.RegularPages "Section" "==" .Section) }}
{{- range $paginator.Pages }}
{{ range $paginator.Pages }}
{{ partial "post.html" (dict "ctx" . "IsHome" true) }}
{{- end }}
{{ end }}
{{- partial "partials/pagination.html" . }}
{{ partial "partials/pagination.html" . }}
{{- end }}
{{ end }}

View File

@@ -1,7 +1,7 @@
{{- define "title" }}{{- .Title }} - {{ .Site.Title -}}{{- end }}
{{ define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end }}
{{- define "main_inner_class" }}post posts-expand{{- end }}
{{ define "main_inner_class" }}post posts-expand{{ end }}
{{- define "main" }}
{{ define "main" }}
{{ partial "post.html" (dict "ctx" . "IsHome" false) }}
{{- end }}
{{ end }}

View File

@@ -1,6 +1,6 @@
{{- define "title" -}}
{{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}}
{{- end -}}
{{ define "title" }}
{{ .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title }}
{{ end }}
{{ define "main_inner_class" }}{{ .Data.Plural }} posts-collapse{{ end }}
{{ define "main" }}
<div class="post-block">
@@ -18,5 +18,5 @@
</div>
</div>
{{- partial "pagination.html" . }}
{{- end }}
{{ partial "pagination.html" . }}
{{ end }}

View File

@@ -1,55 +1,92 @@
{{- define "title" -}}
{{- .Params.Title | default (T .Data.Plural) | default .Data.Plural | dict "Some" | T "AllSome" }} - {{ .Site.Title -}}
{{- end -}}
{{- define "main_inner_class" }}{{.Data.Plural}} posts-expand{{ end -}}
{{- define "main" }}
{{ define "title" }}
{{ .Params.Title | default (T .Data.Plural) | default .Data.Plural | dict "Some" | T "AllSome" }} - {{ .Site.Title }}
{{ end }}
{{ define "main_inner_class" }}{{.Data.Plural}} posts-expand{{ end }}
{{ define "main" }}
<div class="post-block" lang="{{ .Site.LanguageCode }}">
<div class="post-header">
<h1>
{{- if eq .Data.Plural "categories" }}
{{- T "CateTitle" }}
{{- else if eq .Data.Plural "tags" }}
{{- T "TagTitle" }}
{{- end }}
{{ if eq .Data.Plural "categories" }}
{{ T "CateTitle" }}
{{ else if eq .Data.Plural "tags" }}
{{ T "TagTitle" }}
{{ end }}
</h1>
</div>
<div class="post-body">
{{- if eq .Data.Plural "categories" }}
{{ $cats := .Site.Taxonomies.categories }}
{{ if eq .Data.Plural "categories" }}
{{ $categories := .Site.Taxonomies.categories }}
<div class="category-all-page">
<div class="category-all-title">
{{- T "CatesCounterTitle" (.Scratch.Get "catsCount") | safeHTML -}}
{{ T "Terms.categories" (.Scratch.Get "catsCount") | safeHTML }}
</div>
<div class="category-all">
<ul class="category-list">
{{- range $name, $items := $cats }}
<li class="category-list-item">
<a class="category-list-link" href="{{ "/categories/" | relLangURL }}{{ $name | urlize | lower }}" data-pjax-state="">{{ .Page.Title }}</a>
<span class="category-list-count">{{ len $items }}</span>
</li>
{{- end }}
</ul>
{{ $allSecondaryCats := slice }}
{{ range .Site.Taxonomies.categories.ByCount }}
{{ $primaryCategory := .Name }}
{{ $primaryCount := 0 }}
{{ $secondaryCategories := slice}}
{{ $pages := $.Scratch.Get "pages" }}
{{ range where $pages "Params.categories" "intersect" (slice $primaryCategory) }}
{{ if eq (index .Params.categories 0) $primaryCategory }}
{{ $primaryCount = add $primaryCount 1 }}
{{/** if and (isset .Params.categories 1) (not (in $secondaryCategories (index .Params.categories 1))) **/}}
{{ if isset .Params.categories 1 }}
{{ if not (in $secondaryCategories (index .Params.categories 1)) }}
{{ $secondaryCategories = $secondaryCategories | append (index .Params.categories 1) }}
{{ $allSecondaryCats = $allSecondaryCats | append (index .Params.categories 1) }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ if not (in $allSecondaryCats $primaryCategory) }}
<li class="category-list-item">
<a class="category-list-link" href="{{ "categories/" | relURL }}{{ $primaryCategory | urlize }}">
{{ $primaryCategory }}
<span class="category-list-count">{{ $primaryCount }}</span>
</a>
</li>
<ul class="category-children-list">
{{ range $secondaryCategories }}
{{ $secondaryCategory := . }}
{{ $secondaryCount := 0 }}
{{ range where $pages "Params.categories" "intersect" (slice $secondaryCategory) }}
{{ if and (eq (index .Params.categories 0) $primaryCategory) (eq (index .Params.categories 1) $secondaryCategory) }}
{{ $secondaryCount = add $secondaryCount 1 }}
{{ end }}
{{ end }}
<li class="category-children-list-item">
<a class="category-list-link" href="{{ "categories/" | relURL }}{{ . | urlize }}">
{{ . }}
<span class="category-list-count">{{ $secondaryCount }}</span>
</a>
</li>
{{ end }}
</ul>
{{ end }}
{{ end }}
</ul>
{{ end }}
{{ if eq .Data.Plural "tags" }}
{{ $tags := .Site.Taxonomies.tags }}
<div class="tag-cloud">
<div class="tag-cloud-title">
{{ T "Terms.tags" (.Scratch.Get "tagsCount") | safeHTML }}
</div>
<div class="tag-cloud-tags">
{{ $randNums := (seq 10) }}
{{- range $name, $items := $tags }}
<a class="tag-cloud-{{ index (shuffle $randNums) 0 }}" href="{{ "/tags/" | relLangURL }}{{ $name | urlize }}">{{ .Page.Title }}
<span class="tag-list-count">
<sup>({{ len $items }})</sup>
</span>
</a>
{{ end }}
</div>
</div>
</div>
{{- end }}
{{- if eq .Data.Plural "tags" }}
{{ $tags := .Site.Taxonomies.tags }}
<div class="tag-cloud">
<div class="tag-cloud-title">
{{- T "TagsCounterTitle" (.Scratch.Get "tagsCount") | safeHTML -}}
</div>
<div class="tag-cloud-tags">
{{ $randNums := (seq 10) }}
{{- range $name, $items := $tags }}
<a class="tag-cloud-{{ index (shuffle $randNums) 0 }}" href="{{ "/tags/" | relLangURL }}{{ $name | urlize | lower }}">{{ .Page.Title }}
<span class="tag-list-count">
<sup>({{ len $items }})</sup>
</span>
</a>
{{- end }}
</div>
</div>
{{- end }}
{{ end }}
</div>
</div>
{{- end }}
{{ end }}

View File

@@ -1,30 +1,30 @@
{{- define "title" }}
{{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "AllSome" }} - {{ .Site.Title -}}
{{- end -}}
{{ define "title" }}
{{ .Params.Title | default (T .Section) | default .Section | dict "Some" | T "AllSome" }} - {{ .Site.Title }}
{{ end }}
{{ define "main_inner_class" }}archive posts-collapse{{ end }}
{{- define "main" }}
{{ define "main" }}
<div class="post-block">
<div class="post-content">
<div class="collection-title">
{{- $cheers := "Um" }}
{{- $posts := .Scratch.Get "postsCount" }}
{{- if gt $posts 210 }}
{{- $cheers = "Excellent" }}
{{- else if gt $posts 130 }}
{{- $cheers = "Great" }}
{{- else if gt $posts 80 }}
{{- $cheers = "Good" }}
{{- else if gt $posts 50 }}
{{- $cheers = "Nice" }}
{{- else if gt $posts 30 }}
{{- $cheers = "Ok" }}
{{- end }}
{{ $cheers := "um" }}
{{ $posts := .Scratch.Get "postsCount" }}
{{ if gt $posts 210 }}
{{ $cheers = "excellent" }}
{{ else if gt $posts 130 }}
{{ $cheers = "great" }}
{{ else if gt $posts 80 }}
{{ $cheers = "good" }}
{{ else if gt $posts 50 }}
{{ $cheers = "nice" }}
{{ else if gt $posts 30 }}
{{ $cheers = "ok" }}
{{ end }}
<span class="collection-header">
{{- T (printf "PostArchiveCheers%s" $cheers) }}
{{- T "SymbolComma" }}
{{- T "ArchiveCounterTitle" $posts | safeHTML }}
{{- T "SymbolComma" }}
{{- T "PostArchiveKeepOn" }}
{{ T (printf "PostArchive.cheers.%s" $cheers) }}
{{ T "Symbol.comma" }}
{{ T "Terms.archives" $posts | safeHTML }}
{{ T "Symbol.comma" }}
{{ T "PostArchive.keepOn" }}
</span>
</div>
@@ -32,5 +32,5 @@
</div>
</div>
{{- partial "pagination.html" . }}
{{- end }}
{{ partial "pagination.html" . }}
{{ end }}

View File

@@ -1,6 +1,6 @@
{{- define "title" }}{{- .Title }} - {{ .Site.Title -}}{{- end }}
{{ define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end }}
{{- define "main_inner_class" }}flinks posts-expand{{- end }}
{{ define "main_inner_class" }}flinks posts-expand{{ end }}
{{ define "main" }}

View File

@@ -1,11 +1,11 @@
{{- define "main_inner_class" }}index posts-expand{{- end }}
{{ define "main_inner_class" }}index posts-expand{{ end }}
{{- define "main" }}
{{ define "main" }}
{{ $paginator := .Paginate (where .Site.RegularPages "Section" "in" .Site.Params.mainSections) }}
{{- range $paginator.Pages }}
{{ range $paginator.Pages }}
{{ partial "post.html" (dict "ctx" . "IsHome" true) }}
{{- end }}
{{ end }}
{{- partial "partials/pagination.html" . }}
{{- end }}
{{ partial "partials/pagination.html" . }}
{{ end }}

View File

@@ -0,0 +1,11 @@
{{/* Get third party js plugins resource */}}
{{ $pluginPath := printf "%s/%s/%s" "js/third-party" .class .plugin }}
{{ $targetPath := printf "js/%s" .plugin }}
{{ $plugin := resources.Get $pluginPath | resources.ExecuteAsTemplate $targetPath .ctx }}
{{ if hugo.IsProduction }}
{{ $plugin = $plugin | minify | fingerprint }}
{{ end }}
<script type="text/javascript" src="{{ $plugin.RelPermalink }}" defer></script>

View File

@@ -6,15 +6,15 @@
{{ with .res.alias2 }}
{{ $npm = . }}
{{ end }}
{{- $file := .res.file }}
{{ $file := .res.file }}
{{- if eq .vendor "cdnjs" }}
{{- with .res.alias }}
{{- $npm = . }}
{{- end }}
{{- $file = replaceRE `(dist|lib|source\/js)\/` "" .res.file }}
{{- $fmt = "%s/%s/%s/%s" }}
{{- end }}
{{ if ne .vendor "unpkg" }}
{{ with .res.alias }}
{{ $npm = . }}
{{ end }}
{{ $file = replaceRE `(dist|lib|source\/js)\/` "" .res.file }}
{{ $fmt = "%s/%s/%s/%s" }}
{{ end }}
{{ $pluginRes := printf $fmt .router $npm .res.version $file }}

View File

@@ -1,17 +1,17 @@
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', () => {
var script = document.createElement('script');
script.charset = "UTF-8";
script.id = "LA_COLLECT";
script.src = "{{ .Site.Data.resources.analytics.la }}";
script.async = "true"
script.onload = function() {
{{ with .Site.Params.analytics.laId }}
LA.init({ id: "{{ . }}",ck: "{{ . }}", autoTrack:true });
{{ end }}
}
document.addEventListener('DOMContentLoaded', () => {
var script = document.createElement('script');
script.charset = "UTF-8";
script.id = "LA_COLLECT";
script.src = "{{ .Site.Data.resources.analytics.la }}";
script.async = "true"
script.onload = function() {
{{ with .Site.Params.analytics.laId }}
LA.init({ id: "{{ . }}",ck: "{{ . }}", autoTrack:true });
{{ end }}
}
document.head.appendChild(script);
});
document.head.appendChild(script);
});
</script>

View File

@@ -1,11 +1,11 @@
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', () => {
var script = document.createElement('script');
script.charset = "UTF-8";
script.src = "{{ .Site.Data.resources.analytics.baidu }}{{ .Site.Params.analytics.baidu }}";
script.async = "true"
document.addEventListener('DOMContentLoaded', () => {
var script = document.createElement('script');
script.charset = "UTF-8";
script.src = "{{ .Site.Data.resources.analytics.baidu }}{{ .Site.Params.analytics.baidu }}";
script.async = "true"
document.head.appendChild(script);
});
document.head.appendChild(script);
});
</script>

View File

@@ -1,11 +1,15 @@
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', () => {
var script = document.createElement('script');
script.charset = "UTF-8";
script.src = "{{ .Site.Data.resources.analytics.busuanzi }}";
script.async = "true"
document.head.appendChild(script);
});
document.addEventListener('DOMContentLoaded', () => {
var script = document.createElement('script');
script.charset = "UTF-8";
script.src = "{{ .Site.Data.resources.analytics.busuanzi }}";
script.async = false
script.defer = true
document.head.appendChild(script);
script.onload = function() {
NexT.utils.fmtBusuanzi();
}
});
</script>

View File

@@ -1,18 +1,18 @@
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', () => {
var script = document.createElement('script');
script.charset = "UTF-8";
script.src = "{{ .Site.Data.resources.analytics.google }}{{ .Site.Params.analytics.google }}";
script.async = "true"
script.onload = function() {
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
document.addEventListener('DOMContentLoaded', () => {
var script = document.createElement('script');
script.charset = "UTF-8";
script.src = "{{ .Site.Data.resources.analytics.google }}{{ .Site.Params.analytics.google }}";
script.async = "true"
script.onload = function() {
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ .Site.Params.analytics.google }} ');
}
gtag('config', '{{ .Site.Params.analytics.google }} ');
}
document.head.appendChild(script);
});
document.head.appendChild(script);
});
</script>

View File

@@ -1,28 +0,0 @@
<!-- Load math render scripts -->
{{ $math := .Params.math | default .Site.Params.math }}
{{- partial "scripts/plugins.html" (dict "vendor" (.Scratch.Get "vendor") "router" (.Scratch.Get "router") "res" .Site.Data.resources.plugins "index" $math) }}
{{ if eq $math "katex" }}
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function() {
renderMathInElement(document.body, {
delimiters: [
{left: '$$', right: '$$', display: true},
{left: '$', right: '$', display: false},
{left: '\\(', right: '\\)', display: false},
{left: '\\[', right: '\\]', display: true}
],
throwOnError : false
});
});
</script>
{{ end }}
{{ if eq $math "mathjax" }}
<script type="text/javascript">
window.MathJax = {
tex: {
inlineMath: [["$", "$"]],
}
};
</script>
{{ end }}

View File

@@ -1,15 +0,0 @@
{{- partial "scripts/plugins.html" (dict "vendor" (.Scratch.Get "vendor") "router" (.Scratch.Get "router") "res" .Site.Data.resources.plugins "index" "mermaid") }}
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', () => {
mermaid.initialize({
sequence: {
showSequenceNumbers: true,
actorMargin: 50,
diagramMarginX:10,
diagramMarginY:10
}
});
});
</script>

View File

@@ -8,7 +8,21 @@
</span>
</div>
<div class="search-result-container">
<div class="algolia-stats"><hr></div>
<div class="algolia-hits"></div>
</div>
<div class="search-footer">
<div class="algolia-pagination"></div>
<div class="search-meta-info">
<div class="search-hit-stats algolia-stats"></div>
<div class="search-vendor">
<span>Search By</span>
{{ $domain := .Site.Data.config.domain }}
{{ if and .Site.BaseURL (ne .Site.BaseURL '/') }}
{{ $domain = .Site.BaseURL }}
{{ end }}
<a title="Algolia" target="_blank" href="https://www.algolia.com/?utm_source=instantsearch.js&utm_medium=website&utm_content={{ (urls.Parse $domain).Host }}&utm_campaign=poweredby">
<img src="/imgs/algolia-logo.svg"/>
</a>
</div>
</div>
</div>

View File

@@ -4,7 +4,7 @@
</span>
<div class="search-input-container">
<input autocomplete="off" autocapitalize="off" maxlength="80"
placeholder="{{ T "SearchPh" }}" spellcheck="false"
placeholder="{{ T "Search.placeholder" }}" spellcheck="false"
type="search" class="search-input">
</div>
<span class="popup-btn-close" role="button">

View File

@@ -1,3 +1,3 @@
{{- if isset .Site.Params "addthisid" }}
{{ if isset .Site.Params "addthisid" }}
<div class="addthis_inline_share_toolbox" style="text-align: center;"></div>
{{- end }}
{{ end }}

View File

@@ -1,42 +1,42 @@
{{- $root := . -}}
{{- with .Site.Params.comments }}
{{- $tc := and .storage (gt (len .nav) 1) }}
{{- $active := .active }}
{{- $fc := .active }}
{{- $sc := "" }}
{{- $sn := "" }}
{{ $root := . }}
{{ with .Site.Params.comments }}
{{ $tc := and .storage (gt (len .nav) 1) }}
{{ $active := .active }}
{{ $fc := .active }}
{{ $sc := "" }}
{{ $sn := "" }}
<div id="comments" class="post-comments">
<div class="comment-head">
<div class="comment-headline">
<i class="fas fa-comments fa-fw"></i>
<span>{{ T "PostCommentTitle" }}</span>
<span>{{ T "PostComments.title" }}</span>
</div>
{{- if $tc }}
{{- $sn = (sort .nav "weight") }}
{{- $fc = index $sn 0 }}
{{- $sc = index $sn 1 }}
{{ if $tc }}
{{ $sn = (sort .nav "weight") }}
{{ $fc = index $sn 0 }}
{{ $sc = index $sn 1 }}
<div class="comment-switch">
<span class="first-comment">{{ $fc.title }}</span>
<span class="switch-btn {{ if eq .active (lower $sc.name) }}move{{ end }}"></span>
<span class="second-comment">{{ $sc.title }}</span>
</div>
{{- end }}
{{ end }}
</div>
<div class="comment-wrap">
{{ $cp := "_thirdparty/comment/%s.html" }}
{{- if $tc }}
{{- range $sn }}
{{ if $tc }}
{{ range $sn }}
<div>
{{- partial "_thirdparty/comment/comm_loading.html" . }}
{{- partial (printf $cp (lower .name)) $root }}
{{ partial "_thirdparty/comment/comm_loading.html" . }}
{{ partial (printf $cp (lower .name)) $root }}
</div>
{{- end }}
{{- else }}
{{ end }}
{{ else }}
<div>
{{- partial "_thirdparty/comment/comm_loading.html" . }}
{{- partial (printf $cp $fc) $root }}
{{ partial "_thirdparty/comment/comm_loading.html" . }}
{{ partial (printf $cp $fc) $root }}
</div>
{{- end }}
{{ end }}
</div>
</div>
{{- end }}
{{ end }}

View File

@@ -1,6 +1,6 @@
{{- $ft := .Site.Params.footer }}
{{ $ft := .Site.Params.footer }}
{{ if $ft.translate }}
<div class="google-translate">
<div id="gtranslate" class="google-translate">
<i class="fa fa-language"></i>
<div id="google_translate_element"></div>
</div>
@@ -8,81 +8,55 @@
<div class="copyright">
&copy;
<span itemprop="copyrightYear">
{{- $year := now.Year }}
{{- if isset $ft "since" }}
{{- if gt $year $ft.since }}
{{ $year := now.Year }}
{{ if isset $ft "since" }}
{{ if gt $year $ft.since }}
{{ $ft.since }} - {{ $year }}
{{- else }}
{{ else }}
{{ $year }}
{{- end }}
{{- else }}
{{ end }}
{{ else }}
{{ $year }}
{{- end }}
{{ end }}
</span>
<span class="with-love">
<i class="{{ $ft.icon.name }}"></i>
</span>
<span class="author" itemprop="copyrightHolder">{{ $ft.copyright | default .Site.Params.author }}</span>
</div>
{{- with .Site.Params.busuanzi }}
{{- if .enable }}
<div class="busuanzi-count">
{{- if .visitors }}
<span class="post-meta-item" id="busuanzi_container_site_uv" title="{{ T "VisitorsLabel" }}">
<span class="post-meta-item-icon">
<i class="{{ .visitorsIcon }}"></i>
</span>
<span class="site-uv" >
<span id="busuanzi_value_site_uv"></span>
</span>
</span>
{{- end }}
{{- if .views }}
<span class="post-meta-item" id="busuanzi_container_site_pv" title="{{ T "PageViewsLabel" }}">
<span class="post-meta-item-icon">
<i class="{{ .viewsIcon }}"></i>
</span>
<span class="site-pv">
<span id="busuanzi_value_site_pv"></span>
</span>
</span>
{{- end }}
</div>
{{- end }}
{{- end }}
{{- if $ft.powered }}
{{ if $ft.powered }}
<div class="powered-by">
{{ $pb := printf "<a href='https://gohugo.io' title='%s' target='_blank'>Hugo</a> &amp; <a href='https://github.com/hugo-next/hugo-theme-next' title='%s' target='_blank'>Hugo NexT.%s</a>" hugo.Version .Site.Data.config.version .Site.Params.scheme }}
{{- printf (T "FooterPowerby") $pb | safeHTML }}
{{ printf (T "Footer.powerby") $pb | safeHTML }}
</div>
{{- end }}
{{- with $ft.beian }}
{{- if .enable }}
{{ end }}
{{ with $ft.beian }}
{{ if .enable }}
<div class="beian">
<a href="https://beian.miit.gov.cn" target="_blank">{{ .icp }}</a>
<img src="/imgs/gongan.png" alt="{{ .provinceAbbr }}公网安备">
<a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode={{ .gonganNum }}" target="_blank">{{ .provinceAbbr }}公网安备 {{ .gonganNum }} 号</a>
</div>
{{- end }}
{{- end }}
{{- with $ft.vendors }}
{{ end }}
{{ end }}
{{ with $ft.vendors }}
{{ if .enable }}
<div class="vendors-list">
{{- range .list }}
{{ range .list }}
<a target="_blank" href="{{ .link }}" title="{{ .name }}">
{{- if .image }}
<img src="{{ .image.url }}" alt="{{ .name }}" />
{{- else }}
{{ if .image }}
<img src="/imgs/img-lazy-loading.gif" data-src="{{ .image.url }}" alt="{{ .name }}" />
{{ else }}
{{ .name }}
{{- end }}
{{ end }}
</a>
{{- end }}
{{ end }}
<span>{{ .title }}</span>
</div>
{{- end }}
{{- end }}
{{ end }}
{{ end }}
{{- $custom := .Scratch.Get "footer" }}
{{- if $custom }}
{{ $custom := .Scratch.Get "footer" }}
{{ if $custom }}
{{ partialCached $custom . }}
{{- end }}
{{ end }}

View File

@@ -1,10 +1,65 @@
{{- partial "head/meta.html" . }}
{{- partial "head/opengraph.html" . }}
{{- partial "head/twitter.html" . }}
{{- partial "head/googleplus.html" . }}
{{- partial "head/facebook.html" . }}
{{- partialCached "head/verify.html" . }}
{{- partialCached "head/style.html" . }}
{{- partial "head/config.html" . }}
{{- partialCached "head/analytics.html" . }}
{{ partial "head/meta.html" . }}
{{ partial "head/opengraph.html" . }}
{{ partial "head/twitter.html" . }}
{{ partial "head/googleplus.html" . }}
{{ partial "head/facebook.html" . }}
{{ partial "head/verify.html" . }}
{{ partialCached "head/style.html" . }}
<script type="text/javascript">
(function(){
localDB = {
set: function (key, value, ttl) {
if (ttl === 0) return;
const now = new Date();
const expiryDay = ttl * 86400000;
const item = {
value: value,
expiry: now.getTime() + expiryDay
};
localStorage.setItem(key, JSON.stringify(item));
},
get: function (key) {
const itemStr = localStorage.getItem(key);
if (!itemStr) {
return undefined;
}
const item = JSON.parse(itemStr);
const now = new Date();
if (now.getTime() > item.expiry) {
localStorage.removeItem(key);
return undefined;
}
return item.value;
}
};
theme = {
active: function() {
const localState = localDB.get('theme');
if (localState == undefined) return;
theme.toggle(localState);
window.matchMedia("(prefers-color-scheme: dark)").addListener(function (evt) {
theme.toggle(evt.matches ? 'dark' : 'light');
});
},
toggle: function (theme) {
document.documentElement.setAttribute('data-theme', theme);
localDB.set('theme', theme, 2);
const iframe = document.querySelector('iframe.giscus-frame');
if (iframe) {
const config = { setConfig: { theme: theme } };
iframe.contentWindow.postMessage({ giscus: config }, 'https://giscus.app');
}
}
};
theme.active();
})(window);
</script>
{{ partial "head/config.html" . }}
{{ partialCached "head/analytics.html" . }}

View File

@@ -1,12 +1,12 @@
{{- if isset .Site.Params.analytics "laid" }}
{{ if isset .Site.Params.analytics "laid" }}
{{ partial "_thirdparty/analytics/51la.html" . }}
{{- end }}
{{- if isset .Site.Params.analytics "baidu" }}
{{ end }}
{{ if isset .Site.Params.analytics "baidu" }}
{{ partial "_thirdparty/analytics/baidu.html" . }}
{{- end }}
{{- if isset .Site.Params.analytics "google" }}
{{ end }}
{{ if isset .Site.Params.analytics "google" }}
{{ partial "_thirdparty/analytics/google.html" . }}
{{- end }}
{{- if isset .Site.Params.analytics "busuanzi" }}
{{ end }}
{{ if or (isset .Site.Params.analytics "busuanzi") (eq .Site.Params.postMeta.views.plugin "busuanzi") }}
{{ partial "_thirdparty/analytics/busuanzi.html" . }}
{{- end }}
{{ end }}

View File

@@ -1,10 +1,40 @@
<script class="next-config" data-name="page" type="application/json">
{{- dict
{{ $pageCfg := dict
"isHome" .IsHome
"isPage" .IsPage
"comments" (.Params.comments | default .Site.Params.comments.enable)
"comments" (.Scratch.Get "isComment")
"permalink" (.Page.Permalink | absURL)
"path" (.Page.Permalink | path.Base)
"title" .Page.Title
-}}
</script>
}}
{{/* Append waline pageview & comment plugin */}}
{{ if or (eq .Site.Params.postMeta.views.plugin "waline") (eq .Site.Params.postMeta.comments.plugin "waline") }}
{{ $counter := dict
"js" .Site.Data.resources.plugins.waline.js
}}
{{ $pageCfg = merge $pageCfg (dict "waline" $counter) }}
{{ end }}
{{/* Append mermaid plugin */}}
{{ if .Params.mermaid }}
{{ $mermaid := dict
"js" .Site.Data.resources.plugins.mermaid.js
}}
{{ $pageCfg = merge $pageCfg (dict "mermaid" $mermaid) }}
{{ end }}
{{/* Append math render plugin */}}
{{ with or .Params.math .Site.Params.math }}
{{ $math := dict
"render" .
"js" (index $.Site.Data.resources.plugins .).js
}}
{{ if eq . "katex" }}
{{ $math = merge $math ( dict "css" $.Site.Data.resources.plugins.katex.css ) }}
{{ end }}
{{ $pageCfg = merge $pageCfg (dict "math" $math) }}
{{ end }}
<script class="next-config" data-name="page" type="application/json">{{ $pageCfg }}</script>

View File

@@ -1,5 +1,5 @@
{{- with .Site.Params.openGraph.facebook }}
{{- range $attr, $val := . }}
{{ with .Site.Params.openGraph.facebook }}
{{ range $attr, $val := . }}
<meta property="fb:{{ $attr }}" content="{{ $val }}">
{{- end }}
{{- end }}
{{ end }}
{{ end }}

View File

@@ -1,9 +1,9 @@
<!-- Website icons -->
{{- with .Site.Params.favicon }}
{{ with .Site.Params.favicon }}
<link rel="shortcut icon" type="image/x-icon" href="{{ .icon }}">
<link rel="icon" type="image/x-icon" href="{{ .icon }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ .small }}">
<link rel="icon" type="image/png" sizes="32x32" href="{{ .medium }}">
<link rel="apple-touch-icon" sizes="180x180" href="{{ .appleTouchIcon }}">
{{- end }}
{{ end }}
<!-- Website icons -->

View File

@@ -1,3 +1,3 @@
{{- with .Site.Params.openGraph.googlePlus }}
{{ with .Site.Params.openGraph.googlePlus }}
<link rel="publisher" href=" {{ . }}">
{{- end }}
{{ end }}

View File

@@ -1,10 +1,10 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
{{- if .Site.Params.darkmode }}
{{ if .Site.Params.darkmode }}
<meta name="theme-color" content="{{ .Site.Params.themeColor.dark }}" media="(prefers-color-scheme: dark)" />
{{- else }}
{{ else }}
<meta name="theme-color" content="{{ .Site.Params.themeColor.light }}" media="(prefers-color-scheme: light)" />
{{- end }}
{{ end }}
{{ hugo.Generator }}
<link rel="shortcut icon" type="image/x-icon" href="{{ .Site.Params.favicon.icon }}">
<link rel="icon" type="image/x-icon" href="{{ .Site.Params.favicon.icon }}">
@@ -13,18 +13,18 @@
<link rel="apple-touch-icon" sizes="180x180" href="{{ .Site.Params.favicon.appleTouchIcon }}">
<meta itemprop="name" content="{{ .Title }}" />
<meta itemprop="description" content="{{ .Description | default .Site.Params.description }}" />
{{- if .IsPage }}
{{- with .Date }}
{{ if .IsPage }}
{{ with .Date }}
<meta itemprop="datePublished" {{ . }} />
{{- end }}
{{- with .Lastmod }}
{{ end }}
{{ with .Lastmod }}
<meta itemprop="dateModified" {{ . }} />
{{- end }}
{{- end }}
{{- $img := .Site.Params.customLogo | default .Site.Params.avatar.url }}
{{- if and .IsPage (isset .Params "images") }}
{{- $img := index .Params.images 0 }}
{{- end }}
{{- .Scratch.Set "metaImg" $img }}
{{ end }}
{{ end }}
{{ $img := .Site.Params.customLogo | default .Site.Params.avatar.url }}
{{ if and .IsPage (isset .Params "images") }}
{{ $img := index .Params.images 0 }}
{{ end }}
{{ .Scratch.Set "metaImg" $img }}
<meta itemprop="image" content="{{ $img | absURL }}" />
<meta itemprop="keywords" content="{{ if and .IsPage (isset .Params "tags")}}{{ delimit .Params.tags "," }}{{ else }}{{ .Site.Params.keywords }}{{ end }}" />

View File

@@ -1,9 +1,9 @@
{{- $Site := .Site -}}
{{- $Params := .Site.Params -}}
{{- $Page := .Page -}}
{{- $langCode := .Scratch.Get "langCode" -}}
{{- with .Site.Params.openGraph -}}
{{- if .enable -}}
{{ $Site := .Site }}
{{ $Params := .Site.Params }}
{{ $Page := .Page }}
{{ $langCode := .Scratch.Get "langCode" }}
{{ with .Site.Params.openGraph }}
{{ if .enable }}
<meta property="og:type" content="website">
<meta property="og:title" content="{{ $Page.Title }}">
<meta property="og:description" content="{{ default $Params.description $Page.Description }}">
@@ -12,21 +12,21 @@
<meta property="og:site_name" content="{{ $Site.Title }}">
<meta property="og:locale" content="{{ $langCode }}">
<meta property="article:author" content="{{ default $Params.author $Page.Params.Author }}">
{{- with .twitter -}}
{{- range $attr, $val := . }}
{{ with .twitter }}
{{ range $attr, $val := . }}
<meta name="twitter:{{ $attr }}" content="{{ $val }}">
{{- end -}}
{{- end -}}
{{ end }}
{{ end }}
{{- with .googlePlus }}
{{ with .googlePlus }}
<link rel="publisher" href=" {{ . }}">
{{- end -}}
{{ end }}
{{- with .facebook -}}
{{- range $attr, $val := . }}
{{ with .facebook }}
{{ range $attr, $val := . }}
<meta property="fb:{{ $attr }}" content="{{ $val }}">
{{- end -}}
{{- end -}}
{{ end }}
{{ end }}
{{- end -}}
{{- end -}}
{{ end }}
{{ end }}

View File

@@ -1,4 +1,4 @@
{{- if .Site.Params.openGraph.enable }}
{{ if .Site.Params.openGraph.enable }}
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
<meta property="og:title" content="{{ .Title | default .Site.Title }}" />
<meta property="og:description" content="{{ .Description | default .Site.Params.Description }}" />
@@ -9,9 +9,9 @@
<meta property="og:url" content="{{ .Permalink }}"/>
<meta property="og:site_name" content="{{ .Site.Title }}" />
<meta property="og:locale" content="{{ .Site.LanguageCode }}"/>
{{- if .IsPage }}
{{ if .IsPage }}
<meta property="article:author" content="{{ .Params.Author | default .Site.Params.Author }}" />
<meta property="article:published_time" content="{{ .Date }}" />
<meta property="article:modified_time" content="{{ .Lastmod }}" />
{{- end }}
{{- end }}
{{ end }}
{{ end }}

View File

@@ -1,31 +1,31 @@
<!-- Plugin style files -->
{{- $cssRes := .Site.Data.resources.css }}
{{- $vendor := .Site.Params.vendors.plugins }}
{{- $router := .Scratch.Get "router" }}
{{ $cssRes := .Site.Data.resources.css }}
{{ $vendor := .Site.Params.vendors.plugins }}
{{ $router := .Scratch.Get "router" }}
{{- range $css := $cssRes }}
{{ range $css := $cssRes }}
{{ $pluginCss := partial "_funs/get_res.html" (dict "res" . "vendor" $vendor "router" $router) }}
<link type="text/css" rel="stylesheet" href="{{ $pluginCss }}" />
{{- end }}
{{ end }}
<!-- Main Style file -->
{{- $scss := resources.Get "css/main.scss" }}
{{- $scss = $scss | resources.ExecuteAsTemplate "main.scss" . }}
{{- $css := $scss | toCSS (dict "targetPath" "/css/main.css" "outputStyle" "expanded") }}
{{- if hugo.IsProduction }}
{{- $css = $css | minify | fingerprint }}
{{- end }}
{{ $scss := resources.Get "css/main.scss" }}
{{ $scss = $scss | resources.ExecuteAsTemplate "main.scss" . }}
{{ $css := $scss | toCSS (dict "targetPath" "/css/main.css" "outputStyle" "expanded") }}
{{ if hugo.IsProduction }}
{{ $css = $css | minify | fingerprint }}
{{ end }}
<link rel="stylesheet" href="{{ $css.RelPermalink }}">
{{- if .IsPage }}
{{ if .IsPage }}
<style type="text/css">
.post-footer, .flinks-list-footer hr:after {
content: "{{ .Site.Params.postFooter.endLineTip }}";
}
</style>
{{- end }}
{{ end }}
{{- $custom := .Scratch.Get "style" }}
{{- if $custom }}
{{ $custom := .Scratch.Get "style" }}
{{ if $custom }}
<link rel="stylesheet" type="text/css" href="{{ $custom }}">
{{- end }}
{{ end }}

View File

@@ -1,5 +1,5 @@
{{- with .Site.Params.openGraph.twitter }}
{{- $img := $.Params.openGraph.twitter.image | default ($.Scratch.Get "metaImg") }}
{{ with .Site.Params.openGraph.twitter }}
{{ $img := $.Params.openGraph.twitter.image | default ($.Scratch.Get "metaImg") }}
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:creator" content="{{ .creator }}"/>
<meta name="twitter:description" content="{{ with $.Page.Description }}{{ . }}{{ else }}{{if $.Page.IsPage}}{{ .Summary }}{{ else }}{{ $.Params.description }}{{ end }}{{ end }}"/>

View File

@@ -1,14 +1,14 @@
{{ if .IsHome }}
{{- with .Site.Params.googleSiteVerification }}
{{ with .Site.Params.googleSiteVerification }}
<meta name="google-site-verification" content="{{ . }}">
{{- end }}
{{- with .Site.Params.bingSiteVerification }}
{{ end }}
{{ with .Site.Params.bingSiteVerification }}
<meta name="msvalidate.01" content="{{ . }}">
{{- end }}
{{- with .Site.Params.yandexSiteVerification }}
{{ end }}
{{ with .Site.Params.yandexSiteVerification }}
<meta name="yandex-verification" content="{{ . }}">
{{- end }}
{{- with .Site.Params.baiduSiteVerification }}
{{ end }}
{{ with .Site.Params.baiduSiteVerification }}
<meta name="baidu-site-verification" content="{{ . }}">
{{- end }}
{{ end }}
{{ end }}

View File

@@ -1,3 +1,3 @@
{{ partial "header/brand.html" . }}
{{ partialCached "header/brand.html" . }}
{{ partial "header/menus.html" . }}
{{ partial "header/search.html" . }}
{{ partialCached "header/search.html" . }}

View File

@@ -9,9 +9,9 @@
</div>
<div class="site-meta">
{{- if and .Site.Params.customLogo (eq .Site.Params.scheme "Muse") }}
{{ if and .Site.Params.customLogo (eq .Site.Params.scheme "Muse") }}
<img class="custom-logo-image" src="{{ .Site.Params.customLogo }}" alt="{{ $title }}">
{{- end }}
{{ end }}
<a href="{{ "/" | relLangURL }}" class="brand" rel="start">
<i class="logo-line"></i>
@@ -20,17 +20,17 @@
</a>
{{ if isset .Site.Params "subtitle" }}
<p class="site-subtitle" itemprop="description">{{ .Site.Params.subtitle }}</p>
{{- end }}
{{- if and .Site.Params.customLogo (or (eq .Site.Params.scheme "Gemini") (eq .Site.Params.scheme "Pisces"))}}
{{ end }}
{{ if and .Site.Params.customLogo (or (eq .Site.Params.scheme "Gemini") (eq .Site.Params.scheme "Pisces"))}}
<img class="custom-logo-image" src="{{ .Site.Params.customLogo }}" alt="{{ $title }}">
{{- end }}
{{ end }}
</div>
<div class="site-nav-right">
<div class="toggle popup-trigger">
{{ if or .Site.Params.algoliaSearch.enable .Site.Params.localSearch.enable }}
<i class="fa fa-search fa-fw fa-lg"></i>
{{- end }}
{{ end }}
</div>
</div>
</div>

View File

@@ -1,25 +1,25 @@
{{- $ms := .Site.Params.menuSets }}
{{- $curP := .Page }}
{{ $ms := .Site.Params.menuSets }}
{{ $curP := .Page }}
<nav class="site-nav">
<ul class="main-menu menu">
{{- range .Site.Menus.main }}
{{- $active := $curP.IsMenuCurrent "main" . }}
{{ range .Site.Menus.main }}
{{ $active := $curP.IsMenuCurrent "main" . }}
<li class="menu-item menu-item-{{ .Identifier }}">
<a href="{{ .URL | relLangURL }}" class="hvr-icon-pulse {{if $active }} menu-item-active{{ end }}" rel="section">
{{- if $ms.icons }}<i class="fa fa-{{ .Pre }} hvr-icon"></i>{{ end }}{{- .Name }}
{{- if and $ms.badges (eq .Identifier "archives") }}
{{ if $ms.icons }}<i class="fa fa-{{ .Pre }} hvr-icon"></i>{{ end }}{{ .Name }}
{{ if and $ms.badges (eq .Identifier "archives") }}
<span class="badge">{{ $.Scratch.Get "postsCount" }}</span>
{{- end }}
{{ end }}
</a>
</li>
{{- end }}
{{ end }}
{{- if or .Site.Params.algoliaSearch.enable .Site.Params.localSearch.enable }}
{{ if or .Site.Params.algoliaSearch.enable .Site.Params.localSearch.enable }}
<li class="menu-item menu-item-search">
<a role="button" class="popup-trigger hvr-icon-pulse">
{{- if $ms.icons }}<i class="fa fa-search fa-fw hvr-icon"></i>{{ end }}{{ T "MSearchLabel" }}
{{ if $ms.icons }}<i class="fa fa-search fa-fw hvr-icon"></i>{{ end }}{{ T "Sidebar.label.search" }}
</a>
</li>
{{- end }}
{{ end }}
</ul>
</nav>

View File

@@ -1,11 +1,11 @@
{{- if or .Site.Params.algoliaSearch.enable .Site.Params.localSearch.enable }}
{{ if or .Site.Params.algoliaSearch.enable .Site.Params.localSearch.enable }}
<div class="search-pop-overlay">
<div class="popup search-popup">
{{- if .Site.Params.algoliaSearch.enable }}
{{ if .Site.Params.algoliaSearch.enable }}
{{ partial "_thirdparty/search/algolia.html" . }}
{{- else if .Site.Params.localSearch.enable }}
{{ else if .Site.Params.localSearch.enable }}
{{ partial "_thirdparty/search/local.html" . }}
{{- end }}
{{ end }}
</div>
</div>
{{- end }}
{{ end }}

View File

@@ -1,82 +0,0 @@
{{- $SP := .Site.Params -}}
<aside class="sidebar">
<div class="sidebar-inner sidebar-overview-active">
<ul class="sidebar-nav">
<li class="sidebar-nav-toc">{{ T "TableOfContents" }}</li>
<li class="sidebar-nav-overview">{{ T "SiteInfo" }}</li>
</ul>
<div class="sidebar-panel-container">
<div class="post-toc-wrap sidebar-panel">
</div>
<div class="site-overview-wrap sidebar-panel">
<div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
<img class="site-author-image" itemprop="image" alt="{{ $SP.author }}" src="{{ $SP.avatar.url }}">
<p class="site-author-name" itemprop="name">{{ $SP.author }}</p>
<div class="site-description" itemprop="description">{{ $SP.description }}</div>
</div>
<div class="site-state-wrap site-overview-item animated">
{{- if $SP.siteState }}
<nav class="site-state">
<div class="site-state-item site-state-posts">
<a href="{{ "/archives/" | relLangURL }}">
<span class="site-state-item-count">{{ len (where .Site.RegularPages "Section" "in" .Site.Params.mainSections) }}</span>
<span class="site-state-item-name">{{ T "SitePostsTitle" }}</span>
</a>
</div>
<div class="site-state-item site-state-categories">
<a href="{{ "/categories/" | relLangURL }}">
<span class="site-state-item-count">{{ len .Site.Taxonomies.categories }}</span>
<span class="site-state-item-name">{{ T "SiteCatesTitle" }}</span>
</a>
</div>
<div class="site-state-item site-state-tags">
<a href="{{ "/tags/" | relLangURL }}">
<span class="site-state-item-count">{{ len .Site.Taxonomies.tags }}</span>
<span class="site-state-item-name">{{ T "SiteTagsTitle" }}</span>
</a>
</div>
</nav>
{{- end }}
<div class="rss-link">
<a href="{{ "/index.xml" | relLangURL }}" rel="alternate" type="application/rss+xml" target="_blank">
<i class="fa fa-rss"></i>
{{ T "RSSTitle" }}
</a>
</div>
</div>
<div class="links-of-social site-overview-item animated">
{{ $si := $SP.socialIcons }}
{{- range $SP.socials }}
{{- range $name,$val := . }}
{{- $vals := split $val "||" }}
{{- $url := trim (index $vals 0) " " }}
{{- $icon := trim (index $vals 1) " " }}
<span class="links-of-social-item">
<a href="{{- $url }}" title="{{- $name }} → {{- $url }}" rel="noopener" {{- if and $si.enable $si.transition }} class="hvr-icon-pulse" {{- end }} target="_blank">
{{- if $si.enable }}
<i class="{{- $icon }} fa-fw {{ if $si.transition }} hvr-icon {{ end }}"></i>
{{- end }}
{{- if or (not $si.enable) (not $si.iconsOnly) }}
{{- $name }}
{{- end }}
</a>
</span>
{{- end }}
{{- end }}
</div>
{{- $cc := $SP.creativeCommons }}
{{- if and $cc $cc.sidebar }}
<div class="cc-license animated" itemprop="license">
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.{{ substr .Site.Language 0 2 }}" class="cc-opacity" rel="noopener" target="_blank" title="{{ T "CCLinkTitle" }}">
<img src="/imgs/cc/{{ $cc.size }}/{{ replace $cc.license "-" "_" }}.svg" alt="{{ T "CCLinkTitle" }}">
</a>
</div>
{{ end }}
</div>
</div>
<div class="back-to-top" role="button" aria-label="返回顶部">
<i class="fa fa-arrow-up"></i>
<span>0%</span>
</div>
</div>
</aside>

View File

@@ -14,7 +14,9 @@
{{ $globalVars := newScratch }}
{{ $globalVars.Set "postsCount" (len (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections)) }}
{{ $pages := (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections) }}
{{ $globalVars.Set "pages" $pages}}
{{ $globalVars.Set "postsCount" (len $pages)}}
{{ $globalVars.Set "catsCount" (len .Site.Taxonomies.categories) }}
{{ $globalVars.Set "tagsCount" (len .Site.Taxonomies.tags) }}
@@ -37,10 +39,10 @@
"lazyload" .Site.Params.lazyload
"motion" .Site.Params.motion
"i18n" (dict
"placeholder" (T "SearchPh")
"empty" (T "SearchEmpty")
"hits_time" (T "SearchHitsTime")
"hits" (T "SearchHits")
"placeholder" (T "Search.placeholder")
"empty" (T "Search.empty")
"hits_time" (T "Search.time")
"hits" (T "Search.hits")
"ds_years" (T "DateSuffix.years")
"ds_days" (T "DateSuffix.days")
"ds_hours" (T "DateSuffix.hours")
@@ -58,6 +60,16 @@
{{ $config = merge $config $localSearch }}
{{ end }}
{{ with .Site.Params.postMeta }}
{{ $postmeta := dict
"views" .views
"comments" .comments
}}
{{ $config = merge $config (dict "postmeta" $postmeta) }}
{{ else }}
{{ end }}
{{ if .Site.Params.algoliaSearch.enable }}
{{ $algoliaSearch := dict
"js" .Site.Data.resources.algolia
@@ -114,6 +126,19 @@
{{ $config = merge $config (dict "addthis" $addthis) }}
{{ end }}
{{ with .Site.Params.siteState.statistic }}
{{ $statis := dict "statis" . }}
{{ $config = merge $config $statis }}
{{ end }}
{{ with .Site.Params.analytics.laId }}
{{ $lawidget := dict
"js" $.Site.Data.resources.analytics.laWidget
"id" .
}}
{{ $config = merge $config (dict "lawidget" $lawidget) }}
{{ end }}
{{ $globalVars.Set "config" $config }}
{{ with .Site.Params.customFilePath }}
@@ -122,4 +147,10 @@
{{ end }}
{{ end }}
{{ $theme := "light" }}
{{ if .Site.Params.darkmode }}
{{ $theme = "dark" }}
{{ end }}
{{ $globalVars.Set "theme" $theme }}
{{ return $globalVars.Values }}

View File

@@ -12,16 +12,16 @@
</time>
</div>
<div class="post-title">
{{- if isset .Params "extlink" }}
{{ if isset .Params "extlink" }}
<a href="{{ .Params.extlink }}" rel="noopener external nofollow noreferrer" target="_blank" class="exturl post-title-link post-title-link-external" title="">
<span itemprop="name">{{- .Title -}}</span>
<span itemprop="name">{{ .Title }}</span>
<i class="fa fa-external-link-alt"></i>
</a>
{{- else }}
{{ else }}
<a class="post-title-link" href="{{ .RelPermalink | relLangURL }}" itemprop="url">
<span itemprop="name">{{ .Title }}</span>
</a>
{{- end }}
{{ end }}
</div>
</header>
</article>

Some files were not shown because too many files have changed in this diff Show More