Skip to content

Commit

Permalink
🔥 Feat: migrate mobile devtools to a single compenent (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lruihao committed Aug 10, 2024
1 parent 24873c5 commit 1c84791
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 71 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 0 additions & 2 deletions README.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
4 changes: 0 additions & 4 deletions assets/data/cdn/jsdelivr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down
4 changes: 0 additions & 4 deletions assets/data/cdn/unpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down
27 changes: 0 additions & 27 deletions assets/js/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1265,7 +1239,6 @@ class FixIt {
this.initSiteTime();
this.initServiceWorker();
this.initWatermark();
this.initMDevtools();
this.initAutoMark();
this.initReward();

Expand Down
2 changes: 0 additions & 2 deletions assets/lib/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
3 changes: 0 additions & 3 deletions assets/lib/eruda/eruda.js

This file was deleted.

10 changes: 0 additions & 10 deletions assets/lib/vconsole/vconsole.min.js

This file was deleted.

5 changes: 0 additions & 5 deletions hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
11 changes: 0 additions & 11 deletions layouts/partials/assets.html
Original file line number Diff line number Diff line change
Expand Up @@ -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" -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/init/index.html
Original file line number Diff line number Diff line change
@@ -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" . -}}
Expand Down

0 comments on commit 1c84791

Please sign in to comment.