From 984cfa4eedb6f36e6acf853bcfb758f85d183f00 Mon Sep 17 00:00:00 2001
From: Super Manito <68613938+SuperManito@users.noreply.github.com>
Date: Tue, 8 Apr 2025 02:28:46 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ChangeMirrors.sh | 11 +-
DockerInstallation.sh | 11 +-
docs/assets/images/sponsor/qiaoxh-dark.svg | 1 +
docs/assets/images/sponsor/qiaoxh-light.svg | 1 +
docs/index.md | 19 +-
docs/mirrors/index.md | 2 +
docs/sponsor/index.md | 35 +--
docs/sponsor/main.html | 22 ++
docs/stylesheets/extra.css | 40 ++-
docs/theme/partials/palette.html | 44 +--
docs/theme/partials/toc.html | 10 +-
docs/use/index.md | 323 ++++++++++----------
mkdocs.yml | 16 +-
requirements.txt | 1 +
14 files changed, 287 insertions(+), 249 deletions(-)
create mode 100644 docs/assets/images/sponsor/qiaoxh-dark.svg
create mode 100644 docs/assets/images/sponsor/qiaoxh-light.svg
create mode 100644 docs/sponsor/main.html
diff --git a/ChangeMirrors.sh b/ChangeMirrors.sh
index c8af353..6e8e019 100755
--- a/ChangeMirrors.sh
+++ b/ChangeMirrors.sh
@@ -631,7 +631,16 @@ function run_end() {
echo ''
return
fi
- echo -e "\n✨ 脚本运行完毕,更多使用教程详见官网 👉 \033[3mhttps://linuxmirrors.cn\033[0m\n\n🔥 1Panel · Linux 面板|极简运维 ➜ https://1panel.cn \033[3;2m【广告】\033[0m\n🔥 林枫云 · 专注独立IP高频VPS|R9/i9系列定制 ➜ https://www.dkdun.cn \033[3;2m【广告】\033[0m\n\n\033[3;1mPowered by \033[34mLinuxMirrors\033[0m\n"
+ local sponsor_ad=(
+ "🔥 1Panel · Linux 面板|极简运维 ➜ https://1panel.cn \033[3;2m【广告】\033[0m"
+ "🔥 林枫云 · 专注独立IP高频VPS|R9/i9系列定制 ➜ https://www.dkdun.cn \033[3;2m【广告】\033[0m"
+ "🔥 乔星欢 · 香港4核4G服务器28元起_香港500Mbps大带宽 ➜ https://www.qiaoxh.com \033[3;2m【广告】\033[0m"
+ )
+ echo -e "\n✨ 脚本运行完毕,更多使用教程详见官网 👉 \033[3mhttps://linuxmirrors.cn\033[0m\n"
+ for ad in "${sponsor_ad[@]}"; do
+ echo -e " ${ad}"
+ done
+ echo -e "\n\033[3;1mPowered by \033[34mLinuxMirrors\033[0m\n"
}
## 报错退出
diff --git a/DockerInstallation.sh b/DockerInstallation.sh
index d3ff193..8857282 100755
--- a/DockerInstallation.sh
+++ b/DockerInstallation.sh
@@ -340,7 +340,16 @@ function run_end() {
echo ''
return
fi
- echo -e "\n✨ 脚本运行完毕,更多使用教程详见官网 👉 \033[3mhttps://linuxmirrors.cn\033[0m\n\n🔥 1Panel · Linux 面板|极简运维 ➜ https://1panel.cn \033[3;2m【广告】\033[0m\n🔥 林枫云 · 专注独立IP高频VPS|R9/i9系列定制 ➜ https://www.dkdun.cn \033[3;2m【广告】\033[0m\n\n\033[3;1mPowered by \033[34mLinuxMirrors\033[0m\n"
+ local sponsor_ad=(
+ "🔥 1Panel · Linux 面板|极简运维 ➜ https://1panel.cn \033[3;2m【广告】\033[0m"
+ "🔥 林枫云 · 专注独立IP高频VPS|R9/i9系列定制 ➜ https://www.dkdun.cn \033[3;2m【广告】\033[0m"
+ "🔥 乔星欢 · 香港4核4G服务器28元起_香港500Mbps大带宽 ➜ https://www.qiaoxh.com \033[3;2m【广告】\033[0m"
+ )
+ echo -e "\n✨ 脚本运行完毕,更多使用教程详见官网 👉 \033[3mhttps://linuxmirrors.cn\033[0m\n"
+ for ad in "${sponsor_ad[@]}"; do
+ echo -e " ${ad}"
+ done
+ echo -e "\n\033[3;1mPowered by \033[34mLinuxMirrors\033[0m\n"
}
## 报错退出
diff --git a/docs/assets/images/sponsor/qiaoxh-dark.svg b/docs/assets/images/sponsor/qiaoxh-dark.svg
new file mode 100644
index 0000000..184d069
--- /dev/null
+++ b/docs/assets/images/sponsor/qiaoxh-dark.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/assets/images/sponsor/qiaoxh-light.svg b/docs/assets/images/sponsor/qiaoxh-light.svg
new file mode 100644
index 0000000..4532d23
--- /dev/null
+++ b/docs/assets/images/sponsor/qiaoxh-light.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/index.md b/docs/index.md
index dbb007e..0d3367b 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -125,21 +125,4 @@ hide:
[开 始 使 用](use/index.md){ .md-button .md-button--primary } [查看软件源列表](mirrors/index.md){ .md-button }
-
+--8<-- "docs/sponsor/main.html"
diff --git a/docs/mirrors/index.md b/docs/mirrors/index.md
index 9acf1cc..8e59888 100644
--- a/docs/mirrors/index.md
+++ b/docs/mirrors/index.md
@@ -4,6 +4,8 @@ hide:
- toc
- feedback
- footer
+search:
+ exclude: true
---
## 中国大陆 :flag-CN:
diff --git a/docs/sponsor/index.md b/docs/sponsor/index.md
index bb671ac..60a05da 100644
--- a/docs/sponsor/index.md
+++ b/docs/sponsor/index.md
@@ -6,29 +6,16 @@ hide:
- footer
---
-
+--8<-- "docs/sponsor/main.html"
-# 成为赞助商
+#
-
-
-> 点击按钮前往查看爱发电主页上的说明并与作者取得联系
+
+ 成为赞助商
+
+
+
+ 请前往作者爱发电主页查看说明并与作者取得联系
+
diff --git a/docs/sponsor/main.html b/docs/sponsor/main.html
new file mode 100644
index 0000000..228a1d7
--- /dev/null
+++ b/docs/sponsor/main.html
@@ -0,0 +1,22 @@
+
\ No newline at end of file
diff --git a/docs/stylesheets/extra.css b/docs/stylesheets/extra.css
index ccdb4d8..32c28c5 100644
--- a/docs/stylesheets/extra.css
+++ b/docs/stylesheets/extra.css
@@ -6,6 +6,21 @@
--md-default-bg-color--dark: hsla(var(--md-hue), 15%, 14%, 1);
}
+[data-md-color-primary=white] {
+ --md-typeset-a-color: #2080f0;
+}
+
+[data-md-color-scheme='slate'][data-md-color-primary=black] {
+ --md-typeset-a-color: #2080f0;
+}
+
+.md-typeset .admonition.tip, .md-typeset details.tip {
+ border-color: #009400;
+}
+.md-typeset .tip>.admonition-title, .md-typeset .tip>summary {
+ background-color: #0094001a;
+}
+
.md-header {
background-color: hsla(240, 9%, 75%, 0.33);
-webkit-backdrop-filter: blur(8px);
@@ -85,25 +100,25 @@
vertical-align: -0.35em !important;
}
-.md-nav__sponsor-bottom {
+.sponsor {
margin-top: 2rem;
padding-top: 1rem;
border-top: 1px solid var(--md-default-fg-color--lightest);
}
-.md-nav__sponsor-bottom .sponsor-label {
+.sponsor .sponsor-label {
font-size: 0.8rem;
text-align: center;
margin-bottom: 0.2rem;
color: var(--md-default-fg-color);
}
-.md-nav__sponsor-bottom .sponsor-wrapper {
+.sponsor .sponsor-wrapper {
width: 100%;
padding: 0.5rem 0;
}
-.md-nav__sponsor-bottom .sponsor-item {
+.sponsor .sponsor-item {
display: flex;
align-items: center;
justify-content: center;
@@ -116,11 +131,11 @@
max-height: 80px;
}
-.md-nav__sponsor-bottom .sponsor-item:hover {
+.sponsor .sponsor-item:hover {
background-color: var(--md-code-bg-color);
}
-.md-nav__sponsor-bottom .sponsor-item img {
+.sponsor .sponsor-item img {
max-width: 100%;
height: auto;
vertical-align: middle;
@@ -139,14 +154,23 @@
max-width: 300px;
}
-@media screen and (max-width: 960px) {
+@media screen and (max-width: 768px) {
.sponsor-flex-item {
flex: 0 1 calc(50% - 1rem);
+ min-width: 150px;
+ max-width: calc(50% - 1rem);
+ }
+}
+
+@media screen and (max-width: 480px) {
+ .sponsor .sponsor-item {
+ padding: 0;
+ height: 40px;
}
}
@media screen and (max-width: 768px) {
- .md-nav__sponsor-bottom {
+ .sponsor-toc {
display: none;
}
}
diff --git a/docs/theme/partials/palette.html b/docs/theme/partials/palette.html
index a3a2955..f9ed6ad 100644
--- a/docs/theme/partials/palette.html
+++ b/docs/theme/partials/palette.html
@@ -23,8 +23,9 @@
if (typeof document.startViewTransition !== 'function') {
return // 不支持 View Transitions API 的浏览器直接返回
}
- // 获取所有主题切换按钮
- const themeToggles = document.querySelectorAll('.md-header__button.md-icon')
+ // 获取所有主题切换按钮 - 更精确的选择器
+ // 只选择form[data-md-component="palette"]内部的按钮,而不是所有md-header__button
+ const themeToggles = document.querySelectorAll('form[data-md-component="palette"] .md-header__button.md-icon')
themeToggles.forEach((toggle) => {
toggle.addEventListener(
'click',
@@ -36,28 +37,12 @@
const targetId = this.getAttribute('for')
const targetInput = document.getElementById(targetId)
if (!targetInput) return
- // 获取当前存储的主题信息和即将切换到的主题信息
- const currentPalette = __md_get('__palette')
- const currentScheme = currentPalette?.color?.scheme || ''
- const currentMedia = currentPalette?.color?.media || ''
- // 获取新主题信息
- const newScheme = targetInput.getAttribute('data-md-color-scheme')
- const newMedia = targetInput.getAttribute('data-md-color-media')
- // 判断当前浏览器/系统主题
- const isSystemDark = window.matchMedia('(prefers-color-scheme: dark)').matches
- // 判断是否切换到暗色主题
- const isDark = newScheme != 'default'
- // 确定当前主题的实际暗色状态
- let isCurrentDark = currentScheme.includes('slate')
- if (currentMedia === '(prefers-color-scheme)') {
- isCurrentDark = isSystemDark
- }
- // 确定新主题的实际暗色状态
- let isNewDark = newScheme.includes('slate')
- if (newMedia === '(prefers-color-scheme)') {
- isNewDark = isSystemDark
- }
- // 如果当前主题和目标主题相同,则不需要动画
+ // 获取当前主题状态
+ const currentScheme = document.body.getAttribute('data-md-color-scheme')
+ const isCurrentDark = currentScheme.includes('slate')
+ // 点击后会切换到相反的主题
+ const isNewDark = !isCurrentDark
+ // 当前主题和目标主题相同则不触发动画
if (isCurrentDark === isNewDark) {
targetInput.click()
return
@@ -74,8 +59,8 @@
// 切换主题
targetInput.click()
// 添加暗/亮模式类,用于动画控制
- document.documentElement.classList.remove(isDark ? 'light' : 'dark')
- document.documentElement.classList.add(isDark ? 'dark' : 'light')
+ document.documentElement.classList.remove(isNewDark ? 'light' : 'dark')
+ document.documentElement.classList.add(isNewDark ? 'dark' : 'light')
// 等待主题变化完成
await new Promise((resolve) => setTimeout(resolve, 100))
})
@@ -83,12 +68,12 @@
// 视图过渡准备就绪,开始动画
document.documentElement.animate(
{
- clipPath: isDark ? [...clipPath].reverse() : clipPath,
+ clipPath: isNewDark ? [...clipPath].reverse() : clipPath,
},
{
duration: 500,
easing: 'ease-in',
- pseudoElement: isDark ? '::view-transition-old(root)' : '::view-transition-new(root)',
+ pseudoElement: isNewDark ? '::view-transition-old(root)' : '::view-transition-new(root)',
}
)
})
@@ -97,8 +82,7 @@
)
})
// 初始化主题状态类
- const currentPalette = __md_get('__palette')
- const currentScheme = currentPalette?.color?.scheme || ''
+ const currentScheme = document.body.getAttribute('data-md-color-scheme')
const isDark = currentScheme.includes('slate')
document.documentElement.classList.add(isDark ? 'dark' : 'light')
})
diff --git a/docs/theme/partials/toc.html b/docs/theme/partials/toc.html
index 05effbd..00d8c94 100644
--- a/docs/theme/partials/toc.html
+++ b/docs/theme/partials/toc.html
@@ -9,19 +9,23 @@
-