diff --git a/assets/css/main.css b/assets/css/main.css index ffdd9206f..cf6ea7722 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -639,7 +639,9 @@ html.dark { --friend-link-color: var(--fgColor-link); --friend-link-hover-color: var(--fgColor-link-hover); --sponsor-button-background-color: var(--button-default-bgColor-rest); - --sponsor-button-hover-background-color: var(--button-default-bgColor-hover); + --sponsor-button-hover-background-color: var( + --button-default-bgColor-hover + ); --cookie-background-color: white; --code-color: #e5bf78; --code-background-color: #1b2029; @@ -648,7 +650,9 @@ html.dark { /* TODO */ --code-background-color-darken-6: #1a1d23; /* TODO */ - --code-background-color-code-header: var(--code-background-color-darken-6); + --code-background-color-code-header: var( + --code-background-color-darken-6 + ); /* TODO */ --code-background-color-code-hl: #1c2025; /* TODO */ diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 46bd35a59..49163e83b 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -22,6 +22,9 @@ {{- partial "head/meta.html" . -}} {{- partial "head/link.html" . -}} {{- partial "head/seo.html" . -}} + {{- /* Load JavaScript scripts and CSS */ -}} + {{- partial "assets.html" . -}} + @@ -89,9 +92,6 @@ {{- end -}} - - {{- /* Load JavaScript scripts and CSS */ -}} - {{- partial "assets.html" . -}} diff --git a/layouts/partials/assets.html b/layouts/partials/assets.html index e63509ff1..7b0526be0 100644 --- a/layouts/partials/assets.html +++ b/layouts/partials/assets.html @@ -29,7 +29,7 @@ {{- /* tablesort */ -}} {{- if $params.table | and $params.table.sort | and (.Scratch.Get "this").tablesort -}} {{- $source := $cdn.tablesort | default "lib/tablesort/tablesort.min.js" -}} - {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $config = dict "sort" true | dict "table" | merge $config -}} {{- end -}} @@ -53,20 +53,20 @@ {{- /* lightgallery.js */ -}} {{- if $params.lightgallery -}} {{- $source := $cdn.lightgalleryCSS | default "lib/lightgallery/lightgallery.min.css" -}} - {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- $source := $cdn.lightgalleryJS | default "lib/lightgallery/lightgallery.min.js" -}} - {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $source := $cdn.lightgalleryThumbnailJS | default "lib/lightgallery/lg-thumbnail.min.js" -}} - {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $source := $cdn.lightgalleryZoomJS | default "lib/lightgallery/lg-zoom.min.js" -}} - {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $config = dict "selector" ".lightgallery" "speed" 400 "hideBarsDelay" 2000 "thumbnail" true "exThumbImage" "data-thumbnail" "thumbWidth" 80 "thumbContHeight" 80 "actualSize" false | dict "lightGallery" | merge $config -}} {{- end -}} {{- /* Sharer.js */ -}} {{- if $params.share.enable | and (.Scratch.Get "this").sharer -}} {{- $source := $cdn.sharerJS | default "lib/sharer/sharer.min.js" -}} - {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $config = dict "sharerjs" true | merge $config -}} {{- end -}} @@ -74,7 +74,7 @@ {{- with (.Scratch.Get "this").typeitMap -}} {{- $typeit := $.Site.Params.typeit -}} {{- $source := $cdn.typeitJS | default "lib/typeit/typeit.min.js" -}} - {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}} {{- $config = dict "speed" $typeit.speed "cursorSpeed" $typeit.cursorSpeed "cursorChar" $typeit.cursorChar "duration" $typeit.duration "data" . | dict "typeit" | merge $config -}} {{- end -}} @@ -94,12 +94,12 @@ {{- $options = dict "minify" true | merge $options -}} {{- $js := resources.Get "js/lib/mathjax.js" | js.Build $options -}} {{- $_ := $js.RelPermalink -}} - {{- dict "Link" $js.RelPermalink "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Link" $js.RelPermalink "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- else -}} {{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}} - {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- $source := $cdn.katexJS | default "lib/katex/katex.min.js" -}} {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $source := $cdn.katexAutoRenderJS | default "lib/katex/auto-render.min.js" -}} @@ -168,10 +168,10 @@ {{- /* Mapbox GL */ -}} {{- if (.Scratch.Get "this").mapbox -}} {{- $source := $cdn.mapboxGLCSS | default "lib/mapbox-gl/mapbox-gl.min.css" -}} - {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- $source := $cdn.mapboxGLJS | default "lib/mapbox-gl/mapbox-gl.min.js" -}} - {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} - {{- dict "Source" "lib/mapbox-gl/mapbox-gl-language.js" "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" "lib/mapbox-gl/mapbox-gl-language.js" "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $config = dict "accessToken" $params.mapbox.accessToken "RTLTextPlugin" "https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js" | dict "mapbox" | merge $config -}} {{- end -}} @@ -187,7 +187,7 @@ {{- $source := $cdn.aplayerCSS | default "lib/aplayer/APlayer.min.css" -}} {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- $options := dict "targetPath" "lib/aplayer/dark.min.css" "enableSourceMap" true -}} - {{- dict "Source" "lib/aplayer/dark.scss" "ToCSS" $options "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} + {{- dict "Source" "lib/aplayer/dark.scss" "ToCSS" $options "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- $source := $cdn.aplayerJS | default "lib/aplayer/APlayer.min.js" -}} {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} @@ -212,7 +212,7 @@ {{- if .Site.Params.cookieconsent | and .Site.Params.cookieconsent.enable -}}
{{- $source := $cdn.cookieconsentCSS | default "lib/cookieconsent/cookieconsent.min.css" -}} - {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- $source := $cdn.cookieconsentJS | default "lib/cookieconsent/cookieconsent.min.js" -}} {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $cookieconsentConfig := dict "popup" (dict "background" "#1aa3ff") "button" (dict "background" "#f0f0f0") | dict "theme" "edgeless" "palette" -}} @@ -237,7 +237,7 @@ {{- /* defer = true */ -}} {{- /* attr = "attr" */ -}} {{- if eq (printf "%T" . ) "string" -}} - {{- dict "Source" . "Fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/style.html" -}} + {{- dict "Source" . "Fingerprint" $fingerprint "Defer" .defer | dict "Scratch" $.Scratch "Data" | partial "scratch/style.html" -}} {{- else -}} {{- dict "Source" .src "Fingerprint" $fingerprint "Defer" .defer "Attr" .attr | dict "Scratch" $.Scratch "Data" | partial "scratch/style.html" -}} {{- end -}} @@ -252,7 +252,7 @@ {{- /* defer = true */ -}} {{- /* attr = "attr" */ -}} {{- if eq (printf "%T" . ) "string" -}} - {{- dict "Source" . "Fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" . "Fingerprint" $fingerprint "Defer" .defer | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}} {{- else -}} {{- dict "Source" .src "Fingerprint" $fingerprint "Defer" .defer "Module" .module "Async" .async "Attr" .attr| dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} @@ -287,8 +287,7 @@ {{/* Instant page */}} {{- if $params.instantpage.enable -}} -{{- $js := resources.Get "/lib/instant.page/instantpage.min.js" -}} - + {{- dict "Source" "/lib/instant.page/instantpage.min.js" "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} {{- range (.Scratch.Get "this").style -}}