🐛 Fix: use data attributes or class replace for custom attributes

This commit is contained in:
Cell
2022-08-26 16:25:41 +08:00
parent dfbffa2ad5
commit 0edd185b39
33 changed files with 128 additions and 130 deletions
+1
View File
@@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.
- :sparkles: Feat: add custom aside template in post page ([#172](https://github.com/hugo-fixit/FixIt/issues/172))
- :bug: Fix: add function doc2unix to unify new lines symbol between Windows and Unix/Mac OS
- :bug: Fix: author display error in post and markdown file
- :bug: Fix: use data attributes or class replace for custom attributes
- :art: Style: change the default icons of some social links
- :globe_with_meridians: Docs(i18n): update pt-br, de in i18n
- :wrench: Chore: modify babel config and optimize theme.js compilation and loading
+2 -2
View File
@@ -33,7 +33,7 @@ html {
::selection {
background-color: $selection-color;
[theme='dark'] & {
[data-theme='dark'] & {
background-color: $selection-color-dark;
}
}
@@ -44,7 +44,7 @@ body {
@include overflow-wrap(break-word);
scrollbar-color: auto;
&[theme='dark'] {
&[data-theme='dark'] {
color: $global-font-color-dark;
background-color: $global-background-color-dark;
}
+9 -9
View File
@@ -2,11 +2,11 @@
.page {
width: 60%;
[page-style='wide'] & {
[data-page-style='wide'] & {
width: 64%;
}
[page-style='narrow'] & {
[data-page-style='narrow'] & {
max-width: 800px;
}
}
@@ -14,11 +14,11 @@
aside {
width: 20%;
[page-style='wide'] & {
[data-page-style='wide'] & {
width: 18%;
}
[page-style='narrow'] & {
[data-page-style='narrow'] & {
width: calc(50% - 400px);
}
}
@@ -28,7 +28,7 @@
.page {
width: 56%;
[page-style='wide'] & {
[data-page-style='wide'] & {
width: 60%;
}
}
@@ -36,7 +36,7 @@
aside {
width: 22%;
[page-style='wide'] & {
[data-page-style='wide'] & {
width: 20%;
}
}
@@ -46,7 +46,7 @@
.page {
width: 52%;
[page-style='wide'] & {
[data-page-style='wide'] & {
width: 56%;
}
}
@@ -54,7 +54,7 @@
aside {
width: 24%;
[page-style='wide'] & {
[data-page-style='wide'] & {
width: 22%;
}
}
@@ -105,7 +105,7 @@
.content {
[id] {
[header-mobile='normal'] & {
[data-header-mobile='normal'] & {
scroll-margin-top: 0;
}
}
+2 -2
View File
@@ -6,7 +6,7 @@
color: if($light, $global-link-color, $single-link-color);
[theme='dark'] & {
[data-theme='dark'] & {
color: if($dark, $global-link-color-dark, $single-link-color-dark);
}
}
@@ -15,7 +15,7 @@
a:hover {
color: if($light, $global-link-hover-color, $single-link-hover-color);
[theme='dark'] & {
[data-theme='dark'] & {
color: if($dark, $global-link-hover-color-dark, $single-link-hover-color-dark);
}
}
+5 -5
View File
@@ -59,14 +59,14 @@
padding: 0.5rem;
color: $global-font-secondary-color;
[theme='dark'] & {
[data-theme='dark'] & {
color: $global-font-secondary-color-dark;
}
}
}
}
.home[posts] {
.home.posts {
.home-profile {
@include transform(translateY(0));
padding-top: 2rem;
@@ -82,7 +82,7 @@
color: $global-font-color;
border-bottom: 1px dashed $global-border-color;
[theme='dark'] & {
[data-theme='dark'] & {
color: $global-font-color-dark;
border-bottom: 1px dashed $global-border-color-dark;
}
@@ -128,7 +128,7 @@
@include overflow-wrap(break-word);
color: $global-font-secondary-color;
[theme='dark'] & {
[data-theme='dark'] & {
color: $global-font-secondary-color-dark;
}
@@ -158,7 +158,7 @@
strong {
color: $global-font-secondary-color;
[theme='dark'] & {
[data-theme='dark'] & {
color: $global-font-secondary-color-dark;
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
[id] {
scroll-margin-top: $header-height;
[header-desktop='normal'] & {
[data-header-desktop='normal'] & {
scroll-margin-top: 0;
}
}
+20 -20
View File
@@ -33,7 +33,7 @@
display: inline-block;
}
[theme='dark'] & {
[data-theme='dark'] & {
color: $global-font-secondary-color-dark;
}
@@ -52,7 +52,7 @@
object-position: center;
@include object-fit(cover);
[theme='dark'] & {
[data-theme='dark'] & {
border-color: $global-border-color-dark;
}
}
@@ -117,7 +117,7 @@
font-weight: bold;
margin: 1.2rem 0;
[theme='dark'] & {
[data-theme='dark'] & {
font-weight: bolder;
}
}
@@ -132,7 +132,7 @@
margin-right: 0.3125rem;
color: $single-link-color;
[theme='dark'] & {
[data-theme='dark'] & {
color: $single-link-color-dark;
}
}
@@ -150,7 +150,7 @@
strong {
font-weight: bold;
[theme='dark'] & {
[data-theme='dark'] & {
color: #ddd;
}
}
@@ -161,14 +161,14 @@
white-space: normal;
@include overflow-wrap(break-word);
[theme='dark'] & b,
[theme='dark'] & strong {
[data-theme='dark'] & b,
[data-theme='dark'] & strong {
color: $single-link-color-dark;
}
}
[theme='dark'] a:hover b,
[theme='dark'] a:hover strong {
[data-theme='dark'] a:hover b,
[data-theme='dark'] a:hover strong {
color: $single-link-hover-color-dark;
}
@@ -189,7 +189,7 @@
color: $global-font-secondary-color;
}
[theme='dark'] & {
[data-theme='dark'] & {
background: $code-background-color-dark;
rt {
@@ -204,7 +204,7 @@
&::-webkit-scrollbar {
background-color: $table-background-color;
[theme='dark'] & {
[data-theme='dark'] & {
background-color: $table-background-color-dark;
}
}
@@ -217,14 +217,14 @@
background: $table-background-color;
border-collapse: collapse;
[theme='dark'] & {
[data-theme='dark'] & {
background: $table-background-color-dark;
}
thead {
background: $table-thead-color;
[theme='dark'] & {
[data-theme='dark'] & {
background-color: $table-thead-color-dark;
}
}
@@ -233,7 +233,7 @@
& tr:nth-child(odd) {
background: darken($table-background-color, 2.25%);
[theme='dark'] & {
[data-theme='dark'] & {
background-color: lighten($table-background-color-dark, 2.75%);
}
}
@@ -241,7 +241,7 @@
& tr:hover {
background: darken($table-background-color, 4.5%);
[theme='dark'] & {
[data-theme='dark'] & {
background-color: lighten($table-background-color-dark, 5.5%);
}
}
@@ -252,7 +252,7 @@
padding: 0.3rem 1rem;
border: 1px solid darken($table-thead-color, 2%);
[theme='dark'] & {
[data-theme='dark'] & {
border-color: darken($table-thead-color-dark, 2%);
}
}
@@ -305,7 +305,7 @@
padding-left: 1.5em;
}
[theme='dark'] & {
[data-theme='dark'] & {
color: $blockquote-color-dark;
border-left-color: $global-border-color-dark;
}
@@ -316,7 +316,7 @@
.footnotes {
color: $global-font-secondary-color;
[theme='dark'] & {
[data-theme='dark'] & {
color: $global-font-secondary-color-dark;
}
@@ -334,7 +334,7 @@
border-top: 1px dashed $global-border-color;
border-bottom: none;
[theme='dark'] & {
[data-theme='dark'] & {
border-top: 1px dashed $global-border-color-dark;
}
}
@@ -351,7 +351,7 @@
font-family: $code-font-family;
color: $code-color;
[theme='dark'] & {
[data-theme='dark'] & {
background-color: $global-background-color-dark;
border: 1px solid $global-border-color-dark;
border-bottom-color: $global-border-color-dark;
+1 -1
View File
@@ -19,7 +19,7 @@
sup {
color: $global-font-secondary-color;
[theme='dark'] & {
[data-theme='dark'] & {
color: $global-font-secondary-color-dark;
}
}
+2 -2
View File
@@ -60,7 +60,7 @@
background-color: transparent;
}
[theme='dark'] & {
[data-theme='dark'] & {
color: $global-link-color-dark;
&:hover {
@@ -75,7 +75,7 @@
white-space: nowrap;
font-variant-numeric: tabular-nums lining-nums;
[theme='dark'] & {
[data-theme='dark'] & {
color: $global-font-secondary-color-dark;
}
}
+1 -1
View File
@@ -11,7 +11,7 @@
color: $global-font-secondary-color;
@include transition(transform 0.2s ease);
[theme='dark'] & {
[data-theme='dark'] & {
color: $global-font-secondary-color-dark;
}
}
+21 -21
View File
@@ -4,7 +4,7 @@ header {
background-color: $header-background-color;
@include transition(box-shadow 0.3s ease);
[theme='dark'] & {
[data-theme='dark'] & {
background-color: $header-background-color-dark;
}
@@ -60,7 +60,7 @@ header {
font-size: .875em;
color: $global-font-color;
[theme='dark'] & {
[data-theme='dark'] & {
color: $global-font-color-dark;
}
@@ -75,7 +75,7 @@ header {
font-weight: bold;
color: $menu-active-color;
[theme='dark'] & {
[data-theme='dark'] & {
color: $menu-active-color-dark;
}
}
@@ -133,7 +133,7 @@ header {
padding: 0 2rem 0 2rem;
}
[theme='dark'] & {
[data-theme='dark'] & {
input {
color: $global-font-color-dark;
background-color: $search-background-color-dark;
@@ -147,7 +147,7 @@ header {
.search-button {
color: $global-font-secondary-color;
[theme='dark'] & {
[data-theme='dark'] & {
color: $global-font-secondary-color-dark;
}
}
@@ -174,7 +174,7 @@ header {
line-height: $header-height;
box-sizing: border-box;
[header-desktop='normal'] & {
[data-header-desktop='normal'] & {
position: static;
}
@@ -188,7 +188,7 @@ header {
padding: 0 2rem 0 MAX(10vh, $header-height);
height: 100%;
&[github-corner='right'] {
&[data-github-corner='right'] {
padding-right: $header-height;
}
@@ -218,7 +218,7 @@ header {
padding: 0;
border-left: 1px dashed lighten($global-font-secondary-color, 20%);
[theme='dark'] & {
[data-theme='dark'] & {
border-left-color: darken($global-font-secondary-color-dark, 20%);
}
}
@@ -240,7 +240,7 @@ header {
background-color: $header-background-color;
@include transition(box-shadow 0.3s ease);
[theme='dark'] & {
[data-theme='dark'] & {
background-color: $header-background-color-dark;
border-color: $global-border-color-dark;
}
@@ -273,7 +273,7 @@ header {
min-height: $header-height;
line-height: $header-height;
[header-mobile='normal'] & {
[data-header-mobile='normal'] & {
position: static;
}
@@ -304,7 +304,7 @@ header {
@include border-radius(3px);
@include transition(all 0.3s ease-in-out);
[theme='dark'] & {
[data-theme='dark'] & {
background: $global-font-color-dark;
}
}
@@ -381,7 +381,7 @@ header {
&:hover {
background-color: lighten($global-font-secondary-color, 24%);
[theme='dark'] & {
[data-theme='dark'] & {
background-color: darken($global-font-secondary-color-dark, 24%);
}
}
@@ -430,7 +430,7 @@ header {
.menu-item:hover {
background-color: lighten($global-font-secondary-color, 20%);
[theme='dark'] & {
[data-theme='dark'] & {
background-color: darken($global-font-secondary-color-dark, 20%);
}
}
@@ -440,7 +440,7 @@ header {
display: block;
}
[theme='dark'] & {
[data-theme='dark'] & {
background: $header-background-color-dark;
border-top-color: $global-border-color-dark;
}
@@ -487,7 +487,7 @@ header {
right: 0 !important;
background-color: $global-background-color;
[theme='dark'] & {
[data-theme='dark'] & {
background-color: $global-background-color-dark;
}
@@ -514,7 +514,7 @@ header {
text-align: right;
color: $global-font-secondary-color;
[theme='dark'] & {
[data-theme='dark'] & {
color: $global-font-secondary-color-dark;
}
}
@@ -528,7 +528,7 @@ header {
@include overflow-wrap(break-word);
color: $global-font-secondary-color;
[theme='dark'] & {
[data-theme='dark'] & {
color: $global-font-secondary-color-dark;
}
}
@@ -537,7 +537,7 @@ header {
font-style: normal;
background-color: $selection-color;
[theme='dark'] & {
[data-theme='dark'] & {
background-color: $selection-color-dark;
}
}
@@ -545,7 +545,7 @@ header {
&.cursor {
background: darken($code-background-color, 5%);
[theme='dark'] & {
[data-theme='dark'] & {
background: lighten($code-background-color-dark, 5%);
}
}
@@ -563,7 +563,7 @@ header {
.search-query {
font-weight: bold;
[theme='dark'] & {
[data-theme='dark'] & {
color: #ddd;
}
}
@@ -575,7 +575,7 @@ header {
font-size: 0.8rem;
color: $global-font-secondary-color;
[theme='dark'] {
[data-theme='dark'] {
color: $global-font-secondary-color-dark;
}
+5 -5
View File
@@ -16,7 +16,7 @@
text-decoration: none;
@include transition(0.3s);
[theme='dark'] & {
[data-theme='dark'] & {
color: $pagination-link-color-dark;
}
}
@@ -36,7 +36,7 @@
color: $pagination-link-hover-color;
}
[theme='dark'] &:hover a {
[data-theme='dark'] &:hover a {
color: $pagination-link-hover-color-dark;
}
@@ -51,8 +51,8 @@
bottom: 0px;
}
[theme='dark'] &:before,
[theme='dark'] &:after {
[data-theme='dark'] &:before,
[data-theme='dark'] &:after {
background: $pagination-link-hover-color-dark;
}
@@ -81,7 +81,7 @@
color: $pagination-link-hover-color;
}
[theme='dark'] & a {
[data-theme='dark'] & a {
color: $pagination-link-hover-color-dark;
}
+15 -15
View File
@@ -11,7 +11,7 @@ code {
@include overflow-wrap(break-word);
@include line-break(anywhere);
[theme='dark'] & {
[data-theme='dark'] & {
color: $code-color-dark;
background-color: rgba(99, 110, 123, 0.4);
}
@@ -30,7 +30,7 @@ pre {
background-color: $code-background-color;
[theme='dark'] & {
[data-theme='dark'] & {
background-color: $code-background-color-dark;
}
@@ -40,7 +40,7 @@ pre {
@include border-radius(0);
@include max-content(min-width);
[theme='dark'] & {
[data-theme='dark'] & {
background-color: transparent;
}
}
@@ -91,7 +91,7 @@ pre {
@include border-radius($global-border-radius);
@include transition(border-radius 0.2s ease);
[theme='dark'] & {
[data-theme='dark'] & {
color: $code-info-color-dark;
background-color: darken($code-background-color-dark, 6%);
}
@@ -128,7 +128,7 @@ pre {
cursor: pointer;
color: $global-link-hover-color;
[theme='dark'] & {
[data-theme='dark'] & {
color: $global-link-hover-color-dark;
}
}
@@ -156,7 +156,7 @@ pre {
display: block;
background-color: $code-background-color;
[theme='dark'] & {
[data-theme='dark'] & {
background-color: $code-background-color-dark;
}
@@ -206,7 +206,7 @@ pre {
background-color: darken($code-background-color, 6%);
@include border-radius($global-border-radius $global-border-radius 0 0);
[theme='dark'] & {
[data-theme='dark'] & {
background-color: darken($code-background-color-dark, 3%);
}
}
@@ -237,7 +237,7 @@ pre {
background-color: $code-hightlight-color;
box-shadow: -0.5rem 0 0 $code-hightlight-color, 0.5rem 0 0 $code-hightlight-color;
[theme='dark'] & {
[data-theme='dark'] & {
background-color: $code-hightlight-color-dark;
box-shadow: -0.5rem 0 0 $code-hightlight-color-dark, 0.5rem 0 0 $code-hightlight-color-dark;
}
@@ -266,7 +266,7 @@ pre {
.ln {
color: $global-font-secondary-color;
[theme='dark'] & {
[data-theme='dark'] & {
color: $global-font-secondary-color-dark;
}
}
@@ -282,7 +282,7 @@ pre {
.gd {
background-color: #ffebe9;
[theme='dark'] & {
[data-theme='dark'] & {
background-color: #78191b;
}
}
@@ -290,7 +290,7 @@ pre {
.gi {
background-color: #dafbe1;
[theme='dark'] & {
[data-theme='dark'] & {
background-color: #1b4721;
}
}
@@ -301,7 +301,7 @@ pre {
}
}
[theme='dark'] & {
[data-theme='dark'] & {
@each $class, $color in $code-highlight-color-map-dark {
.#{$class} {
color: $color;
@@ -328,7 +328,7 @@ pre {
@include link(false, false);
background-color: darken($code-background-color, 5%);
[theme='dark'] & {
[data-theme='dark'] & {
background-color: darken($code-background-color-dark, 5%);
}
}
@@ -338,13 +338,13 @@ pre {
&::-webkit-scrollbar {
background-color: #f6f8fa;
[theme='dark'] & {
[data-theme='dark'] & {
background-color: #2d333b;
}
}
}
[theme='dark'] & {
[data-theme='dark'] & {
@import './github-dark-dimmed';
}
}
@@ -26,14 +26,14 @@
border-color: $global-link-hover-color;
box-shadow: 0px 0px 5px 0px lighten($global-link-hover-color, 20%);
[theme='dark'] & {
[data-theme='dark'] & {
color: lighten($global-link-hover-color-dark, 6%);
border-color: $global-link-hover-color-dark;
box-shadow: 0px 0px 5px 0px darken($global-link-hover-color-dark, 20%);
}
}
[theme='dark'] & {
[data-theme='dark'] & {
color: $global-font-color-dark;
border-color: lighten($global-border-color-dark, 15%);
box-shadow: 0px 0px 5px 0px lighten($global-border-color-dark, 15%);
@@ -48,7 +48,7 @@
padding-right: 1rem;
background-color: $global-background-color;
[theme='dark'] & {
[data-theme='dark'] & {
background-color: $global-background-color-dark;
}
}
@@ -60,7 +60,7 @@
background-color: $header-background-color;
[theme='dark'] & {
[data-theme='dark'] & {
background-color: $header-background-color-dark;
}
}
+3 -3
View File
@@ -5,7 +5,7 @@
border-bottom: 1px solid $global-border-color;
padding: 1rem 0 0.3rem;
[theme='dark'] & {
[data-theme='dark'] & {
border-bottom: 1px solid $global-border-color-dark;
}
@@ -17,7 +17,7 @@
font-size: 0.8em;
color: $global-font-secondary-color;
[theme='dark'] & {
[data-theme='dark'] & {
color: $global-font-secondary-color-dark;
}
@@ -28,7 +28,7 @@
font-size: 0.8em;
color: $global-font-secondary-color;
[theme='dark'] & {
[data-theme='dark'] & {
color: $global-font-secondary-color-dark;
}
+9 -9
View File
@@ -19,7 +19,7 @@
margin-right: 0.5rem;
color: $single-link-color;
[theme='dark'] & {
[data-theme='dark'] & {
color: $single-link-color-dark;
}
}
@@ -37,7 +37,7 @@
color: $global-font-secondary-color;
}
[theme='dark'] & {
[data-theme='dark'] & {
background: $code-background-color-dark;
rt {
@@ -69,7 +69,7 @@
margin-right: 0.5rem;
color: $global-border-color;
[theme='dark'] & {
[data-theme='dark'] & {
color: $global-border-color-dark;
}
}
@@ -110,14 +110,14 @@
font-weight: bold;
color: $single-link-color;
[theme='dark'] & {
[data-theme='dark'] & {
color: $single-link-color-dark;
}
&::before {
color: $single-link-hover-color;
[theme='dark'] & {
[data-theme='dark'] & {
color: $single-link-hover-color-dark;
}
}
@@ -129,7 +129,7 @@
display: none;
margin: 0.8rem 0;
&[kept='true'] {
&[data-kept='true'] {
display: block;
}
@@ -140,7 +140,7 @@
padding: 0 0.75rem;
background: darken($code-background-color, 3%);
[theme='dark'] & {
[data-theme='dark'] & {
background: darken($code-background-color-dark, 6%);
}
}
@@ -153,7 +153,7 @@
padding: 0.4rem 1rem 0.4rem 1.8rem;
}
[theme='dark'] & {
[data-theme='dark'] & {
background-color: $code-background-color-dark;
}
}
@@ -162,7 +162,7 @@
.toc-title {
background: darken($code-background-color, 6%);
[theme='dark'] & {
[data-theme='dark'] & {
background: darken($code-background-color-dark, 3%);
}
}
@@ -7,7 +7,7 @@
background-color: #ccc;
}
[theme='dark'] & {
[data-theme='dark'] & {
color: $global-font-color;
&:hover,
@@ -29,7 +29,7 @@
outline: none;
}
[theme='dark'] & {
[data-theme='dark'] & {
color: $global-font-secondary-color-dark;
background: $header-background-color-dark;
@@ -28,7 +28,7 @@
color: $github-corner-color;
fill: $github-corner-fill;
[theme='dark'] & {
[data-theme='dark'] & {
color: $github-corner-color-dark;
fill: $github-corner-fill-dark;
}
+1 -1
View File
@@ -83,7 +83,7 @@
margin-left: 0.25rem;
}
[theme='dark'] & {
[data-theme='dark'] & {
&content {
background-color: rgba(61, 62, 65, 0.88);
}
+2 -2
View File
@@ -23,7 +23,7 @@
font-family: 'Font Awesome 5 Free';
font-weight: 900;
[theme='dark'] & {
[data-theme='dark'] & {
border-top-color: $global-border-color-dark;
}
}
@@ -36,7 +36,7 @@
font-family: 'Font Awesome 5 Free';
font-weight: 900;
[theme='dark'] & {
[data-theme='dark'] & {
border-bottom-color: $global-border-color-dark;
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
iframe.instagram-media {
[theme='dark'] & {
[data-theme='dark'] & {
border: none !important;
}
}
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,4 +1,4 @@
[theme=dark] .aplayer {
[data-theme=dark] .aplayer {
background: #212121;
&.aplayer-withlist {
+2 -2
View File
@@ -43,7 +43,7 @@ $code-background-color-dark: #272C34 !default;
blockquote {
border-color: $border-color;
[theme=dark] & {
[data-theme=dark] & {
border-color: $border-color-dark;
}
}
@@ -56,7 +56,7 @@ $code-background-color-dark: #272C34 !default;
color: $code-color;
background: $code-background-color;
[theme=dark] & {
[data-theme=dark] & {
color: $code-color-dark;
background: $code-background-color-dark;
}
+1 -1
Submodule docs updated: 68c7cae60e...321912688f
+2 -2
View File
@@ -17,7 +17,7 @@
{{- partial "head/link.html" . -}}
{{- partial "head/seo.html" . -}}
</head>
<body header-desktop="{{ .Site.Params.header.desktopMode }}" header-mobile="{{ .Site.Params.header.mobileMode }}">
<body data-header-desktop="{{ .Site.Params.header.desktopMode }}" data-header-mobile="{{ .Site.Params.header.mobileMode }}">
{{- /* Check theme isDark before body rendering */ -}}
{{- $theme := .Site.Params.defaulttheme -}}
<script type="text/javascript">(window.localStorage && localStorage.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('{{ $theme }}' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : '{{ $theme }}' === 'dark')) && document.body.setAttribute('theme', 'dark');</script>
@@ -25,7 +25,7 @@
<div class="wrapper">
{{- partial "header.html" . -}}
{{- $toc := .Scratch.Get "toc" -}}
<main class="container{{ if (eq $toc.enable true) | and (eq $toc.position `left`) }}-reverse{{ end }}" page-style="{{ (.Scratch.Get `params`).pageStyle | default `normal` }}">
<main class="container{{ if (eq $toc.enable true) | and (eq $toc.position `left`) }}-reverse{{ end }}" data-page-style="{{ (.Scratch.Get `params`).pageStyle | default `normal` }}">
{{- block "content" . }}{{ end -}}
</main>
{{- partial "footer.html" . -}}
+1 -1
View File
@@ -3,7 +3,7 @@
{{- $profile := .Site.Params.home.profile -}}
{{- $posts := .Site.Params.home.posts -}}
<div class="page home"{{ if ne $posts.enable false }} posts{{ end }}>
<div class="page home{{ if ne $posts.enable false }} posts{{ end }}">
{{- /* Profile */ -}}
{{- if ne $profile.enable false -}}
{{- partial "home/profile.html" . -}}
+2 -5
View File
@@ -2,7 +2,7 @@
{{- /* Desktop header */ -}}
<header class="desktop" id="header-desktop">
<div class="header-wrapper"{{ if .Site.Params.githubCorner.enable }} github-corner="{{ .Site.Params.githubCorner.position }}"{{ end }}>
<div class="header-wrapper"{{ if .Site.Params.githubCorner.enable }} data-github-corner="{{ .Site.Params.githubCorner.position }}"{{ end }}>
<div class="header-title">
<a href="{{ .Site.Home.RelPermalink }}" title="{{ .Site.Title }}">
{{- with .Site.Params.header.title -}}
@@ -44,10 +44,7 @@
{{- $url = .RelPermalink -}}
{{- end -}}
{{- if (ne .Params.Draft true) | or $buildDrafts -}}
<li
class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}{{ with .Params.Class }} {{ . }}{{ end }}"
{{ if .HasChildren }}has-children{{ end }}
>
<li class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}{{ with .Params.Class }} {{ . }}{{ end }} {{ if .HasChildren }}has-children{{ end }}">
<a
class="menu-link"
href="{{ $url }}"
+1 -1
View File
@@ -113,7 +113,7 @@
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
{{- $source := $cdn.walineJS | default "lib/waline/waline.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $commentConfig = dict "el" "#waline" "serverURL" $waline.serverURL "lang" .Lang "dark" "body[theme='dark']" "copyright" true "imageUploader" false "highlighter" false | dict "waline" | merge $commentConfig -}}
{{- $commentConfig = dict "el" "#waline" "serverURL" $waline.serverURL "lang" .Lang "dark" "body[data-theme='dark']" "copyright" true "imageUploader" false "highlighter" false | dict "waline" | merge $commentConfig -}}
{{- with $waline.pageview -}}
{{- $commentConfig = dict "pageview" . | dict "waline" | merge $commentConfig -}}
{{- end -}}
+1 -1
View File
@@ -140,7 +140,7 @@
{{- /* Static TOC */ -}}
{{- if (ne $toc.enable false) | and (ne $tocEmpty true) -}}
<div class="details toc{{ with $params.password }} d-none{{ end }}" id="toc-static" kept="{{ if $toc.keepStatic }}true{{ else }}false{{ end }}">
<div class="details toc{{ with $params.password }} d-none{{ end }}" id="toc-static" data-kept="{{ if $toc.keepStatic }}true{{ else }}false{{ end }}">
<div class="details-summary toc-title">
<span>{{ T "contents" }}</span>
<span><i class="details-icon fa-solid fa-angle-right"></i></span>
+7 -7
View File
@@ -50,7 +50,7 @@ class FixIt {
constructor() {
this.config = window.config;
this.data = this.config.data;
this.isDark = document.body.getAttribute('theme') === 'dark';
this.isDark = document.body.getAttribute('data-theme') === 'dark';
this.util = new Util();
this.newScrollTop = this.util.getScrollTop();
this.oldScrollTop = this.newScrollTop;
@@ -93,7 +93,7 @@ class FixIt {
initMenuDesktop() {
// This is a dirty hack for fixing sub menu position error in desktop header
this.util.forEach(document.querySelectorAll('[has-children], #header-desktop .language'), ($item) => {
this.util.forEach(document.querySelectorAll('.has-children, #header-desktop .language'), ($item) => {
$item.addEventListener('mouseover', function(){
this.querySelector('.sub-menu').style.left= `${this.getBoundingClientRect().left}px`;
})
@@ -127,7 +127,7 @@ class FixIt {
initSwitchTheme() {
this.util.forEach(document.getElementsByClassName('theme-switch'), ($themeSwitch) => {
$themeSwitch.addEventListener('click', () => {
document.body.setAttribute('theme', document.body.getAttribute('theme') === 'dark' ? 'light' : 'dark');
document.body.setAttribute('data-theme', document.body.getAttribute('data-theme') === 'dark' ? 'light' : 'dark');
this.isDark = !this.isDark;
window.localStorage && localStorage.setItem('theme', this.isDark ? 'dark' : 'light');
for (let event of this.switchThemeEventSet) {
@@ -505,7 +505,7 @@ class FixIt {
if ($tocCore === null) {
return;
}
if (document.getElementById('toc-static').getAttribute('kept') === 'true' || this.util.isTocStatic()) {
if (document.getElementById('toc-static').getAttribute('date-kept') === 'true' || this.util.isTocStatic()) {
const $tocContentStatic = document.getElementById('toc-content-static');
if ($tocCore.parentElement !== $tocContentStatic) {
$tocCore.parentElement.removeChild($tocCore);
@@ -526,7 +526,7 @@ class FixIt {
const $tocLinkElements = $tocCore.querySelectorAll('a:first-child');
const $tocLiElements = $tocCore.getElementsByTagName('li');
const $headerLinkElements = document.getElementsByClassName('header-link');
const headerIsFixed = document.body.getAttribute('header-desktop') !== 'normal';
const headerIsFixed = document.body.getAttribute('data-header-desktop') !== 'normal';
const headerHeight = document.getElementById('header-desktop').offsetHeight;
this._tocOnScroll = this._tocOnScroll || (() => {
const $comments = document.getElementById('comments');
@@ -966,10 +966,10 @@ class FixIt {
onScroll() {
const $headers = [];
if (document.body.getAttribute('header-desktop') === 'auto') {
if (document.body.getAttribute('data-header-desktop') === 'auto') {
$headers.push(document.getElementById('header-desktop'));
}
if (document.body.getAttribute('header-mobile') === 'auto') {
if (document.body.getAttribute('data-header-mobile') === 'auto') {
$headers.push(document.getElementById('header-mobile'));
}
if (document.getElementById('comments')) {