mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
✨ Feat: add pangu.js support (#20)
This commit is contained in:
+3
-2
@@ -5,6 +5,7 @@
|
||||
- :tada: Feat: add PWA support
|
||||
- :tada: Feat: add Watermark support ([#16](https://github.com/Lruihao/FixIt/issues/16))
|
||||
- :tada: Feat: add "不蒜子" count and site run time ([#18](https://github.com/Lruihao/FixIt/issues/18))
|
||||
- :sparkles: Feat: add pangu.js support ([#20](https://github.com/Lruihao/FixIt/issues/20))
|
||||
- :sparkles: Feat: add public network security config (only in China) ([#15](https://github.com/Lruihao/FixIt/issues/15))
|
||||
- :sparkles: Feat: add CustomJS option ([#24](https://github.com/Lruihao/FixIt/issues/24))
|
||||
- :zap: Perf: optimize JS loading ([#25](https://github.com/Lruihao/FixIt/issues/25))
|
||||
@@ -16,9 +17,9 @@
|
||||
- :fire: Feat: remove lib smooth-scroll ([#1](https://github.com/Lruihao/FixIt/issues/1))
|
||||
- :robot: Feat(SEO): optimize SEO meta ([#30](https://github.com/Lruihao/FixIt/issues/30))
|
||||
- :lipstick: Style: change scroll-behavior to smooth, page image margin, header style, footer style etc.
|
||||
- :arrow_up: Chore: update all third-party libraries
|
||||
- :wrench: Chore: minify card-link background image
|
||||
- :wrench: Chore: minify static images
|
||||
- :wrench: Chore(i18n): change some translations
|
||||
- :arrow_up: Chore: update all third-party libraries
|
||||
|
||||
[`v0.2.11...v0.2.12`](https://github.com/Lruihao/FixIt/compare/v0.2.11...v0.2.12)
|
||||
## v0.2.11 [2021-12-19]
|
||||
|
||||
@@ -28,7 +28,6 @@ Thanks to the authors of following resources included in the theme:
|
||||
* [Font Awesome](https://fontawesome.com/)
|
||||
* [Simple Icons](https://github.com/simple-icons/simple-icons)
|
||||
* [Animate.css](https://daneden.github.io/animate.css/)
|
||||
* [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)
|
||||
* [autocomplete.js](https://github.com/algolia/autocomplete.js)
|
||||
* [Lunr.js](https://lunrjs.com/)
|
||||
* [algoliasearch](https://github.com/algolia/algoliasearch-client-javascript)
|
||||
@@ -49,6 +48,7 @@ Thanks to the authors of following resources included in the theme:
|
||||
* [Valine](https://valine.js.org/)
|
||||
* [cookieconsent](https://github.com/osano/cookieconsent)
|
||||
* [Watermark](https://github.com/Lruihao/watermark)
|
||||
* [pangu.js](https://github.com/vinta/pangu.js)
|
||||
|
||||
## Author
|
||||
|
||||
|
||||
@@ -54,6 +54,8 @@ libFiles:
|
||||
normalizeCSS: normalize.css@8.0.1/normalize.min.css
|
||||
# object-fit-images@3.2.4 https://github.com/fregante/object-fit-images
|
||||
objectFitImagesJS: object-fit-images@3.2.4/dist/ofi.min.js
|
||||
# pangu.js@4.0.7 https://github.com/vinta/pangu.js
|
||||
panguJS: pangu@4.0.7/dist/browser/pangu.min.js
|
||||
# sharer.js@0.4.2 https://github.com/ellisonleao/sharer.js
|
||||
sharerJS: sharer.js@0.4.2/sharer.min.js
|
||||
# twemoji@13.1.0 https://github.com/twitter/twemoji
|
||||
|
||||
@@ -18,6 +18,7 @@ mermaid@8.13.3 https://github.com/knsv/mermaid
|
||||
meting@2.0.1 https://github.com/metowolf/MetingJS
|
||||
normalize.css@8.0.1 https://github.com/necolas/normalize.css
|
||||
object-fit-images@3.2.4 https://github.com/fregante/object-fit-images
|
||||
pangu.js@4.0.7 https://github.com/vinta/pangu.js
|
||||
sharer.js@0.4.2 https://github.com/ellisonleao/sharer.js
|
||||
simple-icons@5.21.1 https://github.com/simple-icons/simple-icons
|
||||
twemoji@13.1.0 https://github.com/twitter/twemoji
|
||||
|
||||
Vendored
+9
File diff suppressed because one or more lines are too long
@@ -985,6 +985,13 @@ enableEmoji = true
|
||||
# 打字结束之后光标的持续时间 (单位是毫秒, "-1" 代表无限大)
|
||||
duration = -1
|
||||
|
||||
# PanguJS config since v0.2.12
|
||||
# 盘古之白配置 since v0.2.12
|
||||
[params.pangu]
|
||||
# For Chinese writing
|
||||
# 适用于中文写作用户
|
||||
enable = true
|
||||
|
||||
# Watermark config since v0.2.12
|
||||
# Detail config see https://github.com/Lruihao/watermark#readme
|
||||
# 水印配置 since v0.2.12
|
||||
|
||||
@@ -166,6 +166,12 @@
|
||||
{{- $config = $cookieconsentConfig | dict "cookieconsent" | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* PanguJS */ -}}
|
||||
{{- if eq .Site.Params.pangu.enable true -}}
|
||||
{{- $source := $cdn.metingJS | default "lib/pangu/pangu.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Watermark */ -}}
|
||||
{{- if eq .Site.Params.watermark.enable true -}}
|
||||
{{- $source := "lib/watermark/watermark.min.js" -}}
|
||||
@@ -225,41 +231,7 @@
|
||||
|
||||
{{- /* Initialize libraries scripts */ -}}
|
||||
<script type="text/javascript">
|
||||
{{- /* PWA Initialization */ -}}
|
||||
{{- if eq hugo.Environment "production" | and .Site.Params.enablePWA -}}
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker
|
||||
.register('/service-worker.min.js', { scope: '/' })
|
||||
.then(function (registration) {
|
||||
// console.log('Service Worker Registered');
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.error('error: ', error);
|
||||
});
|
||||
navigator.serviceWorker.ready.then(function (registration) {
|
||||
// console.log('Service Worker Ready');
|
||||
});
|
||||
}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Watermark Initialization */ -}}
|
||||
{{- if eq .Site.Params.watermark.enable true -}}
|
||||
{{- with .Site.Params.watermark -}}
|
||||
new Watermark({
|
||||
content: {{ .Content }} || '<i class="fa-stack fa-xs logo-icon"><i class="fas fa-bug fa-stack-1x"></i><i class="fas fa-ban fa-stack-2x"></i></i> Theme FixIt',
|
||||
appendTo: {{ .AppendTo }} || '.wrapper>.main',
|
||||
opacity: {{ .Opacity }},
|
||||
width: {{ .Width }},
|
||||
height: {{ .Height }},
|
||||
rowSpacing: {{ .RowSpacing }},
|
||||
colSpacing: {{ .ColSpacing }},
|
||||
rotate: {{ .Rotate }},
|
||||
fontSize: {{ .FontSize }}
|
||||
});
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Site time Initialization */ -}}
|
||||
{{- /* Calculate run time */ -}}
|
||||
{{- if eq .Site.Params.ibruce.enable true | and .Site.Params.ibruce.siteTime -}}
|
||||
function createTime() {
|
||||
let now = new Date();
|
||||
@@ -272,11 +244,59 @@
|
||||
seconds = Math.floor((now - run) / 1000 - (24 * 60 * 60 * days) - (60 * 60 * hours) - (60 * minutes));
|
||||
document.querySelector(".run-times").innerHTML = `${days}d ${String(hours).padStart(2,0)}h ${String(minutes).padStart(2,0)}m ${String(seconds).padStart(2,0)}s`;
|
||||
}
|
||||
|
||||
if (!document.hidden) {
|
||||
var siteTime = setInterval("createTime()", 500);
|
||||
} else {
|
||||
clearInterval(siteTime);
|
||||
}
|
||||
{{- end -}}
|
||||
|
||||
/**
|
||||
* Immediate.
|
||||
*/
|
||||
(() => {
|
||||
{{- /* PWA Initialization */ -}}
|
||||
{{- if eq hugo.Environment "production" | and .Site.Params.enablePWA -}}
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker
|
||||
.register('/service-worker.min.js', { scope: '/' })
|
||||
.then(function (registration) {
|
||||
// console.log('Service Worker Registered');
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.error('error: ', error);
|
||||
});
|
||||
navigator.serviceWorker.ready.then(function (registration) {
|
||||
// console.log('Service Worker Ready');
|
||||
});
|
||||
}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Watermark Initialization */ -}}
|
||||
{{- if eq .Site.Params.watermark.enable true -}}
|
||||
{{- with .Site.Params.watermark -}}
|
||||
new Watermark({
|
||||
content: {{ .Content }} || '<i class="fa-stack fa-xs logo-icon"><i class="fas fa-bug fa-stack-1x"></i><i class="fas fa-ban fa-stack-2x"></i></i> Theme FixIt',
|
||||
appendTo: {{ .AppendTo }} || '.wrapper>.main',
|
||||
opacity: {{ .Opacity }},
|
||||
width: {{ .Width }},
|
||||
height: {{ .Height }},
|
||||
rowSpacing: {{ .RowSpacing }},
|
||||
colSpacing: {{ .ColSpacing }},
|
||||
rotate: {{ .Rotate }},
|
||||
fontSize: {{ .FontSize }}
|
||||
});
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Site time Initialization */ -}}
|
||||
{{- if eq .Site.Params.ibruce.enable true | and .Site.Params.ibruce.siteTime -}}
|
||||
if (!document.hidden) {
|
||||
var siteTime = setInterval("createTime()", 500);
|
||||
} else {
|
||||
clearInterval(siteTime);
|
||||
}
|
||||
{{- end -}}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// Listen to any DOM change and automatically perform spacing via MutationObserver()
|
||||
{{ if eq .Site.Params.pangu.enable true }}pangu.autoSpacingPage();{{ end }}
|
||||
});
|
||||
|
||||
})();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user