Merge branch 'release_v4.4.0'
Some checks failed
sync-2-gitee / sync-2-gitee (push) Failing after 3s

This commit is contained in:
凡梦星尘 2022-10-30 21:21:00 +08:00
commit 21395a0263
73 changed files with 974 additions and 1666 deletions

4
.gitignore vendored
View File

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

View File

@ -112,10 +112,12 @@ tags:
#expand: true #expand: true
# It's means that will redirecting to external links # It's means that will redirecting to external links
#extlink: #extlink:
# Switch to enabled or disabled comment plugins in this post # Disabled comment plugins in this post
#comment: #comment:
# enable: false # 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 #toc: false
# Absolute link for visit # Absolute link for visit
#url: "{{ lower .Name }}.html" #url: "{{ lower .Name }}.html"

View File

@ -120,10 +120,11 @@ tags:
#expand: true #expand: true
# 外部链接地址,访问时直接跳转 # 外部链接地址,访问时直接跳转
#extlink: #extlink:
# 在当前页面开启或关闭评论功能 # 在当前页面关闭评论功能
#comment: #comment:
# enable: false # enable: false
# 开启文章目录功能 # 关闭当前页面目录功能
# 注意正常情况下文章中有H2-H4标题会自动生成目录无需额外配置
#toc: false #toc: false
# 绝对访问路径 # 绝对访问路径
#url: "{{ lower .Name }}.html" #url: "{{ lower .Name }}.html"

View File

@ -1 +1 @@
4.3.1 4.4.0

View File

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

View File

