Feat: add some new features and bug fixes (#279)

*  Feat: add instant page

* 🐛 Fix: donate images without lazy loading

* 🔧 Chore: update waline plugin version
This commit is contained in:
Mejituu
2023-02-01 14:19:29 +08:00
committed by Cell
parent 15841f0b90
commit 866203a4ce
10 changed files with 29 additions and 10 deletions
+5 -3
View File
@@ -40,6 +40,8 @@ libFiles:
# gitalk@1.7.2 https://github.com/gitalk/gitalk
gitalkCSS: gitalk@1.7.2/dist/gitalk.min.css
gitalkJS: gitalk@1.7.2/dist/gitalk.min.js
# instant.page@5.1.1 https://github.com/instantpage/instant.page
instantPage: 'instant.page@5.1.1/instantpage.min.js'
# katex@0.16.2 https://github.com/KaTeX/KaTeX
katexAutoRenderJS: katex@0.16.2/dist/contrib/auto-render.min.js
katexCopyTexJS: katex@0.16.2/dist/contrib/copy-tex.min.js
@@ -80,7 +82,7 @@ libFiles:
valineJS: valine@1.5.1/dist/Valine.min.js
# vconsole@3.14.6 https://github.com/Tencent/vConsole
vconsoleJS: vconsole@3.14.6/dist/vconsole.min.js
# waline@2.10.0 https://github.com/walinejs/waline
walineCSS: '@waline/client@2.10.0/dist/waline.css'
walineJS: '@waline/client@2.10.0/dist/waline.js'
# waline@2.14.7 https://github.com/walinejs/waline
walineCSS: '@waline/client@2.14.7/dist/waline.css'
walineJS: '@waline/client@2.14.7/dist/waline.js'
+5 -3
View File
@@ -40,6 +40,8 @@ libFiles:
# gitalk@1.7.2 https://github.com/gitalk/gitalk
gitalkCSS: gitalk@1.7.2/dist/gitalk.min.css
gitalkJS: gitalk@1.7.2/dist/gitalk.min.js
# instant.page@5.1.1 https://github.com/instantpage/instant.page
instantPage: 'instant.page@5.1.1/instantpage.min.js'
# katex@0.16.2 https://github.com/KaTeX/KaTeX
katexAutoRenderJS: katex@0.16.2/dist/contrib/auto-render.min.js
katexCopyTexJS: katex@0.16.2/dist/contrib/copy-tex.min.js
@@ -80,7 +82,7 @@ libFiles:
valineJS: valine@1.5.1/dist/Valine.min.js
# vconsole@3.14.6 https://github.com/Tencent/vConsole
vconsoleJS: vconsole@3.14.6/dist/vconsole.min.js
# waline@2.10.0 https://github.com/walinejs/waline
walineCSS: '@waline/client@2.10.0/dist/waline.css'
walineJS: '@waline/client@2.10.0/dist/waline.js'
# waline@2.14.7 https://github.com/walinejs/waline
walineCSS: '@waline/client@2.14.7/dist/waline.css'
walineJS: '@waline/client@2.14.7/dist/waline.js'
+2 -1
View File
@@ -12,6 +12,7 @@ eruda@2.5.0 https://github.com/liriliri/eruda
fontawesome-free@6.2.0 https://github.com/FortAwesome/Font-Awesome
fusejs@6.6.2 https://github.com/krisk/fuse
gitalk@1.7.2 https://github.com/gitalk/gitalk
instant.page@5.1.1 https://github.com/instantpage/instant.page
katex@0.16.2 https://github.com/KaTeX/KaTeX
lazysizes@5.3.2 https://github.com/aFarkas/lazysizes
lightgallery@2.6.1 https://github.com/sachinchoolur/lightgallery
@@ -29,4 +30,4 @@ twikoo@1.6.8 https://github.com/imaegoo/twikoo
typeit@8.7.0 https://github.com/alexmacarthur/typeit
valine@1.5.1 https://github.com/xCss/Valine
vconsole@3.14.6 https://github.com/Tencent/vConsole
waline@2.10.0 https://github.com/walinejs/waline
waline@2.14.7 https://github.com/walinejs/waline
+1
View File
@@ -0,0 +1 @@
(()=>{var o,u,f=new Set,b=document.createElement("link").relList.supports("prefetch"),y="instantAllowQueryString"in document.body.dataset,E="instantAllowExternalLinks"in document.body.dataset,L="instantWhitelist"in document.body.dataset,m="instantMousedownShortcut"in document.body.dataset,h=1111,p=65,w=!1,v=!1,c=!1,g=null;navigator.userAgentData&&navigator.userAgentData.brands.forEach(({brand:t,version:e})=>{t=="Chromium"&&(g=parseInt(e))});if("instantIntensity"in document.body.dataset){let t=document.body.dataset.instantIntensity;if(t.startsWith("mousedown"))w=!0,t=="mousedown-only"&&(v=!0);else if(t.startsWith("viewport"))navigator.connection&&(navigator.connection.saveData||navigator.connection.effectiveType&&navigator.connection.effectiveType.includes("2g"))||(t=="viewport"?document.documentElement.clientWidth*document.documentElement.clientHeight<45e4&&(c=!0):t=="viewport-all"&&(c=!0));else{let e=parseInt(t);isNaN(e)||(p=e)}}if(b){let t={capture:!0,passive:!0};if(v||document.addEventListener("touchstart",I,t),w?m||document.addEventListener("mousedown",O,t):document.addEventListener("mouseover",T,t),m&&document.addEventListener("mousedown",A,t),c){let e=window.requestIdleCallback;e||(e=n=>{n()}),e(function(){let i=new IntersectionObserver(s=>{s.forEach(l=>{if(l.isIntersecting){let d=l.target;i.unobserve(d),a(d.href)}})});document.querySelectorAll("a").forEach(s=>{r(s)&&i.observe(s)})},{timeout:1500})}}function I(t){u=performance.now();let e=t.target.closest("a");r(e)&&a(e.href,"high")}function T(t){if(performance.now()-u<h||!("closest"in t.target))return;let e=t.target.closest("a");r(e)&&(e.addEventListener("mouseout",k,{passive:!0}),o=setTimeout(()=>{a(e.href,"high"),o=void 0},p))}function O(t){let e=t.target.closest("a");r(e)&&a(e.href,"high")}function k(t){t.relatedTarget&&t.target.closest("a")==t.relatedTarget.closest("a")||o&&(clearTimeout(o),o=void 0)}function A(t){if(performance.now()-u<h)return;let e=t.target.closest("a");if(t.which>1||t.metaKey||t.ctrlKey||!e)return;e.addEventListener("click",function(i){i.detail!=1337&&i.preventDefault()},{capture:!0,passive:!1,once:!0});let n=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1,detail:1337});e.dispatchEvent(n)}function r(t){if(!(!t||!t.href)&&!(L&&!("instant"in t.dataset))&&!(t.origin!=location.origin&&(!(E||"instant"in t.dataset)||!g))&&["http:","https:"].includes(t.protocol)&&!(t.protocol=="http:"&&location.protocol=="https:")&&!(!y&&t.search&&!("instant"in t.dataset))&&!(t.hash&&t.pathname+t.search==location.pathname+location.search)&&!("noInstant"in t.dataset))return!0}function a(t,e="auto"){if(f.has(t))return;let n=document.createElement("link");n.rel="prefetch",n.href=t,n.fetchPriority=e,n.as="document",document.head.appendChild(n),f.add(t)}})();
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+4
View File
@@ -380,6 +380,8 @@
readingTime = true
# FixIt 0.2.17 | NEW end of post flag
endFlag = ""
# FixIt 0.2.18 | NEW whether to enable instant.page
instantPage = false
# FixIt 0.2.15 | NEW Repost config
[params.page.repost]
@@ -558,6 +560,7 @@
texRenderer = false # FixIt 0.2.16 | NEW
search = false # FixIt 0.2.16 | NEW
recaptchaV3Key = "" # FixIt 0.2.16 | NEW
reaction = false # FixIt 0.2.18 | NEW
# Facebook comment config (https://developers.facebook.com/docs/plugins/comments)
[params.page.comment.facebook]
enable = false
@@ -607,6 +610,7 @@
category = ""
categoryId = ""
mapping = ""
term = ""
reactionsEnabled = "1"
emitMetadata = "0"
inputPosition = "bottom" # ["top", "bottom"]
+6
View File
@@ -42,6 +42,12 @@
{{- $source := $cdn.lazysizesJS | default "lib/lazysizes/lazysizes.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- /* instant.page */ -}}
{{- if $params.instantPage -}}
{{- $source := $cdn.instantPage | default "lib/instant-page/instantpage.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Attr" "type=\"module\"" "Async" true "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- end -}}
{{- /* twemoji */ -}}
{{- if $params.twemoji -}}
{{- $source := $cdn.twemojiJS | default "lib/twemoji/twemoji.min.js" -}}
+1 -1
View File
@@ -14,7 +14,7 @@
{{- end -}}
{{- if $image -}}
<div>
<img src="{{ $image }}" alt="{{ $author }} {{ $way }}">
{{- dict "Src" $image "Alt" (printf "%v %v" $author $way) "Resources" $.Resources | partial "plugin/image.html" -}}
<span{{- if $reward.animation }} data-animation{{- end -}}>{{- $way -}}</span>
</div>
{{- end -}}
+3
View File
@@ -156,6 +156,9 @@
{{- with $waline.recaptchaV3Key -}}
{{- $commentConfig = dict "recaptchaV3Key" . | dict "waline" | merge $commentConfig -}}
{{- end -}}
{{- with $waline.reaction -}}
{{- $commentConfig = dict "reaction" . | dict "waline" | merge $commentConfig -}}
{{- end -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://waline.js.org/" rel="external nofollow noopener noreferrer">Waline</a>.
</noscript>