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: [email protected]/sha256.js
# [email protected] https://github.com/apache/echarts
echartsJS: [email protected]/dist/echarts.min.js
# [email protected] https://github.com/liriliri/eruda
erudaJS: [email protected]/eruda.js
# [email protected] https://github.com/FortAwesome/Font-Awesome
fontawesomeFreeCSS: '@fortawesome/[email protected]/css/all.min.css'
# [email protected] https://github.com/krisk/fuse
Expand Down Expand Up @@ -75,8 +73,6 @@ libFiles:
typeitJS: [email protected]/dist/index.umd.js
# [email protected] https://github.com/xCss/Valine
valineJS: [email protected]/dist/Valine.min.js
# [email protected] https://github.com/Tencent/vConsole
vconsoleJS: [email protected]/dist/vconsole.min.js
# [email protected] https://github.com/walinejs/waline
walineCSS: '@waline/[email protected]/dist/waline.css'
walineJS: '@waline/[email protected]/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: [email protected]/sha256.js
# [email protected] https://github.com/apache/echarts
echartsJS: [email protected]/dist/echarts.min.js
# [email protected] https://github.com/liriliri/eruda
erudaJS: [email protected]/eruda.js
# [email protected] https://github.com/FortAwesome/Font-Awesome
fontawesomeFreeCSS: '@fortawesome/[email protected]/css/all.min.css'
# [email protected] https://github.com/krisk/fuse
Expand Down Expand Up @@ -75,8 +73,6 @@ libFiles:
typeitJS: [email protected]/dist/index.umd.js
# [email protected] https://github.com/xCss/Valine
valineJS: [email protected]/dist/Valine.min.js
# [email protected] https://github.com/Tencent/vConsole
vconsoleJS: [email protected]/dist/vconsole.min.js
# [email protected] https://github.com/walinejs/waline
walineCSS: '@waline/[email protected]/dist/waline.css'
walineJS: '@waline/[email protected]/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 @@ [email protected] https://github.com/brix/crypto-js
[email protected] https://github.com/apache/echarts
TODO update emoji-data to 15.x
[email protected] https://github.com/iamcal/emoji-data
[email protected] https://github.com/liriliri/eruda
[email protected] https://github.com/FortAwesome/Font-Awesome
[email protected] https://github.com/krisk/fuse
[email protected] https://github.com/gitalk/gitalk
Expand All @@ -27,5 +26,4 @@ [email protected] https://github.com/twitter/twemoji
[email protected] https://github.com/imaegoo/twikoo
[email protected] https://github.com/alexmacarthur/typeit
[email protected] https://github.com/xCss/Valine
[email protected] https://github.com/Tencent/vConsole
[email protected] 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.