mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 23:38:56 +00:00
🔥 Feat: migrate mobile devtools to a single compenent (#474)
This commit is contained in:
@@ -199,8 +199,6 @@ Thanks to all the [contributors](https://github.com/hugo-fixit/FixIt/graphs/cont
|
||||
- [github-corners](https://github.com/tholman/github-corners)
|
||||
- [giscus](https://giscus.app/)
|
||||
- [crypto-js](https://github.com/brix/crypto-js)
|
||||
- [vConsole](https://github.com/Tencent/vConsole)
|
||||
- [eruda](https://github.com/liriliri/eruda)
|
||||
- [pace](https://github.com/CodeByZach/pace)
|
||||
|
||||
</details>
|
||||
|
||||
@@ -203,8 +203,6 @@ FixIt 支持下列语言:
|
||||
- [github-corners](https://github.com/tholman/github-corners)
|
||||
- [giscus](https://giscus.app/zh-CN)
|
||||
- [crypto-js](https://github.com/brix/crypto-js)
|
||||
- [vConsole](https://github.com/Tencent/vConsole)
|
||||
- [eruda](https://github.com/liriliri/eruda)
|
||||
- [pace](https://github.com/CodeByZach/pace)
|
||||
|
||||
</details>
|
||||
|
||||
@@ -31,8 +31,6 @@ libFiles:
|
||||
cryptoSha256JS: crypto-js@4.2.0/sha256.js
|
||||
# echarts@5.3.3 https://github.com/apache/echarts
|
||||
echartsJS: echarts@5.3.3/dist/echarts.min.js
|
||||
# eruda@3.0.1 https://github.com/liriliri/eruda
|
||||
erudaJS: eruda@3.0.1/eruda.js
|
||||
# fontawesome-free@6.4.2 https://github.com/FortAwesome/Font-Awesome
|
||||
fontawesomeFreeCSS: '@fortawesome/fontawesome-free@6.4.2/css/all.min.css'
|
||||
# fusejs@6.6.2 https://github.com/krisk/fuse
|
||||
@@ -75,8 +73,6 @@ libFiles:
|
||||
typeitJS: typeit@8.7.1/dist/index.umd.js
|
||||
# valine@1.5.1 https://github.com/xCss/Valine
|
||||
valineJS: valine@1.5.1/dist/Valine.min.js
|
||||
# vconsole@3.15.1 https://github.com/Tencent/vConsole
|
||||
vconsoleJS: vconsole@3.15.1/dist/vconsole.min.js
|
||||
# waline@2.15.8 https://github.com/walinejs/waline
|
||||
walineCSS: '@waline/client@2.15.8/dist/waline.css'
|
||||
walineJS: '@waline/client@2.15.8/dist/waline.js'
|
||||
|
||||
@@ -31,8 +31,6 @@ libFiles:
|
||||
cryptoSha256JS: crypto-js@4.2.0/sha256.js
|
||||
# echarts@5.3.3 https://github.com/apache/echarts
|
||||
echartsJS: echarts@5.3.3/dist/echarts.min.js
|
||||
# eruda@3.0.1 https://github.com/liriliri/eruda
|
||||
erudaJS: eruda@3.0.1/eruda.js
|
||||
# fontawesome-free@6.4.2 https://github.com/FortAwesome/Font-Awesome
|
||||
fontawesomeFreeCSS: '@fortawesome/fontawesome-free@6.4.2/css/all.min.css'
|
||||
# fusejs@6.6.2 https://github.com/krisk/fuse
|
||||
@@ -75,8 +73,6 @@ libFiles:
|
||||
typeitJS: typeit@8.7.1/dist/index.umd.js
|
||||
# valine@1.5.1 https://github.com/xCss/Valine
|
||||
valineJS: valine@1.5.1/dist/Valine.min.js
|
||||
# vconsole@3.15.1 https://github.com/Tencent/vConsole
|
||||
vconsoleJS: vconsole@3.15.1/dist/vconsole.min.js
|
||||
# waline@2.15.8 https://github.com/walinejs/waline
|
||||
walineCSS: '@waline/client@2.15.8/dist/waline.css'
|
||||
walineJS: '@waline/client@2.15.8/dist/waline.js'
|
||||
|
||||
@@ -1055,32 +1055,6 @@ class FixIt {
|
||||
this.config.encryption?.all && this.decryptor.init();
|
||||
}
|
||||
|
||||
initMDevtools() {
|
||||
const type = this.config?.mDevtools;
|
||||
if (typeof window.orientation === 'undefined') {
|
||||
return;
|
||||
}
|
||||
if (type === 'vConsole') {
|
||||
const vConsole = new VConsole({
|
||||
target: '.widgets',
|
||||
theme: this.isDark ? 'dark' : 'light'
|
||||
});
|
||||
this._vConsoleOnSwitchTheme = this._vConsoleOnSwitchTheme || (() => {
|
||||
vConsole.setOption('theme', this.isDark ? 'dark' : 'light');
|
||||
});
|
||||
this.switchThemeEventSet.add(this._vConsoleOnSwitchTheme);
|
||||
}
|
||||
if(type === 'eruda') {
|
||||
eruda.init({
|
||||
defaults: { theme: this.isDark ? 'Dark' : 'Light' }
|
||||
});
|
||||
this._erudaOnSwitchTheme = this._erudaOnSwitchTheme || (() => {
|
||||
eruda.util.evalCss.setTheme(this.isDark ? 'Dark' : 'Light');
|
||||
});
|
||||
this.switchThemeEventSet.add(this._erudaOnSwitchTheme);
|
||||
}
|
||||
}
|
||||
|
||||
initAutoMark() {
|
||||
if (!this.config.autoBookmark) {
|
||||
return;
|
||||
@@ -1265,7 +1239,6 @@ class FixIt {
|
||||
this.initSiteTime();
|
||||
this.initServiceWorker();
|
||||
this.initWatermark();
|
||||
this.initMDevtools();
|
||||
this.initAutoMark();
|
||||
this.initReward();
|
||||
|
||||
|
||||
Vendored
-2
@@ -9,7 +9,6 @@ crypto-js@4.2.0 https://github.com/brix/crypto-js
|
||||
echarts@5.3.3 https://github.com/apache/echarts
|
||||
TODO update emoji-data to 15.x
|
||||
emoji-data@14.0.0 https://github.com/iamcal/emoji-data
|
||||
eruda@3.0.1 https://github.com/liriliri/eruda
|
||||
fontawesome-free@6.4.2 https://github.com/FortAwesome/Font-Awesome
|
||||
fusejs@6.6.2 https://github.com/krisk/fuse
|
||||
gitalk@1.7.2 https://github.com/gitalk/gitalk
|
||||
@@ -27,5 +26,4 @@ twemoji@14.0.2 https://github.com/twitter/twemoji
|
||||
twikoo@1.6.22 https://github.com/imaegoo/twikoo
|
||||
typeit@8.7.1 https://github.com/alexmacarthur/typeit
|
||||
valine@1.5.1 https://github.com/xCss/Valine
|
||||
vconsole@3.15.1 https://github.com/Tencent/vConsole
|
||||
waline@2.15.8 https://github.com/walinejs/waline
|
||||
|
||||
Vendored
-3
File diff suppressed because one or more lines are too long
Vendored
-10
File diff suppressed because one or more lines are too long
@@ -810,11 +810,6 @@ enableEmoji = true
|
||||
enable = false
|
||||
# Check for updates
|
||||
c4u = false
|
||||
# Mobile Devtools config
|
||||
[params.dev.mDevtools]
|
||||
enable = false
|
||||
# "vConsole", "eruda" supported
|
||||
type = "vConsole"
|
||||
|
||||
# Page config
|
||||
[params.page]
|
||||
|
||||
@@ -198,17 +198,6 @@
|
||||
{{- $config = dict "all" (isset $params "password") "shortcode" ($encryptPartial | default false) | dict "encryption" | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Mobile Devtools */ -}}
|
||||
{{- $mDevtools := (.Scratch.Get "devOpts").mDevtools -}}
|
||||
{{- if $mDevtools.enable -}}
|
||||
{{- $devtoolsJS := $cdn.vconsoleJS | default "lib/vconsole/vconsole.min.js" -}}
|
||||
{{- if eq $mDevtools.type "eruda" -}}
|
||||
{{- $devtoolsJS = $cdn.erudaJS | default "lib/eruda/eruda.js" -}}
|
||||
{{- end -}}
|
||||
{{- dict "Source" $devtoolsJS "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = dict "mDevtools" ($mDevtools.type | default "vConsole") | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 不蒜子 */ -}}
|
||||
{{- if .Site.Params.busuanzi.enable | and hugo.IsProduction -}}
|
||||
{{- $source := .Site.Params.busuanzi.source | default "https://vercount.one/js" -}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- .Scratch.Set "version" "v0.3.10-51d64cb1" -}}
|
||||
{{- .Scratch.Set "version" "v0.3.10-24873c5e" -}}
|
||||
{{- .Scratch.Set "this" dict -}}
|
||||
|
||||
{{- partial "init/detection-env.html" . -}}
|
||||
|
||||
Reference in New Issue
Block a user