mirror of
https://huihui.cat/mirrors/MikroTikPatch.git
synced 2025-12-10 03:24:37 +01:00
Update index.html
Signed-off-by: elseif <elseif@live.cn>
This commit is contained in:
parent
5eee7b4dbb
commit
826072d302
1 changed files with 16 additions and 8 deletions
24
index.html
24
index.html
|
|
@ -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", () => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue