diff --git a/pages/index.html b/pages/index.html index 30e59e0..e82eda6 100644 --- a/pages/index.html +++ b/pages/index.html @@ -228,25 +228,21 @@

基础用法示例

-

Git 克隆

git clone https://example.com/https://github.com/user/project.git - + class="d-block mb-3">git clone https://example.com/https://github.com/user/project.git

私有仓库克隆

git clone https://user:your_token@example.com/https://github.com/user/project.git + class="d-block">git clone https://user:your_token@example.com/https://github.com/user/project.git
-

文件下载

wget https://example.com/https://raw.githubusercontent.com/user/project/main/README.md - + class="d-block mb-3">wget https://example.com/https://raw.githubusercontent.com/user/project/main/README.md

版本发布

curl -LO https://example.com/https://github.com/user/project/releases/download/v1.0.0./project_1.0.0.amd64.tar.gz + class="d-block">curl -LO https://example.com/https://github.com/user/project/releases/download/v1.0.0/project_1.0.0.amd64.tar.gz
@@ -319,13 +315,17 @@ const input = document.getElementById('inputUrl'); const output = document.getElementById('output'); const outputLink = document.getElementById('outputLink'); + // 获取当前域名 + const CURRENT_PROTOCOL = window.location.protocol.replace(':', ''); const CURRENT_HOST = window.location.host; - document.querySelectorAll('code').forEach(code => { - const spanElement = code.querySelector('span'); - if (spanElement) { - spanElement.textContent = CURRENT_HOST; - } + // 替换协议部分 + document.querySelectorAll('code .protocol').forEach(span => { + span.textContent = CURRENT_PROTOCOL; + }); + // 替换域名部分 + document.querySelectorAll('code .host').forEach(span => { + span.textContent = CURRENT_HOST; }); // URL 转换规则