@ -42,6 +42,7 @@
} }
} }
@if $toc_number {
.autonumber { .autonumber {
h2 { h2 {
counter-reset: h3; counter-reset: h3;
@ -67,6 +68,7 @@
} }
} }
} }
}
@import 'post-collapse'; @import 'post-collapse';
@import 'post-body'; @import 'post-body';

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,7 @@
.site-author-image { .site-author-image {
border: $site-author-image-border-width solid $site-author-image-border-color; 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; padding: 2px;
@if $avatar_rounded { @if $avatar_rounded {

View File

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

View File

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

View File

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

@ -70,6 +70,7 @@ $social_icons_only : {{ $P.socialIcons.iconsOnly }};
$social_icons_transition : {{ $P.socialIcons.transition }}; $social_icons_transition : {{ $P.socialIcons.transition }};
$links_settings_layout : {{ $P.linksSets.layout }}; $links_settings_layout : {{ $P.linksSets.layout }};
$toc_enable : {{ $P.toc.enable }}; $toc_enable : {{ $P.toc.enable }};
$toc_number : {{ $P.toc.number }};
$toc_expand_all : {{ $P.toc.expandAll }}; $toc_expand_all : {{ $P.toc.expandAll }};
$toc_wrap : {{ $P.toc.wrap }}; $toc_wrap : {{ $P.toc.wrap }};

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() { (function() {
const className = 'next-config'; const className = 'next-config';

View File

@ -1,15 +1,28 @@
/* global NexT, CONFIG */ /* boot starup */
NexT.boot = {}; (function () {
const onPageLoaded = () => document.dispatchEvent(
new Event('page:loaded', {
bubbles: true
})
);
NexT.boot.activeThemeMode = function(){ if (document.readyState === 'loading') {
NexT.utils.activeThemeMode(); document.addEventListener('readystatechange', onPageLoaded, { once: true });
}; } else {
onPageLoaded();
}
document.addEventListener('pjax:success', onPageLoaded);
})();
NexT.boot.registerEvents = function() { NexT.boot.registerEvents = function() {
NexT.utils.registerImageLoadEvent();
NexT.utils.registerScrollPercent(); NexT.utils.registerScrollPercent();
// NexT.utils.registerCanIUseTag(); // NexT.utils.registerCanIUseTag();
NexT.utils.registerToolButtons();
// Register comment's components
NexT.plugins.register();
// Mobile top menu bar. // Mobile top menu bar.
document.querySelector('.site-nav-toggle .toggle').addEventListener('click', event => { document.querySelector('.site-nav-toggle .toggle').addEventListener('click', event => {
@ -37,14 +50,11 @@ NexT.boot.registerEvents = function() {
NexT.boot.refresh = function() { NexT.boot.refresh = function() {
NexT.utils.calSiteInfo(); NexT.utils.fmtSiteInfo();
NexT.utils.regSwitchThemeBtn();
if (!NexT.CONFIG.page.isPage) return; if (!NexT.CONFIG.page.isPage) return;
NexT.utils.registerSidebarTOC(); NexT.utils.registerSidebarTOC();
NexT.utils.replacePostCRLink();
NexT.utils.registerCopyCode(); NexT.utils.registerCopyCode();
NexT.utils.registerPostReward(); NexT.utils.registerPostReward();
if(NexT.CONFIG.page.comments) { if(NexT.CONFIG.page.comments) {
@ -54,6 +64,7 @@ NexT.boot.refresh = function() {
} else { } else {
NexT.utils.hideCommontes(); NexT.utils.hideCommontes();
} }
NexT.utils.registerImageViewer();
//TODO //TODO
/** /**
@ -88,7 +99,6 @@ NexT.boot.motion = function() {
}; };
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
NexT.boot.activeThemeMode();
NexT.boot.registerEvents(); NexT.boot.registerEvents();
NexT.boot.motion(); NexT.boot.motion();
NexT.boot.refresh(); NexT.boot.refresh();

View File

@ -1,13 +1,9 @@
document.addEventListener('DOMContentLoaded', () => { /* Artalk comment plugin */
NexT.plugins.comments.artalk = function() {
const element = '.artalk-container'; const element = '.artalk-container';
if (!NexT.CONFIG.page.comments if (!NexT.CONFIG.artalk
|| !NexT.CONFIG.artalk
|| !NexT.utils.checkDOMExist(element)) return; || !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 artalk_js = NexT.utils.getCDNResource(NexT.CONFIG.artalk.js);
const { const {
site, site,
@ -15,10 +11,10 @@ document.addEventListener('DOMContentLoaded', () => {
server, server,
} = NexT.CONFIG.artalk.cfg; } = NexT.CONFIG.artalk.cfg;
NexT.utils.loadComments(element) NexT.utils.lazyLoadComponent(element, function() {
.then(() => NexT.utils.getScript(artalk_js, { NexT.utils.getScript(artalk_js, function(){
})) const artalk_css = NexT.utils.getCDNResource(NexT.CONFIG.artalk.css);
.then(() => { NexT.utils.getStyle(artalk_css);
new Artalk({ new Artalk({
el : element, el : element,
@ -30,7 +26,8 @@ document.addEventListener('DOMContentLoaded', () => {
placeholder : placeholder, placeholder : placeholder,
darkMode : 'auto' 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'; const element = '.giscus-container';
if (!NexT.CONFIG.page.comments if (!NexT.CONFIG.page.comments
|| !NexT.CONFIG.giscus || !NexT.CONFIG.giscus
@ -17,8 +17,8 @@ document.addEventListener('DOMContentLoaded', () => {
theme } = NexT.CONFIG.giscus.cfg; theme } = NexT.CONFIG.giscus.cfg;
NexT.utils.loadComments(element) NexT.utils.lazyLoadComponent(element, function() {
.then(() => NexT.utils.getScript(NexT.CONFIG.giscus.js, { NexT.utils.getScript(NexT.CONFIG.giscus.js, {
attributes: { attributes: {
'async' : true, 'async' : true,
'crossorigin' : 'anonymous', 'crossorigin' : 'anonymous',
@ -35,7 +35,8 @@ document.addEventListener('DOMContentLoaded', () => {
'data-loading' : 'lazy' 'data-loading' : 'lazy'
}, },
parentNode: document.querySelector(element) parentNode: document.querySelector(element)
})); });
NexT.utils.hiddeLodingCmp(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'; const element = '#lv-container';
if (!NexT.CONFIG.page.comments if (!NexT.CONFIG.livere
|| !NexT.CONFIG.livere
|| !NexT.utils.checkDOMExist(element)) return; || !NexT.utils.checkDOMExist(element)) return;
NexT.utils.loadComments(element).then(() => { NexT.utils.lazyLoadComponent(element, function() {
NexT.utils.getScript(NexT.CONFIG.livere.js, { NexT.utils.getScript(NexT.CONFIG.livere.js, {
attributes: { attributes: {
async: true async: true
@ -15,4 +14,4 @@ document.addEventListener('DOMContentLoaded', () => {
NexT.utils.hiddeLodingCmp(element); 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'; const element = '.utterances-container';
if (!NexT.CONFIG.page.comments if (!NexT.CONFIG.utterances
|| !NexT.CONFIG.utterances
|| !NexT.utils.checkDOMExist(element)) return; || !NexT.utils.checkDOMExist(element)) return;
const { const {
@ -11,17 +10,19 @@ document.addEventListener('DOMContentLoaded', () => {
label, label,
theme } = NexT.CONFIG.utterances.cfg; theme } = NexT.CONFIG.utterances.cfg;
NexT.utils.loadComments(element) NexT.utils.lazyLoadComponent(element, function() {
.then(() => NexT.utils.getScript(NexT.CONFIG.utterances.js, { NexT.utils.getScript(NexT.CONFIG.utterances.js, {
attributes: { attributes: {
'async' : true, 'async' : true,
'crossorigin' : 'anonymous', 'crossorigin' : 'anonymous',
'repo' : repo, 'repo' : repo,
'issue-term' : issueterm, 'issue-term' : issueterm,
'label' : label,
'theme' : theme 'theme' : theme
}, },
parentNode: document.querySelector(element) parentNode: document.querySelector(element)
})); });
NexT.utils.hiddeLodingCmp(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'; const element = '.waline-container';
if (!NexT.CONFIG.page.comments if (!NexT.CONFIG.waline
|| !NexT.CONFIG.waline
|| !NexT.utils.checkDOMExist(element)) return; || !NexT.utils.checkDOMExist(element)) return;
const { const {
comment,
emoji, emoji,
imguploader, imguploader,
pageview, pageview,
@ -19,10 +19,6 @@ document.addEventListener('DOMContentLoaded', () => {
reactiontitle reactiontitle
} = NexT.CONFIG.waline.cfg; } = 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); const waline_js = NexT.utils.getCDNResource(NexT.CONFIG.waline.js);
let locale = { let locale = {
@ -35,15 +31,16 @@ document.addEventListener('DOMContentLoaded', () => {
locale['reaction'+index] = value; locale['reaction'+index] = value;
}); });
NexT.utils.loadComments(element) NexT.utils.lazyLoadComponent(element, function () {
.then(() => NexT.utils.getScript(waline_js, { NexT.utils.getScript(waline_js, function(){
})) const waline_css = NexT.utils.getCDNResource(NexT.CONFIG.waline.css);
.then(() => { NexT.utils.getStyle(waline_css, 'before');
Waline.init({ Waline.init({
locale, locale,
el : element, el : element,
pageview : pageview, pageview : pageview,
comment : comment,
emoji : emoji, emoji : emoji,
imageUploader : imguploader, imageUploader : imguploader,
wordLimit : wordlimit, wordLimit : wordlimit,
@ -55,5 +52,6 @@ document.addEventListener('DOMContentLoaded', () => {
}); });
NexT.utils.hiddeLodingCmp(element); NexT.utils.hiddeLodingCmp(element);
})
}); });
}); }

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

@ -0,0 +1,35 @@
/* Page's view & comment counter plugin */
NexT.plugins.others.counter = function() {
let busz_postview = false;
let pageview_js = undefined;
let comment_js = undefined;
const busz = NexT.CONFIG.busuanzi;
if (busz != undefined && busz.pageview) {
busz_postview = true;
}
// Here can append others pageview & comment plugin
const waline = NexT.CONFIG.waline;
if (waline != undefined){
if(!busz_postview && waline.cfg.pageview) {
pageview_js = NexT.utils.getCDNResource(NexT.CONFIG.page.waline.js[0]);
NexT.utils.getScript(pageview_js, function(){
Waline.pageviewCount({
serverURL: waline.cfg.serverurl
});
});
}
if (waline.cfg.comment) {
comment_js = NexT.utils.getCDNResource(NexT.CONFIG.page.waline.js[1]);
NexT.utils.getScript(comment_js, function(){
Waline.commentCount({
serverURL: 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 algoliajs = NexT.utils.getCDNResource(NexT.CONFIG.algolia.js);
const algoiajs = NexT.utils.getCDNResource(NexT.CONFIG.algolia.js);
const instantschjs = NexT.utils.getCDNResource(NexT.CONFIG.algolia.instantjs); const instantschjs = NexT.utils.getCDNResource(NexT.CONFIG.algolia.instantjs);
NexT.utils.getScript(algoiajs, {}); NexT.utils.getScript(algoliajs);
NexT.utils.getScript(instantschjs, {}).then(() => { NexT.utils.getScript(instantschjs, function() {
const { indexname, appid, apikey, hits } = NexT.CONFIG.algolia.cfg; const { indexname, appid, apikey, hits } = NexT.CONFIG.algolia.cfg;
const indexName = indexname; const indexName = indexname;
@ -56,7 +55,7 @@ document.addEventListener('DOMContentLoaded', () => {
const stats = NexT.CONFIG.i18n.hits_time const stats = NexT.CONFIG.i18n.hits_time
.replace('${hits}', data.nbHits) .replace('${hits}', data.nbHits)
.replace('${time}', data.processingTimeMS); .replace('${time}', data.processingTimeMS);
return `<span>${stats}</span><img src="/imgs/algolia-logo.svg" alt="Algolia">`; return `${stats}`;
} }
}, },
cssClasses: { cssClasses: {
@ -138,7 +137,6 @@ document.addEventListener('DOMContentLoaded', () => {
onPopupClose(); onPopupClose();
} }
}); });
});; });
}
});

View File

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

View File

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

View File

@ -1,103 +1,73 @@
/* global NexT, CONFIG */ /* util tools */
HTMLElement.prototype.wrap = function(wrapper) { HTMLElement.prototype.wrap = function (wrapper) {
this.parentNode.insertBefore(wrapper, this); this.parentNode.insertBefore(wrapper, this);
this.parentNode.removeChild(this); this.parentNode.removeChild(this);
wrapper.appendChild(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 = { NexT.utils = {
registerImageLoadEvent: function() {
const images = document.querySelectorAll('.sidebar img, .post-block img, .vendors-list img');
regSwitchThemeBtn: function() { const callback = (entries) => {
const switchThemeBtn = document.getElementById('switch-theme'); entries.forEach(item => {
if (!switchThemeBtn) return; if (item.intersectionRatio > 0) {
switchThemeBtn.addEventListener('click', () => { let ele = item.target;
const colorTheme = document.documentElement.getAttribute('data-theme'); let imgSrc = ele.getAttribute('data-src');
NexT.utils.toggleDarkMode(!(colorTheme == 'dark')); if (imgSrc) {
let img = new Image();
}); img.addEventListener('load', function() {
}, ele.src = imgSrc;
}, false);
activeThemeMode: function() { ele.src = imgSrc;
// Prevent load image again
const useDark = window.matchMedia("(prefers-color-scheme: dark)"); ele.removeAttribute('data-src');
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);
});
},
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);
},
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');
}
},
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));
const observer = new IntersectionObserver(callback);
images.forEach(img => {
observer.observe(img);
});
}, },
getLocalStorage: function(key) { registerImageViewer: function() {
const itemStr = localStorage.getItem(key); new Viewer(document.querySelector('.post-body'),{ navbar:2, toolbar:2 });
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) { 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');
});
},
slidScrollBarAnime: function (targetId, easing = 'linear', duration = 500) {
window.anime({
targets: document.scrollingElement,
duration: duration,
easing: easing,
scrollTop: targetId == '' ? 0 : document.getElementById(targetId).getBoundingClientRect().top + window.scrollY
});
},
domAddClass: function (selector, cls) {
const doms = document.querySelectorAll(selector); const doms = document.querySelectorAll(selector);
if (doms) { if (doms) {
doms.forEach(dom => { doms.forEach(dom => {
@ -106,18 +76,18 @@ NexT.utils = {
} }
}, },
calSiteInfo: function() { fmtSiteInfo: function () {
const runtimeCount = document.getElementById('runTimes'); const runtimeCount = document.getElementById('runTimes');
if (runtimeCount) { if (runtimeCount) {
const publishDate = runtimeCount.getAttribute('data-publishDate'); const publishDate = runtimeCount.getAttribute('data-publishDate');
const runTimes = NexT.utils.diffDate(publishDate, 2); const runTimes = this.diffDate(publishDate, 2);
runtimeCount.innerText = runTimes; runtimeCount.innerText = runTimes;
} }
const wordsCount = document.getElementById('wordsCount'); const wordsCount = document.getElementById('wordsCount');
if (wordsCount) { if (wordsCount) {
const words = wordsCount.getAttribute('data-count'); const words = wordsCount.getAttribute('data-count');
wordsCount.innerText = NexT.utils.numberFormat(words); wordsCount.innerText = this.numberFormat(words);
} }
const readTimes = document.getElementById('readTimes'); const readTimes = document.getElementById('readTimes');
@ -132,7 +102,7 @@ NexT.utils = {
let timesLabel; let timesLabel;
if (daysCount >= 1) { 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) { } else if (hoursCount >= 1) {
timesLabel = hoursCount + NexT.CONFIG.i18n.ds_hours + (times - hoursCount * hour) + NexT.CONFIG.i18n.ds_mins; timesLabel = hoursCount + NexT.CONFIG.i18n.ds_hours + (times - hoursCount * hour) + NexT.CONFIG.i18n.ds_mins;
} else { } else {
@ -144,35 +114,39 @@ NexT.utils = {
const lastPushDate = document.getElementById('last-push-date'); const lastPushDate = document.getElementById('last-push-date');
if (lastPushDate) { if (lastPushDate) {
const pushDateVal = NexT.utils.diffDate(lastPushDate.getAttribute('data-lastPushDate'), 1); const pushDateVal = this.diffDate(lastPushDate.getAttribute('data-lastPushDate'), 1);
lastPushDate.innerText = pushDateVal; lastPushDate.innerText = pushDateVal;
} }
},
const statisWidget = document.querySelectorAll('#la-siteinfo-widget span'); fmtLaWidget: function(){
if (statisWidget.length > 0) { setTimeout(function(){
const valIds = [0,2,4,6]; const laWidget = document.querySelectorAll('#la-siteinfo-widget span');
const domIds = ['today_site_pv', 'yesterday_site_pv', 'month_site_pv', 'total_site_pv'] if (laWidget.length > 0) {
for (var i in valIds) { const valIds = [0, 2, 4, 6];
let pv = NexT.utils.numberFormat(statisWidget[valIds[i]].innerText); const domIds = ['today_site_pv', 'yesterday_site_pv', 'month_site_pv', 'total_site_pv']
document.getElementById(domIds[i]).innerText = pv; for (let i in valIds) {
let pv = NexT.utils.numberFormat(laWidget[valIds[i]].innerText);
document.getElementById(domIds[i]).innerText = pv;
}
} }
} }, 800);
setTimeout(()=>{ NexT.utils.fmtBusuanzi(); }, 500);
}, },
fmtBusuanzi: function() { fmtBusuanzi: function () {
const bszUV = document.getElementById('busuanzi_value_site_uv'); setTimeout(function(){
if (bszUV) { const bszUV = document.getElementById('busuanzi_value_site_uv');
bszUV.innerText = NexT.utils.numberFormat(bszUV.innerText); if (bszUV) {
} bszUV.innerText = NexT.utils.numberFormat(bszUV.innerText);
const bszPV = document.getElementById('busuanzi_value_site_pv'); }
if (bszPV) { const bszPV = document.getElementById('busuanzi_value_site_pv');
bszPV.innerText = NexT.utils.numberFormat(bszPV.innerText); if (bszPV) {
} bszPV.innerText = NexT.utils.numberFormat(bszPV.innerText);
}
}, 800);
}, },
numberFormat: function(number) { numberFormat: function (number) {
let result; let result;
if (number.indexOf(',') > 0) { if (number.indexOf(',') > 0) {
number = number.replaceAll(",", ""); number = number.replaceAll(",", "");
@ -188,7 +162,7 @@ NexT.utils = {
return result; return result;
}, },
diffDate: function(date, mode = 0) { diffDate: function (date, mode = 0) {
const dateNow = new Date(); const dateNow = new Date();
const datePost = new Date(date); const datePost = new Date(date);
const dateDiff = dateNow.getTime() - datePost.getTime(); const dateDiff = dateNow.getTime() - datePost.getTime();
@ -221,10 +195,10 @@ NexT.utils = {
} else if (mode == 2) { } else if (mode == 2) {
const yearCount = parseInt(dateDiff / year); const yearCount = parseInt(dateDiff / year);
if (yearCount >= 1) { 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; result = yearCount + NexT.CONFIG.i18n.ds_years + dayCount + NexT.CONFIG.i18n.ds_days;
} else { } else {
const dayCount = parseInt(dateDiff/day); const dayCount = parseInt(dateDiff / day);
result = dayCount + NexT.CONFIG.i18n.ds_days; result = dayCount + NexT.CONFIG.i18n.ds_days;
} }
} else { } else {
@ -234,20 +208,26 @@ NexT.utils = {
return result; return result;
}, },
checkDOMExist: function(selector) { checkDOMExist: function (selector) {
return document.querySelector(selector) != null; return document.querySelector(selector) != null;
}, },
getCDNResource: function(res) { getCDNResource: function (res) {
let { plugins, router } = NexT.CONFIG.vendor; let { plugins, router } = NexT.CONFIG.vendor;
let { name, version, file, alias } = res; let { name, version, file, alias, alias_name } = res;
let npm_name = name; let npm_name = name;
if (alias_name) npm_name = alias_name;
let res_src = ''; let res_src = '';
switch(plugins) { switch (plugins) {
case 'cdnjs': case 'cdnjs':
case 'bootcdn':
case 'qiniu':
let cdnjs_name = alias || name; 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}` res_src = `${router}/${cdnjs_name}/${version}/${cdnjs_file}`
break; break;
default: default:
@ -257,23 +237,10 @@ NexT.utils = {
return res_src; 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. * One-click copy code support.
*/ */
registerCopyCode: function() { registerCopyCode: function () {
if (!NexT.CONFIG.copybtn) return; if (!NexT.CONFIG.copybtn) return;
let figure = document.querySelectorAll('.highlight pre'); let figure = document.querySelectorAll('.highlight pre');
@ -320,7 +287,7 @@ NexT.utils = {
}); });
}, },
wrapTableWithBox: function() { wrapTableWithBox: function () {
document.querySelectorAll('table').forEach(element => { document.querySelectorAll('table').forEach(element => {
const box = document.createElement('div'); const box = document.createElement('div');
box.className = 'table-container'; box.className = 'table-container';
@ -328,7 +295,7 @@ NexT.utils = {
}); });
}, },
registerVideoIframe: function() { registerVideoIframe: function () {
document.querySelectorAll('iframe').forEach(element => { document.querySelectorAll('iframe').forEach(element => {
const supported = [ const supported = [
'www.youtube.com', 'www.youtube.com',
@ -350,7 +317,7 @@ NexT.utils = {
}); });
}, },
registerScrollPercent: function() { registerScrollPercent: function () {
const backToTop = document.querySelector('.back-to-top'); const backToTop = document.querySelector('.back-to-top');
const readingProgressBar = document.querySelector('.reading-progress-bar'); const readingProgressBar = document.querySelector('.reading-progress-bar');
// For init back to top in sidebar if page was scrolled after page refresh. // For init back to top in sidebar if page was scrolled after page refresh.
@ -379,21 +346,12 @@ NexT.utils = {
} }
this.activateNavByIndex(index); this.activateNavByIndex(index);
}, { passive: true }); }, { passive: true });
backToTop && backToTop.addEventListener('click', () => {
window.anime({
targets : document.scrollingElement,
duration : 500,
easing : 'linear',
scrollTop: 0
});
});
}, },
/** /**
* Tabs tag listener (without twitter bootstrap). * Tabs tag listener (without twitter bootstrap).
*/ */
registerTabsTag: function() { registerTabsTag: function () {
// Binding `nav-tabs` & `tab-content` by real time permalink changing. // Binding `nav-tabs` & `tab-content` by real time permalink changing.
document.querySelectorAll('.tabs ul.nav-tabs .tab').forEach(element => { document.querySelectorAll('.tabs ul.nav-tabs .tab').forEach(element => {
element.addEventListener('click', event => { element.addEventListener('click', event => {
@ -408,7 +366,7 @@ NexT.utils = {
// https://stackoverflow.com/questions/20306204/using-queryselector-with-ids-that-are-numbers // https://stackoverflow.com/questions/20306204/using-queryselector-with-ids-that-are-numbers
const tActive = document.getElementById(element.querySelector('a').getAttribute('href').replace('#', '')); const tActive = document.getElementById(element.querySelector('a').getAttribute('href').replace('#', ''));
[...tActive.parentNode.children].forEach(target => { [...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); target.classList.toggle('active', target === tActive);
}); });
// Trigger event // Trigger event
@ -418,9 +376,9 @@ NexT.utils = {
if (!NexT.CONFIG.stickytabs) return; if (!NexT.CONFIG.stickytabs) return;
const offset = nav.parentNode.getBoundingClientRect().top + window.scrollY + 10; const offset = nav.parentNode.getBoundingClientRect().top + window.scrollY + 10;
window.anime({ window.anime({
targets : document.scrollingElement, targets: document.scrollingElement,
duration : 500, duration: 500,
easing : 'linear', easing: 'linear',
scrollTop: offset scrollTop: offset
}); });
}); });
@ -429,7 +387,7 @@ NexT.utils = {
window.dispatchEvent(new Event('tabs:register')); window.dispatchEvent(new Event('tabs:register'));
}, },
registerCanIUseTag: function() { registerCanIUseTag: function () {
// Get responsive height passed from iframe. // Get responsive height passed from iframe.
window.addEventListener('message', ({ data }) => { window.addEventListener('message', ({ data }) => {
if (typeof data === 'string' && data.includes('ciu_embed')) { if (typeof data === 'string' && data.includes('ciu_embed')) {
@ -463,19 +421,25 @@ NexT.utils = {
}); });
},*/ },*/
registerSidebarTOC: function() { registerSidebarTOC: function () {
this.sections = [...document.querySelectorAll('.post-toc li a.nav-link')].map(element => { 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('#', '')); const target = document.getElementById(decodeURI(element.getAttribute('href')).replace('#', ''));
// TOC item animation navigate. // TOC item animation navigate.
element.addEventListener('click', event => { element.addEventListener('click', event => {
event.preventDefault(); event.preventDefault();
const offset = target.getBoundingClientRect().top + window.scrollY; const offset = target.getBoundingClientRect().top + window.scrollY;
window.anime({ window.anime({
targets : document.scrollingElement, targets: document.scrollingElement,
duration : 500, duration: 500,
easing : 'linear', easing: 'linear',
scrollTop: offset, scrollTop: offset,
complete : () => { complete: () => {
history.pushState(null, document.title, element.href); history.pushState(null, document.title, element.href);
} }
}); });
@ -484,7 +448,7 @@ NexT.utils = {
}); });
}, },
registerPostReward: function() { registerPostReward: function () {
const button = document.querySelector('.reward-container button'); const button = document.querySelector('.reward-container button');
if (!button) return; if (!button) return;
button.addEventListener('click', () => { button.addEventListener('click', () => {
@ -492,22 +456,22 @@ NexT.utils = {
}); });
}, },
initCommontesDispaly: function(){ initCommontesDispaly: function () {
const comms = document.querySelectorAll('.comment-wrap > div'); const comms = document.querySelectorAll('.comment-wrap > div');
if (comms.length<=1) return; if (comms.length <= 1) return;
comms.forEach(function(item){ comms.forEach(function (item) {
var dis = window.getComputedStyle(item, null).display; let dis = window.getComputedStyle(item, null).display;
item.style.display = dis; item.style.display = dis;
}); });
}, },
registerCommonSwitch: function() { registerCommonSwitch: function () {
const button = document.querySelector('.comment-switch .switch-btn'); const button = document.querySelector('.comment-switch .switch-btn');
if (!button) return; if (!button) return;
const comms = document.querySelectorAll('.comment-wrap > div'); const comms = document.querySelectorAll('.comment-wrap > div');
button.addEventListener('click', () => { button.addEventListener('click', () => {
button.classList.toggle('move'); button.classList.toggle('move');
comms.forEach(function(item){ comms.forEach(function (item) {
if (item.style.display === 'none') { if (item.style.display === 'none') {
item.style.cssText = "display: block; animation: tabshow .8s"; item.style.cssText = "display: block; animation: tabshow .8s";
} else { } else {
@ -517,17 +481,17 @@ NexT.utils = {
}); });
}, },
hideCommontes:function() { hideCommontes: function () {
document.querySelector('.post-comments').style.display = 'none'; document.querySelector('.post-comments').style.display = 'none';
}, },
hiddeLodingCmp: function(selector) { hiddeLodingCmp: function (selector) {
const loadding = document.querySelector(selector).previousElementSibling; const loadding = document.querySelector(selector).previousElementSibling;
loadding.style.display = 'none'; loadding.style.display = 'none';
}, },
activateNavByIndex: function(index) { activateNavByIndex: function (index) {
const target = document.querySelectorAll('.post-toc li a.nav-link')[index]; const target = document.querySelectorAll('.post-toc li a')[index];
if (!target || target.classList.contains('active-current')) return; if (!target || target.classList.contains('active-current')) return;
document.querySelectorAll('.post-toc .active').forEach(element => { document.querySelectorAll('.post-toc .active').forEach(element => {
@ -543,14 +507,14 @@ NexT.utils = {
const tocElement = document.querySelector('.sidebar-panel-container'); const tocElement = document.querySelector('.sidebar-panel-container');
if (!tocElement.parentNode.classList.contains('sidebar-toc-active')) return; if (!tocElement.parentNode.classList.contains('sidebar-toc-active')) return;
window.anime({ window.anime({
targets : tocElement, targets: tocElement,
duration : 200, duration: 200,
easing : 'linear', easing: 'linear',
scrollTop: tocElement.scrollTop - (tocElement.offsetHeight / 2) + target.getBoundingClientRect().top - tocElement.getBoundingClientRect().top 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; 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. // Expand sidebar on post detail page by default, when post has a toc.
const hasTOC = document.querySelector('.post-toc'); const hasTOC = document.querySelector('.post-toc');
@ -564,7 +528,7 @@ NexT.utils = {
} }
}, },
activateSidebarPanel: function(index) { activateSidebarPanel: function (index) {
const duration = 200; const duration = 200;
const sidebar = document.querySelector('.sidebar-inner'); const sidebar = document.querySelector('.sidebar-inner');
const panel = document.querySelector('.sidebar-panel-container'); const panel = document.querySelector('.sidebar-panel-container');
@ -574,34 +538,39 @@ NexT.utils = {
window.anime({ window.anime({
duration, duration,
targets : panel, targets: panel,
easing : 'linear', easing: 'linear',
opacity : 0, opacity: 0,
translateY: [0, -20], translateY: [0, -20],
complete : () => { complete: () => {
// Prevent adding TOC to Overview if Overview was selected when close & open sidebar. // Prevent adding TOC to Overview if Overview was selected when close & open sidebar.
sidebar.classList.replace(activeClassName[1 - index], activeClassName[index]); sidebar.classList.replace(activeClassName[1 - index], activeClassName[index]);
window.anime({ window.anime({
duration, duration,
targets : panel, targets: panel,
easing : 'linear', easing: 'linear',
opacity : [0, 1], opacity: [0, 1],
translateY: [-20, 0] translateY: [-20, 0]
}); });
} }
}); });
}, },
getStyle: function(src, parent) { getStyle: function (src, position='after', parent) {
const link = document.createElement('link'); const link = document.createElement('link');
link.setAttribute('rel', 'stylesheet'); link.setAttribute('rel', 'stylesheet');
link.setAttribute('type', 'text/css'); link.setAttribute('type', 'text/css');
link.setAttribute('href', src); 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') { if (typeof options === 'function') {
return this.getScript(src, { return this.getScript(src, {
condition: legacyCondition condition: legacyCondition
@ -653,9 +622,9 @@ NexT.utils = {
}); });
}, },
loadComments: function(selector, legacyCallback) { lazyLoadComponent: function(selector, legacyCallback) {
if (legacyCallback) { if (legacyCallback) {
return this.loadComments(selector).then(legacyCallback); return this.lazyLoadComponent(selector).then(legacyCallback);
} }
return new Promise(resolve => { return new Promise(resolve => {
const element = document.querySelector(selector); const element = document.querySelector(selector);

View File

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

View File

@ -3,6 +3,8 @@
vendors: vendors:
cdnjs: "https://cdnjs.cloudflare.com/ajax/libs" cdnjs: "https://cdnjs.cloudflare.com/ajax/libs"
unpkg: "https://unpkg.com" unpkg: "https://unpkg.com"
bootcdn: "https://cdn.bootcdn.net/ajax/libs"
qiniu: "https://cdn.staticfile.org"
# JavaScript 资源 # JavaScript 资源
# JavaScript Resources # JavaScript Resources
@ -10,6 +12,9 @@ js:
- name: animejs - name: animejs
version: 3.2.1 version: 3.2.1
file: lib/anime.min.js file: lib/anime.min.js
- name: viewerjs
version: 1.11.0
file: dist/viewer.min.js
# CSS 资源 # CSS 资源
# CSS Resources # CSS Resources
@ -21,6 +26,9 @@ css:
- name: animate.css - name: animate.css
version: 3.1.1 version: 3.1.1
file: animate.min.css file: animate.min.css
- name: viewerjs
version: 1.11.0
file: dist/viewer.min.css
# 第三方服务组件资源 # 第三方服务组件资源
# 3rd servcies Resource # 3rd servcies Resource
@ -44,12 +52,12 @@ addthis:
waline: waline:
js: js:
name: '@waline/client' name: '@waline/client'
version: 2.11.3 version: 2.13.0
file: dist/waline.js file: dist/waline.js
alias: waline alias: waline
css: css:
name: '@waline/client' name: '@waline/client'
version: 2.11.3 version: 2.13.0
file: dist/waline.css file: dist/waline.css
alias: waline alias: waline
@ -76,38 +84,51 @@ livere:
# Full text search # Full text search
algolia: algolia:
name: algoliasearch name: algoliasearch
version: 4.13.0 version: 4.14.2
file: dist/algoliasearch-lite.umd.js file: dist/algoliasearch-lite.umd.js
instant: instant:
name: instantsearch.js name: instantsearch.js
version: 4.40.5 version: 4.49.0
file: dist/instantsearch.production.min.js file: dist/instantsearch.production.min.js
plugins: plugins:
# 数学公式渲染 # 数学公式渲染
mathjax: mathjax:
js: js:
- name: mathjax name: mathjax
version: 3.2.0 version: 3.2.0
file: es5/tex-mml-chtml.js file: es5/tex-mml-chtml.js
katex: katex:
js: js:
- name: katex - name: katex
version: 0.16.0 version: 0.16.0
file: dist/katex.min.js file: dist/katex.min.js
- name: auto-render - name: auto-render
alias2: katex alias_name: katex
version: 0.16.0 version: 0.16.0
file: dist/contrib/auto-render.min.js file: dist/contrib/auto-render.min.js
css: css:
- name: katex name: katex
version: 0.16.0 version: 0.16.0
file: dist/katex.min.css file: dist/katex.min.css
# 画图渲染 # 画图渲染
mermaid: mermaid:
js: js:
- name: mermaid name: mermaid
version: 9.1.7 version: 9.1.7
file: dist/mermaid.min.js 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: renderer:
unsafe: true unsafe: true
highlight: highlight:
# codeFences: true
# lineNos: true
# lineNumbersInTable: true
# noClasses: true
# # 高亮代码的样式名称可选monokai | emacs | api | dracula | friendly # # 高亮代码的样式名称可选monokai | emacs | api | dracula | friendly
# # 更多的样式https://xyproto.github.io/splash/docs/all.html # # 更多的样式https://xyproto.github.io/splash/docs/all.html
# # Highlight style: monokai | emacs | api | dracula | friendly # # Highlight style: monokai | emacs | api | dracula | friendly
@ -107,6 +103,7 @@ enableRobotsTXT: true
# 强制输出时压缩文件 # 强制输出时压缩文件
# Compress all files when output # Compress all files when output
minify: minify:
minifyOutput: true
#-------------------------------------- #--------------------------------------
# 菜单配置说明 # 菜单配置说明
@ -306,7 +303,7 @@ params:
enable: true enable: true
# 组件类型,可选值为: 51la, busuanzi # 组件类型,可选值为: 51la, busuanzi
# 使用51la时需要注册账号https://invite.51.la/1NUfGTS1?target=V6 # 使用51la时需要注册账号https://invite.51.la/1NUfGTS1?target=V6
# Plguin value is: 51la, busuzazi # Plguin value is: 51la, busuanzi
plugin: busuanzi plugin: busuanzi
# 社交链接地址 # 社交链接地址
@ -813,7 +810,8 @@ params:
# Waline comments system # Waline comments system
# More info seee: https://waline.js.org/ # More info seee: https://waline.js.org/
waline: waline:
pageView: '#waline-pageview-count' pageView: true
comment: true
placeholder: "请文明发言哟 ヾ(≧▽≦*)o" placeholder: "请文明发言哟 ヾ(≧▽≦*)o"
sofa: "快来发表你的意见吧 (≧∀≦)ゞ" sofa: "快来发表你的意见吧 (≧∀≦)ゞ"
emoji: false emoji: false
@ -1095,14 +1093,15 @@ params:
# --------------------------------------------------------------- # ---------------------------------------------------------------
vendors: vendors:
vendors:
# The CDN provider of NexT internal scripts. # 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` # Warning: If you are using the latest master branch of NexT, please set `internal: local`
internal: local internal: local
# The default CDN provider of third-party plugins. # 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 # Dependencies for `plugins: local`: https://github.com/next-theme/plugins
plugins: unpkg plugins: qiniu
# TODO # TODO
# Custom CDN URL # Custom CDN URL
# For example: # For example:

View File

@ -34,22 +34,22 @@ math: mathjax
**注意:** 使用[支持的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} } } } \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) \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`
$$ $$
@ -76,24 +76,24 @@ $$
\displaystyle= \frac{(k+1)((k+1)+1)}{2} \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} $$ 然后是更多的文本。 这是一些线性数学: $$ k_{n+1} = n^2 + k_n^2 - k_{n-1} $$ 然后是更多的文本。
## 希腊字母 ### 希腊字母
$$ $$
\Gamma\ \Delta\ \Theta\ \Lambda\ \Xi\ \Pi\ \Sigma\ \Upsilon\ \Phi\ \Psi\ \Omega \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 \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 \gets\ \to\ \leftarrow\ \rightarrow\ \uparrow\ \Uparrow\ \downarrow\ \Downarrow\ \updownarrow\ \Updownarrow
$$ $$
@ -122,7 +122,7 @@ $$
$$ $$
## 微积分学 ### 微积分学
$$ $$
\int u \frac{dv}{dx}\,dx=uv-\int \frac{du}{dx}v\,dx \int u \frac{dv}{dx}\,dx=uv-\int \frac{du}{dx}v\,dx
$$ $$
@ -136,13 +136,13 @@ $$
$$ $$
## 洛伦茨方程 ### 洛伦茨方程
$$ $$
\begin{aligned} \dot{x} & = \sigma(y-x) \\\\ \dot{y} & = \rho x - y - xz \\\\ \dot{z} & = -\beta z + xy \end{aligned} \begin{aligned} \dot{x} & = \sigma(y-x) \\\\ \dot{y} & = \rho x - y - xz \\\\ \dot{z} & = -\beta z + xy \end{aligned}
$$ $$
## 交叉乘积 ### 交叉乘积
这在KaTeX中是可行的但在这种环境中馏分的分离不是很好。 这在KaTeX中是可行的但在这种环境中馏分的分离不是很好。
$$ $$
@ -162,25 +162,25 @@ $$
$$ $$
## 有弹性的括号 ### 有弹性的括号
$$ $$
\left(\frac{x^2}{y^3}\right) \left(\frac{x^2}{y^3}\right)
$$ $$
## 评估范围 ### 评估范围
$$ $$
\left.\frac{x^3}{3}\right|_0^1 \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} 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} \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 +194,19 @@ $$
{n \choose k} {n \choose k}
$$ $$
## 分数在分数 ### 分数在分数
$$ $$
\frac{\frac{1}{x}+\frac{1}{y}}{y-z} \frac{\frac{1}{x}+\frac{1}{y}}{y-z}
$$ $$
## n次方根 ### n次方根
$$ $$
\sqrt[n]{1+x+x^2+x^3+\ldots} \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{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} \begin{bmatrix} 0 & \cdots & 0 \\\\ \vdots & \ddots & \vdots \\\\ 0 & \cdots & 0 \end{bmatrix}

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

@ -93,6 +93,8 @@ PostReadTime:
other: "{{- .ReadingTime -}}min" other: "{{- .ReadingTime -}}min"
PostViews: PostViews:
other: "Views" other: "Views"
PostComments:
other: "Comments"
PostTag: PostTag:
other: "Tags" other: "Tags"
PostReadMore: PostReadMore:

View File

@ -94,6 +94,8 @@ PostReadTime:
other: "{{- .ReadingTime -}}分钟" other: "{{- .ReadingTime -}}分钟"
PostViews: PostViews:
other: 浏览 other: 浏览
PostComments:
other: 评论
PostTags: PostTags:
other: 标签 other: 标签
PostReadMore: PostReadMore:

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,8 +1,10 @@
{{- range $k, $v := (partialCached "init.html" .) -}} {{- range $k, $v := (partialCached "init.html" .) -}}
{{- $.Scratch.Set $k $v -}} {{- $.Scratch.Set $k $v -}}
{{- end -}} {{- end -}}
{{ $commentEnable := .Params.comment.enable | default .Site.Params.comments.enable }}
{{ .Scratch.Set "isComment" $commentEnable }}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}"> <html lang="{{ .Site.LanguageCode }}" data-theme="{{ .Scratch.Get "theme" }}">
<head> <head>
{{- partial "head.html" . }} {{- partial "head.html" . }}
@ -29,7 +31,7 @@
<div class="main-inner {{ block "main_inner_class" . }}{{ end }}"> <div class="main-inner {{ block "main_inner_class" . }}{{ end }}">
<!-- Submenu,Content,Comment --> <!-- Submenu,Content,Comment -->
{{- block "main" . }}{{- end }} {{- block "main" . }}{{- end }}
{{- if .IsPage }} {{- if and .IsPage $commentEnable }}
{{- partialCached "comments.html" . }} {{- partialCached "comments.html" . }}
{{- end }} {{- end }}
</div> </div>

View File

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

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

@ -8,7 +8,7 @@
{{ end }} {{ end }}
{{- $file := .res.file }} {{- $file := .res.file }}
{{- if eq .vendor "cdnjs" }} {{- if ne .vendor "unpkg" }}
{{- with .res.alias }} {{- with .res.alias }}
{{- $npm = . }} {{- $npm = . }}
{{- end }} {{- end }}

View File

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

View File

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

View File

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

View File

@ -1,18 +1,18 @@
<script type="text/javascript"> <script type="text/javascript">
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
var script = document.createElement('script'); var script = document.createElement('script');
script.charset = "UTF-8"; script.charset = "UTF-8";
script.src = "{{ .Site.Data.resources.analytics.google }}{{ .Site.Params.analytics.google }}"; script.src = "{{ .Site.Data.resources.analytics.google }}{{ .Site.Params.analytics.google }}";
script.async = "true" script.async = "true"
script.onload = function() { script.onload = function() {
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);} function gtag(){dataLayer.push(arguments);}
gtag('js', new Date()); 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> </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> </span>
</div> </div>
<div class="search-result-container"> <div class="search-result-container">
<div class="algolia-stats"><hr></div>
<div class="algolia-hits"></div> <div class="algolia-hits"></div>
<div class="algolia-pagination"></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> </div>

View File

@ -1,6 +1,6 @@
{{- $ft := .Site.Params.footer }} {{- $ft := .Site.Params.footer }}
{{ if $ft.translate }} {{ if $ft.translate }}
<div class="google-translate"> <div id="gtranslate" class="google-translate">
<i class="fa fa-language"></i> <i class="fa fa-language"></i>
<div id="google_translate_element"></div> <div id="google_translate_element"></div>
</div> </div>
@ -24,32 +24,6 @@
</span> </span>
<span class="author" itemprop="copyrightHolder">{{ $ft.copyright | default .Site.Params.author }}</span> <span class="author" itemprop="copyrightHolder">{{ $ft.copyright | default .Site.Params.author }}</span>
</div> </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"> <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 }} {{ $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 }}
@ -71,7 +45,7 @@
{{- range .list }} {{- range .list }}
<a target="_blank" href="{{ .link }}" title="{{ .name }}"> <a target="_blank" href="{{ .link }}" title="{{ .name }}">
{{- if .image }} {{- if .image }}
<img src="{{ .image.url }}" alt="{{ .name }}" /> <img src="/imgs/img-lazy-loading.gif" data-src="{{ .image.url }}" alt="{{ .name }}" />
{{- else }} {{- else }}
{{ .name }} {{ .name }}
{{- end }} {{- end }}

View File

@ -5,6 +5,61 @@
{{- partial "head/facebook.html" . }} {{- partial "head/facebook.html" . }}
{{- partialCached "head/verify.html" . }} {{- partialCached "head/verify.html" . }}
{{- partialCached "head/style.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" . }} {{- partial "head/config.html" . }}
{{- partialCached "head/analytics.html" . }} {{- partialCached "head/analytics.html" . }}

View File

@ -1,10 +1,40 @@
<script class="next-config" data-name="page" type="application/json"> {{- $pageCfg := dict
{{- dict
"isHome" .IsHome "isHome" .IsHome
"isPage" .IsPage "isPage" .IsPage
"comments" (.Params.comments | default .Site.Params.comments.enable) "comments" (.Scratch.Get "isComment")
"permalink" (.Page.Permalink | absURL) "permalink" (.Page.Permalink | absURL)
"path" (.Page.Permalink | path.Base) "path" (.Page.Permalink | path.Base)
"title" .Page.Title "title" .Page.Title
-}} -}}
</script>
{{/* Append waline pageview & comment plugin */}}
{{ if and .Site.Params.waline ( or .Site.Params.waline.pageView .Site.Params.waline.comment) }}
{{ $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,3 +1,3 @@
{{ partial "header/brand.html" . }} {{ partialCached "header/brand.html" . }}
{{ partial "header/menus.html" . }} {{ partial "header/menus.html" . }}
{{ partial "header/search.html" . }} {{ partialCached "header/search.html" . }}

View File

@ -114,6 +114,24 @@
{{ $config = merge $config (dict "addthis" $addthis) }} {{ $config = merge $config (dict "addthis" $addthis) }}
{{ end }} {{ 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 }}
{{ with .Site.Params.analytics.busuanzi }}
{{ $busz := dict "pageview" .postViews }}
{{ $config = merge $config (dict "busuanzi" $busz) }}
{{ end }}
{{ $globalVars.Set "config" $config }} {{ $globalVars.Set "config" $config }}
{{ with .Site.Params.customFilePath }} {{ with .Site.Params.customFilePath }}
@ -122,4 +140,10 @@
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ $theme := "light" }}
{{ if .Site.Params.darkmode }}
{{ $theme = "dark" }}
{{ end }}
{{ $globalVars.Set "theme" $theme }}
{{ return $globalVars.Values }} {{ return $globalVars.Values }}

View File

@ -11,7 +11,7 @@
{{- $pay := replace $name $fw ($fw | upper) 1 }} {{- $pay := replace $name $fw ($fw | upper) 1 }}
{{- $payName := T (printf "Reward%s" $pay) }} {{- $payName := T (printf "Reward%s" $pay) }}
<div class="post-reward-item"> <div class="post-reward-item">
<img src="{{ $img }}" alt="{{ $.Site.Params.author }} - {{ $payName }}"> <img src="/imgs/img-lazy-loading.gif" data-src="{{ $img }}" alt="{{ $.Site.Params.author }} - {{ $payName }}">
<span>{{ $payName }}</span> <span>{{ $payName }}</span>
</div> </div>
{{- end }} {{- end }}

View File

@ -27,12 +27,25 @@
{{ partial "post/header_meta/created_date.html" . }} {{ partial "post/header_meta/created_date.html" . }}
{{ partial "post/header_meta/update_date.html" . }} {{ partial "post/header_meta/update_date.html" . }}
{{ partial "post/header_meta/categories.html" . }} {{ partial "post/header_meta/categories.html" . }}
{{ if and $.IsHome (not (isset .Params "extlink")) }}
<div class="post-meta-items">
{{ if and (eq .Site.Params.analytis.busuanzi.enable false) .Site.Params.waline.pageView }}
{{ partial "post/header_meta/views.html" . }}
{{ end }}
{{ if and (.Scratch.Get "isComment") .Site.Params.waline.comment }}
{{ partial "post/header_meta/comments.html" . }}
{{ end }}
</div>
{{ end }}
</div> </div>
{{- if not $.IsHome }} {{- if not $.IsHome }}
<div class="post-meta-items"> <div class="post-meta-items">
{{ partial "post/header_meta/words.html" . }} {{ partial "post/header_meta/words.html" . }}
{{ partial "post/header_meta/readtime.html" . }} {{ partial "post/header_meta/readtime.html" . }}
{{ partial "post/header_meta/views.html" . }} {{ partial "post/header_meta/views.html" . }}
{{ if and (.Scratch.Get "isComment") .Site.Params.waline.comment }}
{{ partial "post/header_meta/comments.html" . }}
{{ end }}
</div> </div>
{{ end }} {{ end }}
</div> </div>

View File

@ -0,0 +1,11 @@
<span class="post-meta-item" title="{{ T "PostComments" }}">
<span class="post-meta-item-icon">
<i class="far fa-comments"></i>
</span>
<span class="post-meta-item-text">
{{ print (T "PostComments") (T "SymbolColon") }}
</span>
<span {{ with .Site.Params.waline.comment }}class="waline-comment-count"{{end}} data-path="{{ .RelPermalink | relLangURL }}">
<i class="fa fa-sync fa-spin"></i>
</span>
</span>

View File

@ -2,9 +2,6 @@
{{- if .Site.Params.leancloudVisitors.enable }} {{- if .Site.Params.leancloudVisitors.enable }}
{{- $pageViewId = "leancloud-visitors-count" }} {{- $pageViewId = "leancloud-visitors-count" }}
{{- end }} {{- end }}
{{- if .Site.Params.waline.pageView }}
{{- $pageViewId = "waline-pageview-count" }}
{{- end }}
{{- if .Site.Params.analytics.busuanzi.postViews }} {{- if .Site.Params.analytics.busuanzi.postViews }}
{{- $pageViewId = "busuanzi_value_page_pv" }} {{- $pageViewId = "busuanzi_value_page_pv" }}
{{- end }} {{- end }}
@ -15,5 +12,7 @@
<span class="post-meta-item-text"> <span class="post-meta-item-text">
{{ print (T "PostViews") (T "SymbolColon") }} {{ print (T "PostViews") (T "SymbolColon") }}
</span> </span>
<span id="{{ $pageViewId }}" data-path="{{ .RelPermalink | relLangURL }}"><i class="fa fa-sync fa-spin"></i></span> <span {{ with $pageViewId }}id="{{ . }}"{{end}} {{ with .Site.Params.waline.pageView }}class="waline-pageview-count"{{end}} data-path="{{ .RelPermalink | relLangURL }}">
<i class="fa fa-sync fa-spin"></i>
</span>
</span> </span>

View File

@ -1,15 +1,2 @@
{{ partialCached "scripts/global.html" . }} {{- partialCached "scripts/global.html" . -}}
{{- partial "scripts/plugins.html" . -}}
{{ if or .Params.math .Site.Params.math }}
{{ partialCached "_thirdparty/others/math.html" . }}
{{ end }}
{{ if .Params.mermaid }}
{{ partialCached "_thirdparty/others/mermaid.html" . }}
{{ end }}

View File

@ -1,79 +1,101 @@
{{- $jsRes := .Site.Data.resources.js }} {{/* Loading all page need scripts */}}
{{- $vendor := .Site.Params.vendors.plugins }} {{ $jsRes := .Site.Data.resources.js }}
{{- $router := .Scratch.Get "router" }} {{ $vendor := .Site.Params.vendors.plugins }}
{{- range $jsRes }} {{ $router := .Scratch.Get "router" }}
{{ range $jsRes }}
{{ $pluginJS := partial "_funs/get_res.html" (dict "res" . "vendor" $vendor "router" $router) }} {{ $pluginJS := partial "_funs/get_res.html" (dict "res" . "vendor" $vendor "router" $router) }}
<script type="text/javascript" src="{{ $pluginJS }}" defer></script> <script type="text/javascript" src="{{ $pluginJS }}" defer></script>
{{- end }} {{ end }}
<script class="next-config" data-name="main" type="application/json">{{- .Scratch.Get "config" -}}</script> <script class="next-config" data-name="main" type="application/json">{{ .Scratch.Get "config" -}}</script>
{{- $config := resources.Get "js/config.js" }} {{/* Core scripts */}}
{{- $motion := resources.Get "js/motion.js" }} {{ $config := resources.Get "js/config.js" }}
{{- $boot := resources.Get "js/next-boot.js" }} {{ $utils := resources.Get "js/utils.js" }}
{{- $utils := resources.Get "js/utils.js" }} {{ $boot := resources.Get "js/next-boot.js" }}
{{- $nextjs := (slice $config $utils $boot ) }} {{ $nextjs := slice $config $utils $boot }}
{{- if .Site.Params.motion.enable }}
{{/* Animation scripts */}}
{{ if .Site.Params.motion.enable }}
{{ $motionjs := resources.Get "js/motion.js" }} {{ $motionjs := resources.Get "js/motion.js" }}
{{ $nextjs = $nextjs | append $motionjs }} {{ $nextjs = $nextjs | append $motionjs }}
{{- end }} {{ end }}
{{- if or (eq .Site.Params.shceme "Muse") (eq .Site.Params.shceme "Mist") }}
{{/* Special scheme scripts */}}
{{ if or (eq .Site.Params.shceme "Muse") (eq .Site.Params.shceme "Mist") }}
{{ $musejs := resources.Get "js/schemes/muse.js" }} {{ $musejs := resources.Get "js/schemes/muse.js" }}
{{ $nextjs = $nextjs | append $musejs }} {{ $nextjs = $nextjs | append $musejs }}
{{- end }}
{{- if .Site.Params.bookmark.enable }}
{{- $bookmarkjs := resources.Get "js/bookmark.js" }}
{{- $nextjs = $nextjs | append $bookmarkjs }}
{{- end }}
{{- if .Site.Params.pjax }}
{{- $pjaxjs := resources.Get "js/pjax.js" }}
{{- $nextjs = $nextjs | append $pjaxjs }}
{{- end }}
{{- if isset .Site.Params "addthisid" }}
{{- $addthisjs := resources.Get "js/third-party/share/addthis.js" }}
{{- $nextjs = $nextjs | append $addthisjs }}
{{- end }}
{{- if isset .Site.Params "waline" }}
{{- $walinejs := resources.Get "js/third-party/comments/waline.js" }}
{{- $nextjs = $nextjs | append $walinejs }}
{{- end }}
{{- if isset .Site.Params "giscus" }}
{{- $giscusjs := resources.Get "js/third-party/comments/giscus.js" }}
{{- $nextjs = $nextjs | append $giscusjs }}
{{- end }}
{{- if isset .Site.Params "livere" }}
{{- $liverejs := resources.Get "js/third-party/comments/livere.js" }}
{{- $nextjs = $nextjs | append $liverejs }}
{{- end }}
{{- if isset .Site.Params "artalk" }}
{{- $artalkjs := resources.Get "js/third-party/comments/artalk.js" }}
{{- $nextjs = $nextjs | append $artalkjs }}
{{- end }}
{{- if isset .Site.Params "utterances" }}
{{- $utterancesjs := resources.Get "js/third-party/comments/utterances.js" }}
{{- $nextjs = $nextjs | append $utterancesjs }}
{{- end }}
{{- if .Site.Params.localSearch.enable }}
{{- $search := resources.Get "js/third-party/search/local.js" }}
{{- $nextjs = $nextjs | append $search }}
{{ end }} {{ end }}
{{- if .Site.Params.algoliaSearch.enable }}
{{- $search := resources.Get "js/third-party/search/algolia.js" }} {{/* Bookmark scripts */}}
{{- $nextjs = $nextjs | append $search }} {{ if .Site.Params.bookmark.enable }}
{{ $bookmarkjs := resources.Get "js/bookmark.js" }}
{{ $nextjs = $nextjs | append $bookmarkjs }}
{{ end }}
{{/* Pjax scripts */}}
{{ if .Site.Params.pjax }}
{{ $pjaxjs := resources.Get "js/pjax.js" }}
{{ $nextjs = $nextjs | append $pjaxjs }}
{{ end }}
{{/* Share scripts */}}
{{ if isset .Site.Params "addthisid" }}
{{ $addthisjs := resources.Get "js/third-party/share/addthis.js" }}
{{ $nextjs = $nextjs | append $addthisjs }}
{{ end }}
{{/* Comments scripts */}}
{{ if isset .Site.Params "waline" }}
{{ $walinejs := resources.Get "js/third-party/comments/waline.js" }}
{{ $nextjs = $nextjs | append $walinejs }}
{{ if or .Site.Params.waline.pageView .Site.Params.waline.comment }}
{{ $counterjs := resources.Get "js/third-party/others/counter.js" }}
{{ $nextjs = $nextjs | append $counterjs }}
{{ end }}
{{ end }}
{{ if isset .Site.Params "giscus" }}
{{ $giscusjs := resources.Get "js/third-party/comments/giscus.js" }}
{{ $nextjs = $nextjs | append $giscusjs }}
{{ end}}
{{ if isset .Site.Params "livere" }}
{{ $liverejs := resources.Get "js/third-party/comments/livere.js" }}
{{ $nextjs = $nextjs | append $liverejs }}
{{ end }}
{{ if isset .Site.Params "artalk" }}
{{ $artalkjs := resources.Get "js/third-party/comments/artalk.js" }}
{{ $nextjs = $nextjs | append $artalkjs }}
{{ end }}
{{ if isset .Site.Params "utterances" }}
{{ $utterancesjs := resources.Get "js/third-party/comments/utterances.js" }}
{{ $nextjs = $nextjs | append $utterancesjs }}
{{ end }}
{{/* Search engin scripts */}}
{{ if .Site.Params.localSearch.enable }}
{{ $search := resources.Get "js/third-party/search/local.js" }}
{{ $nextjs = $nextjs | append $search }}
{{ end }}
{{ if .Site.Params.algoliaSearch.enable }}
{{ $search := resources.Get "js/third-party/search/algolia.js" }}
{{ $nextjs = $nextjs | append $search }}
{{ end }}
{{/* Other not useful scripts, eg: 51la widget, translate */}}
{{ with .Site.Params.siteState.statistic }}
{{ if and .enable (eq .plugin "51la") }}
{{ $lawt := resources.Get "js/third-party/others/lawidget.js" }}
{{ $nextjs = $nextjs | append $lawt }}
{{ end }}
{{ end }} {{ end }}
{{ if .Site.Params.footer.translate }} {{ if .Site.Params.footer.translate }}
{{- $gt := resources.Get "js/third-party/others/google-translate.js" }} {{ $translate := resources.Get "js/third-party/others/translate.js" }}
{{- $nextjs = $nextjs | append $gt }} {{ $nextjs = $nextjs | append $translate }}
{{ $gtCss := resources.Get "css/gt.scss" }}
{{ $style := $gtCss | resources.ToCSS | minify }}
<script type="text/javascript">
window.translateelement_styles = "{{- $style.RelPermalink -}}";
</script>
{{ end }} {{ end }}
{{- $nextjs = $nextjs | resources.Concat "js/main.js"}}
{{ $nextjs = $nextjs | resources.Concat "js/main.js"}}
{{ if hugo.IsProduction }} {{ if hugo.IsProduction }}
{{- $nextjs = $nextjs | minify | fingerprint }} {{ $nextjs = $nextjs | minify | fingerprint }}
{{ end }} {{ end }}
<script type="text/javascript" src="{{ $nextjs.RelPermalink }}" defer></script> <script type="text/javascript" src="{{ $nextjs.RelPermalink }}" defer></script>

View File

@ -1,17 +1,9 @@
{{/* Defind loading plugin scripts which only need in pages */}}
{{- $vendor := .vendor }} {{ if or .Params.math .Site.Params.math }}
{{- $router := .router }} {{ partial "_funs/get_plugin.html" (dict "ctx" . "class" "others" "plugin" "math.js") }}
{{- $res := (index .res .index) }}
{{- $cssRes := $res.css }}
{{ if $cssRes }}
{{ range $cssRes }}
{{ $css := partial "_funs/get_res.html" (dict "res" . "vendor" $vendor "router" $router) }}
<link type="text/css" rel="stylesheet" href="{{ $css }}"/>
{{ end }}
{{ end }}
{{- $jsRes := $res.js }}
{{ range $jsRes }}
{{ $js := partial "_funs/get_res.html" (dict "res" . "vendor" $vendor "router" $router) }}
<script type="text/javascript" src="{{ $js }}"></script>
{{ end }} {{ end }}
{{ if .Params.mermaid }}
{{ partial "_funs/get_plugin.html" (dict "ctx" . "class" "others" "plugin" "mermaid.js") }}
{{ end }}

View File

@ -4,7 +4,8 @@
<span class="toggle-line"></span> <span class="toggle-line"></span>
</div> </div>
<aside class="sidebar"> <aside class="sidebar">
{{ $tocEnable := .Params.toc | default .Site.Params.toc.enable }} {{ $tocEnable := and .IsPage .Params.toc | default .Site.Params.toc.enable }}
<div class="sidebar-inner {{ if $tocEnable }}sidebar-nav-active sidebar-toc-active{{ else }}sidebar-overview-active{{ end }}"> <div class="sidebar-inner {{ if $tocEnable }}sidebar-nav-active sidebar-toc-active{{ else }}sidebar-overview-active{{ end }}">
<ul class="sidebar-nav"> <ul class="sidebar-nav">
<li class="sidebar-nav-toc"> <li class="sidebar-nav-toc">
@ -17,9 +18,7 @@
<div class="sidebar-panel-container"> <div class="sidebar-panel-container">
<!--noindex--> <!--noindex-->
<div class="post-toc-wrap sidebar-panel"> <div class="post-toc-wrap sidebar-panel">
{{- if $tocEnable }}
<div class="post-toc animated">{{ .TableOfContents }}</div> <div class="post-toc animated">{{ .TableOfContents }}</div>
{{- end }}
</div> </div>
<!--/noindex--> <!--/noindex-->
<div class="site-overview-wrap sidebar-panel"> <div class="site-overview-wrap sidebar-panel">

View File

@ -2,7 +2,7 @@
<div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person"> <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
{{- with .Site.Params.avatar.url }} {{- with .Site.Params.avatar.url }}
<img class="site-author-image" itemprop="image" alt="{{ $author }}" <img class="site-author-image" itemprop="image" alt="{{ $author }}"
src="{{ . }}"> src="/imgs/img-lazy-loading.gif" data-src="{{ . }}">
{{- end }} {{- end }}
<p class="site-author-name" itemprop="name">{{ $author }}</p> <p class="site-author-name" itemprop="name">{{ $author }}</p>
<div class="site-description" itemprop="description">{{ .Site.Params.description }}</div> <div class="site-description" itemprop="description">{{ .Site.Params.description }}</div>
@ -64,7 +64,7 @@
{{- if .sidebar }} {{- if .sidebar }}
<div class="cc-license animated" itemprop="license"> <div class="cc-license animated" itemprop="license">
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.{{ substr $.Site.LanguageCode 0 2 }}" class="cc-opacity" rel="noopener" target="_blank" title="{{ T "CCLinkTitle" }}"> <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.{{ substr $.Site.LanguageCode 0 2 }}" class="cc-opacity" rel="noopener" target="_blank" title="{{ T "CCLinkTitle" }}">
<img src="/imgs/cc/{{ .size }}/{{ replace .license "-" "_" }}.svg" alt="{{ T "CCLinkTitle" }}"> <img src="/imgs/img-lazy-loading.gif" data-src="/imgs/cc/{{ .size }}/{{ replace .license "-" "_" }}.svg" alt="{{ T "CCLinkTitle" }}">
</a> </a>
</div> </div>
{{- end }} {{- end }}

View File

@ -1,5 +1,5 @@
{{ $scratch := partialCached "_funs/cal_siteinfo.html" . }} {{ $scratch := partialCached "_funs/cal_siteinfo.html" . }}
<div class="sidebar-card-widget"> <div id="siteinfo-card-widget" class="sidebar-card-widget">
<div class="item-headline"> <div class="item-headline">
<i class="fas fa-chart-line"></i> <i class="fas fa-chart-line"></i>
<span>{{ T "SiteInfoItems.title" }}</span> <span>{{ T "SiteInfoItems.title" }}</span>
@ -15,43 +15,41 @@
<div class="item-name"> <div class="item-name">
<i class="fas {{ .visitorsIcon }}"></i>{{ T "SiteInfoItems.visitors" }} <i class="fas {{ .visitorsIcon }}"></i>{{ T "SiteInfoItems.visitors" }}
</div> </div>
<div class="item-count" id="busuanzi_value_site_uv"></div> <div class="item-count" id="busuanzi_value_site_uv"><i class="fa fa-sync fa-spin"></i></div>
</div> </div>
<div class="siteinfo-item"> <div class="siteinfo-item">
<div class="item-name"> <div class="item-name">
<i class="fas {{ .viewsIcon }}"></i>{{ T "SiteInfoItems.pageViews" }} <i class="fas {{ .viewsIcon }}"></i>{{ T "SiteInfoItems.pageViews" }}
</div> </div>
<div class="item-count" id="busuanzi_value_site_pv"></div> <div class="item-count" id="busuanzi_value_site_pv"><i class="fa fa-sync fa-spin"></i></div>
</div> </div>
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if eq .Site.Params.siteState.statistic.plugin "51la" }} {{- if eq .Site.Params.siteState.statistic.plugin "51la" }}
<div id="la-siteinfo-widget" style="display: none;"> <div id="la-siteinfo-widget" style="display: none;"></div>
<script id="LA-DATA-WIDGET" crossorigin="anonymous" charset="UTF-8" src="{{ replace .Site.Data.resources.analytics.laWidget "laId" .Site.Params.analytics.laId }}"></script>
</div>
<div class="siteinfo-item"> <div class="siteinfo-item">
<div class="item-name"> <div class="item-name">
<i class="fa fa-user-plus"></i>{{ T "SiteInfoItems.todayViews" }} <i class="fa fa-user-plus"></i>{{ T "SiteInfoItems.todayViews" }}
</div> </div>
<div class="item-count" id="today_site_pv"></div> <div class="item-count" id="today_site_pv"><i class="fa fa-sync fa-spin"></i></div>
</div> </div>
<div class="siteinfo-item"> <div class="siteinfo-item">
<div class="item-name"> <div class="item-name">
<i class="fa fa-user-clock"></i>{{ T "SiteInfoItems.yesterdayViews" }} <i class="fa fa-user-clock"></i>{{ T "SiteInfoItems.yesterdayViews" }}
</div> </div>
<div class="item-count" id="yesterday_site_pv"></div> <div class="item-count" id="yesterday_site_pv"><i class="fa fa-sync fa-spin"></i></div>
</div> </div>
<div class="siteinfo-item"> <div class="siteinfo-item">
<div class="item-name"> <div class="item-name">
<i class="fa fa-arrows-down-to-people"></i>{{ T "SiteInfoItems.monthViews" }} <i class="fa fa-arrows-down-to-people"></i>{{ T "SiteInfoItems.monthViews" }}
</div> </div>
<div class="item-count" id="month_site_pv"></div> <div class="item-count" id="month_site_pv"><i class="fa fa-sync fa-spin"></i></div>
</div> </div>
<div class="siteinfo-item"> <div class="siteinfo-item">
<div class="item-name"> <div class="item-name">
<i class="fa fa-users"></i>{{ T "SiteInfoItems.totalViews" }} <i class="fa fa-users"></i>{{ T "SiteInfoItems.totalViews" }}
</div> </div>
<div class="item-count" id="total_site_pv"></div> <div class="item-count" id="total_site_pv"><i class="fa fa-sync fa-spin"></i></div>
</div> </div>
{{- end }} {{- end }}
<div class="siteinfo-item"> <div class="siteinfo-item">

View File

@ -1,15 +1,17 @@
<div class="tool-buttons" > <div class="tool-buttons" >
<a id="goto-comments" class="button goto-comments" href="#comments" title="{{ T "ToolBtns.comment" }}"> {{ if .Scratch.Get "isComment" }}
<div id="goto-comments" class="button goto-comments" title="{{ T "ToolBtns.comment" }}">
<i class="fas fa-comments"></i> <i class="fas fa-comments"></i>
</a> </div>
<div id="switch-theme" class="button" title="{{ T "ToolBtns.theme" }}"> {{ end }}
{{ if .Site.Params.footer.translate }}
<div id="goto-gtranslate" class="button" title="{{ T "ToolBtns.lang" }}">
<i class="fas fa-globe"></i>
</div>
{{ end }}
<div id="toggle-theme" class="button" title="{{ T "ToolBtns.theme" }}">
<i class="fas fa-adjust"></i> <i class="fas fa-adjust"></i>
</div> </div>
{{ if .Site.Params.footer.translate }}
<a class="button" href="#google_translate_element" title="{{ T "ToolBtns.lang" }}">
<i class="fas fa-globe"></i>
</a>
{{ end }}
{{- if and .Site.Params.backTop.enable (not .Site.Params.backTop.sidebar) }} {{- if and .Site.Params.backTop.enable (not .Site.Params.backTop.sidebar) }}
<div class="back-to-top" role="button" title="{{ T "ToolBtns.backTop" }}"> <div class="back-to-top" role="button" title="{{ T "ToolBtns.backTop" }}">
<i class="fa fa-arrow-up"></i> <i class="fa fa-arrow-up"></i>

1
static/css/google-translate.min.css vendored Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 996 KiB

View File

@ -0,0 +1 @@
(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='';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')}