Compare commits

...

6 Commits

Author SHA1 Message Date
Cell fcb0f1efd5 🔖 Chore(release): 0.3.15 2024-11-11 12:35:41 +08:00
Cell 59ee34b710 Revert: "refactor reading progress with css animation"
I hate safari just like IE.

Close #542
2024-11-11 12:26:33 +08:00
Cell 5518053a26 🐛 Fix: image rendering not support base64 syntax (#540)
Close #540
2024-11-07 11:15:10 +08:00
Cell 2a0821f531 Feat: open version shortcode, support custom repository 2024-11-07 00:31:42 +08:00
Cell ad45d89098 🐛 Fix: reading progress not support safari 2024-11-06 21:53:32 +08:00
Cell 261f7b66ef 🐛 Fix: inaccurate task lists regular expression 2024-11-06 19:41:42 +08:00
11 changed files with 44 additions and 42 deletions
@@ -1,29 +1,13 @@
.reading-progress-bar {
height: var(--#{$prefix}progress-h, 2px);
background-color: var(--#{$prefix}progress-bg, var(--#{$prefix}info));
--progress: 0;
height: var(--progress-h, 2px);
width: var(--progress);
background-color: var(--bg-progress, var(--#{$prefix}info));
position: fixed;
left: 0;
right: 0;
transform-origin: var(--#{$prefix}progress-start, left) 50%;
animation: grow-progress 3s linear;
animation-timeline: scroll();
@include z-index(2);
@extend .print-d-none;
&[data-reversed=true] {
animation-name: grow-progress-reversed;
}
[data-theme="dark"] & {
background-color: var(--#{$prefix}progress-bg-dark, var(--#{$prefix}info-dark));
}
@keyframes grow-progress {
from { transform: scaleX(0); }
to { transform: scaleX(1); }
}
@keyframes grow-progress-reversed {
from { transform: scaleX(1); }
to { transform: scaleX(0); }
background-color: var(--bg-progress-dark, var(--#{$prefix}info-dark));
}
}
+4
View File
@@ -1111,6 +1111,7 @@ class FixIt {
const ACCURACY = 20;
const $fixedButtons = document.querySelector('.fixed-buttons');
const $backToTop = document.querySelector('.back-to-top');
const $readingProgressBar = document.querySelector('.reading-progress-bar');
if (document.body.dataset.headerDesktop === 'auto') {
$headers.push(document.getElementById('header-desktop'));
}
@@ -1143,6 +1144,9 @@ class FixIt {
});
const contentHeight = document.body.scrollHeight - window.innerHeight;
const scrollPercent = Math.max(Math.min(100 * Math.max(this.newScrollTop, 0) / contentHeight, 100), 0);
if ($readingProgressBar) {
$readingProgressBar.style.setProperty('--progress', `${scrollPercent.toFixed(2)}%`);
}
// whether to show fixed buttons
if ($fixedButtons) {
if (scrollPercent > 1) {
+7
View File
@@ -695,6 +695,13 @@ enableEmoji = true
[params.taskList]
# tip = "fa-regular fa-lightbulb"
# FixIt 0.3.15 | NEW version shortcode config
[params.repoVersion]
# url prefix for the release tag
url = "https://github.com/hugo-fixit/FixIt/releases/tag/v"
# project name
name = "FixIt"
# FixIt 0.2.12 | NEW PanguJS config
[params.pangu]
# For Chinese writing
@@ -1,3 +1,4 @@
{{- /* TODO refactor */ -}}
{{- $params := .Page.Params | merge site.Params.page -}}
{{- if .Title | and .Text -}}
{{- $linked := ne $params.lightgallery false -}}
+3 -3
View File
@@ -28,10 +28,10 @@
*/ -}}
{{- $icon := dict "Class" (add "checkbox-icon fa-fw " (index $iconMap " ")) | partial "plugin/icon.html" -}}
{{- $label := T (printf "taskList.%v" " ") -}}
{{- $content := replaceRE `<li><input disabled="" type="checkbox"> (.+?)</li>` (printf `<li data-task=" " title=%q>%s$1</li>` $label $icon) . -}}
{{- $content := replaceRE `<li>(\n<p>)*<input disabled="" type="checkbox"> (.+?)(</p>\n)*</li>` (printf `<li data-task=" " title=%q>$1%s$2$3</li>` $label $icon) . -}}
{{- $label := T (printf "taskList.%v" "x") -}}
{{- $icon := dict "Class" (add "checkbox-icon fa-fw " (index $iconMap "x")) | partial "plugin/icon.html" -}}
{{- $content = replaceRE `<li><input checked="" disabled="" type="checkbox"> (.+?)</li>` (printf `<li data-task="x" title=%q>%s$1</li>` $label $icon) $content -}}
{{- $content = replaceRE `<li>(\n<p>)*<input checked="" disabled="" type="checkbox"> (.+?)(</p>\n)*</li>` (printf `<li data-task="x" title=%q>$1%s$2$3</li>` $label $icon) $content -}}
{{- /*
The extended syntax is compatible with Obsidian.
@@ -49,7 +49,7 @@
{{- $sign := htmlEscape . -}}
{{- $originSign := replace . "\\" "" -}}
{{- $label := (T (printf "taskList.%v" $originSign)) | default (T (printf "taskList.%v" " ")) -}}
{{- $content = replaceRE (printf `<li>\[%s\] (.+?)</li>` $sign) (printf `<li data-task=%q title=%q>%s$1</li>` $originSign $label $icon) $content -}}
{{- $content = replaceRE (printf `<li>(\n<p>)*\[%s\] (.+?)(</p>\n)*</li>` $sign) (printf `<li data-task=%q title=%q>$1%s$2$3</li>` $originSign $label $icon) $content -}}
{{- end -}}
{{- return $content -}}
+1 -1
View File
@@ -1,4 +1,4 @@
{{- .Scratch.Set "version" "v0.3.14" -}}
{{- .Scratch.Set "version" "v0.3.15" -}}
{{- .Scratch.Set "this" dict -}}
{{- partial "init/detection-env.html" . -}}
+8 -3
View File
@@ -7,6 +7,11 @@
{{- $onerror := "" -}}
{{- $cacheRemoteImages := $params.cacheRemoteImages -}}
{{- $suffixList := slice ".jpeg" ".jpg" ".png" ".gif" ".bmp" ".tif" ".tiff" ".webp" -}}
{{- $responsive := .Responsive -}}
{{- if hasPrefix .Src "data:image" -}}
{{- $responsive = false -}}
{{- end -}}
{{- /* handle for default size image */ -}}
{{- $src := .Src -}}
@@ -17,7 +22,7 @@
{{- $src = .RelPermalink -}}
{{- end -}}
{{- /* only available for image resources that are raster images */ -}}
{{- if (eq .ResourceType "image") | and $suffixValid | and $.Responsive -}}
{{- if (eq .ResourceType "image") | and $suffixValid | and $responsive -}}
{{- $style = printf "--width: %vpx;--aspect-ratio: %v / %v;" .Width .Width .Height | safeHTMLAttr -}}
{{- end -}}
{{- end -}}
@@ -26,7 +31,7 @@
{{- $srcMedium := $src -}}
{{- $srcLarge := .SrcLarge | default $src -}}
{{- if .Responsive }}
{{- if $responsive }}
{{- /* handle for small size image */ -}}
{{- $suffixValidSmall := dict "Path" $srcSmall "Suffixes" $suffixList | partial "function/suffix-validation.html" -}}
{{- with dict "Path" .SrcSmall "Resources" .Resources "CacheRemoteImages" $cacheRemoteImages.enable | partial "function/resource.html" -}}
@@ -89,7 +94,7 @@
<a class="lightgallery" href="{{ $srcLarge | safeURL }}" data-thumbnail="{{ $srcSmall | safeURL }}"{{ with $caption }} data-sub-html="<h2>{{ . }}</h2>{{ with $.Title }}<p>{{ . }}</p>{{ end }}"{{ end }}{{ with .Rel }} rel="{{ . }}"{{ end }}>
{{- end -}}
<img loading="{{ $loading }}" src="{{ $src | safeURL }}" alt="{{ $alt }}"
{{- if .Responsive }} srcset="{{ $srcSmall | safeURL }}, {{ $srcMedium | safeURL }} 1.5x, {{ $srcLarge | safeURL }} 2x"{{- end -}}
{{- if $responsive }} srcset="{{ $srcSmall | safeURL }}, {{ $srcMedium | safeURL }} 1.5x, {{ $srcLarge | safeURL }} 2x"{{- end -}}
{{- if eq $loading "lazy" }} data-title="{{ .Title | default $alt }}"
{{- else }} title="{{ .Title | default $alt }}"{{- end -}}
{{- with .Width }} width="{{ . }}"{{- end -}}
+8 -8
View File
@@ -36,20 +36,20 @@
{{- $readingProgress := .Site.Params.readingProgress -}}
{{- if $readingProgress.enable -}}
{{- with $readingProgress -}}
{{- $style := printf "--fi-progress-start: %v; %v: 0;" (.Start | default "left") (.Position | default "top") -}}
{{- $style := printf "%v: 0;%v: 0;" (.Start | default "left") (.Position | default "top") -}}
{{- if .Height | and (ne .Height "2px") -}}
{{- $style = printf "%v --fi-progress-h: %v;" $style .Height -}}
{{- $style = printf "%v--progress-h: %v;" $style .Height -}}
{{- end -}}
{{- if .Reversed -}}
{{- $style = printf "%v%v" $style "width: calc(100% - var(--progress));" -}}
{{- end -}}
{{- if .Light -}}
{{- $style = printf "%v --fi-progress-bg: %v;" $style .Light -}}
{{- $style = printf "%v--bg-progress: %v;" $style .Light -}}
{{- end -}}
{{- if .Dark -}}
{{- $style = printf "%v --fi-progress-bg-dark: %v;" $style .Dark -}}
{{- $style = printf "%v--bg-progress-dark: %v;" $style .Dark -}}
{{- end -}}
<div class="reading-progress-bar"
{{- with .Reversed }} data-reversed="{{ . }}"{{ end }}
{{- printf ` style=%q` $style | safeHTMLAttr -}}
></div>
<div class="reading-progress-bar" {{ printf `style="%v"` $style | safeHTMLAttr }}></div>
{{- end -}}
{{- end -}}
+4 -3
View File
@@ -1,14 +1,15 @@
{{- $rvc := .Page.Param "repoVersion" -}}
{{- $version := .Get 0 -}}
{{- $url := printf "https://github.com/hugo-fixit/FixIt/releases/tag/v%v" $version -}}
{{- $type := .Get 1 | default "new" | lower -}}
{{- $url := printf "%v%v" (.Get 2 | default $rvc.url) $version -}}
{{- $label := T (printf "version.%v" $type) -}}
{{- $color := cond (eq $type "changed") "ff9101" "00b1ff" | cond (eq $type "deleted") "ff5252" -}}
{{- $pathTemplate := cond hugo.IsMultilingual (printf "images/version/%%v-%%v.%v.svg" .Page.Language.Lang) "images/version/%v-%v.svg" -}}
{{- $path := printf $pathTemplate $version $type -}}
{{- $resource := resources.Get "images/version.template.svg" -}}
{{- $resource = $resource | resources.ExecuteAsTemplate $path (dict "version" $version "label" $label "color" $color "isCJK" .Page.Params.IsCJKLanguage) | minify -}}
{{- $alt := printf "FixIt %v | %v" $version $label -}}
<a href="{{ $url }}" rel="external nofollow noopener" target="_blank">
{{- $alt := printf "%v %v | %v" (.Get 3 | default $rvc.name) $version $label -}}
<a href="{{ $url }}" rel="external" target="_blank">
{{- dict "Src" $resource.RelPermalink "Alt" $alt "Class" "version" | partial "plugin/image.html" -}}
</a>
{{- /* EOF */ -}}
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "fixit-src",
"version": "0.3.14",
"version": "0.3.15",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "fixit-src",
"version": "0.3.14",
"version": "0.3.15",
"license": "MIT",
"devDependencies": {
"@hugo-fixit/fixit-releaser": "^1.0.1",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "fixit-src",
"version": "0.3.14",
"version": "0.3.15",
"private": true,
"description": "FixIt theme source files",
"keywords": [