From 1a810c8b9bef831f21b0b5a046ae1a51f6fb0754 Mon Sep 17 00:00:00 2001 From: YuYang Shen Date: Mon, 1 Sep 2025 13:23:12 +0800 Subject: [PATCH 1/3] remove extensions.discard() --- source/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/source/conf.py b/source/conf.py index 01ba127..052c3cb 100644 --- a/source/conf.py +++ b/source/conf.py @@ -117,7 +117,6 @@ try: except Exception as e: print(f"⚠️ Mermaid 初始化失败: {e}") print("⚠️ 图表将显示为代码块,请安装 Chrome 和 mermaid-cli") - extensions.discard('sphinxcontrib.mermaid') # ================= CHM特化配置 ================= if is_chm_build: -- 2.54.0 From ec4cd1efc91d6dfed2c42624e32c2fb686d7a146 Mon Sep 17 00:00:00 2001 From: YuYang Shen Date: Thu, 4 Sep 2025 16:15:06 +0800 Subject: [PATCH 2/3] Add Custom Rule --- source/_static/custom.js | 17 +++++++++++++++++ source/conf.py | 4 ++++ 2 files changed, 21 insertions(+) create mode 100644 source/_static/custom.js diff --git a/source/_static/custom.js b/source/_static/custom.js new file mode 100644 index 0000000..683a00c --- /dev/null +++ b/source/_static/custom.js @@ -0,0 +1,17 @@ +document.addEventListener('DOMContentLoaded', function() { + // 禁用右键菜单 + document.addEventListener('contextmenu', function(e) { + e.preventDefault(); + }); + + // 禁用文本选择 + document.styleSheets[0].addRule('body', '-webkit-user-select: none!important;'); + document.styleSheets[0].addRule('body', '-moz-user-select: none!important;'); + document.styleSheets[0].addRule('body', '-ms-user-select: none!important;'); + document.styleSheets[0].addRule('body', 'user-select: none!important;'); + + // 禁用拖拽 + document.addEventListener('dragstart', function(e) { + e.preventDefault(); + }); +}); \ No newline at end of file diff --git a/source/conf.py b/source/conf.py index 052c3cb..7d26aae 100644 --- a/source/conf.py +++ b/source/conf.py @@ -59,6 +59,10 @@ html_theme_options = { # ================= 高级功能 ================= +html_js_files = [ + 'custom.js' +] + # ================== Mermaid 配置 ================== def find_system_chrome(): """自动检测系统 Chrome/Chromium 可执行路径""" -- 2.54.0 From 6e39d12af56b830f7a7160b6bda22ade143d7f59 Mon Sep 17 00:00:00 2001 From: YuYang Shen Date: Fri, 5 Sep 2025 11:47:27 +0800 Subject: [PATCH 3/3] Add --no-cache-dir to prevent error --- .gitea/workflows/sphinx_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/sphinx_deploy.yml b/.gitea/workflows/sphinx_deploy.yml index 18f2f41..829d341 100644 --- a/.gitea/workflows/sphinx_deploy.yml +++ b/.gitea/workflows/sphinx_deploy.yml @@ -37,7 +37,7 @@ jobs: if [ $REQ_MOD_TIME -gt $VENV_MOD_TIME ]; then echo "Master branch requirements updated, installing new dependencies..." - pip install -r requirements.txt + pip install -r requirements.txt --no-cache-dir echo $REQ_MOD_TIME > .venv-shared/last_update.txt fi fi -- 2.54.0