Update index.html

Signed-off-by: elseif <elseif@live.cn>
This commit is contained in:
elseif 2025-09-26 13:10:28 +08:00 committed by GitHub
parent 5eee7b4dbb
commit 826072d302
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,3 +1,4 @@
<!doctype html>
<html lang="en" class="scroll-smooth">
<head>
@ -627,7 +628,7 @@
});
// Update command display if a version is selected
const activeBtn = document.querySelector("#version-buttons button.active");
if (activeBtn) updateCommand(activeBtn.dataset.version);
activeBtn ? updateCommand(activeBtn.dataset.version) : updateCommand();
}
// GitHub proxy toggle event listener
@ -763,9 +764,10 @@
function updateCommand(version) {
const tool = document.querySelector('input[name="tool"]:checked').value;
const proxy = localStorage.getItem("gh-proxy-enabled") === "true" ? " | <span class='text-blue-400'>sed</span> <span class='text-orange-400'>'s#https://github.com#https://gh-proxy.com/https://github.com#g'</span>" : "";
const _version = version===undefined?"": `<span class="text-green-400">VERSION</span>=<span class="text-pink-400">${version}</span> `
const cmd = tool === "curl"
? `<pre class="text-slate-300"><code><span class="text-green-400">VERSION</span>=<span class="text-pink-400">${version}</span> <span class="text-blue-400">bash</span> \<(<span class="text-blue-400">curl</span> <span class="text-cyan-400">https://mikrotik.ltd/chr.sh</span>${proxy})</code></pre>`
: `<pre class="text-slate-300"><code><span class="text-green-400">VERSION</span>=<span class="text-pink-400">${version}</span> <span class="text-blue-400">bash</span> \<(<span class="text-blue-400">wget -O - </span><span class="text-cyan-400">https://mikrotik.ltd/chr.sh</span>${proxy})</code></pre>`;
? `<pre class="text-slate-300"><code>${_version}<span class="text-blue-400">bash</span> \<(<span class="text-blue-400">curl</span> <span class="text-cyan-400">https://mikrotik.ltd/chr.sh</span>${proxy})</code></pre>`
: `<pre class="text-slate-300"><code>${_version}<span class="text-blue-400">bash</span> \<(<span class="text-blue-400">wget -O - </span><span class="text-cyan-400">https://mikrotik.ltd/chr.sh</span>${proxy})</code></pre>`;
commandDiv.innerHTML = cmd;
}
@ -773,7 +775,7 @@
document.querySelectorAll('input[name="tool"]').forEach(radio => {
radio.addEventListener("change", () => {
const activeBtn = document.querySelector("#version-buttons button.active");
if (activeBtn) updateCommand(activeBtn.dataset.version);
activeBtn ? updateCommand(activeBtn.dataset.version) : updateCommand();
});
});
@ -782,12 +784,18 @@
buttons.forEach(btn => {
btn.addEventListener("click", (e) => {
e.preventDefault();
updateCommand(btn.dataset.version);
buttons.forEach(b => b.classList.remove("active"));
btn.classList.add("active");
if (btn.classList.contains("active")) {
updateCommand();
btn.classList.remove("active");
}else{
updateCommand(btn.dataset.version);
buttons.forEach(b => b.classList.remove("active"));
btn.classList.add("active");
}
});
});
buttons[0].click(); // Select first button by default
updateCommand();
// Copy command to clipboard functionality
copyBtn.addEventListener("click", () => {