-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc92335
commit 7ae6ad8
Showing
1 changed file
with
165 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
<!DOCTYPE html> | ||
<html><head> | ||
<title>Zigup</title> | ||
<style> | ||
|
||
* { margin:0; padding:0; font-family: courier; text-align:center } | ||
|
||
#InstallDiv { | ||
margin:10px; | ||
} | ||
|
||
.CopyButton { | ||
padding:5px; | ||
} | ||
|
||
.FilterButton { | ||
display:inline-block; | ||
width: 60px; | ||
height: 15px; | ||
line-height: 15px; | ||
text-align:center; | ||
padding: 10px; | ||
border-radius: 2px; | ||
border: 0; | ||
background:#ccc; | ||
font-size: 15px; | ||
color: #000; | ||
cursor:default; | ||
user-select:none; | ||
font-weight:bold; | ||
} | ||
.FilterButton:hover { | ||
background:#aaa; | ||
} | ||
.FilterButtonEnabled { | ||
background:#4287f5; | ||
} | ||
.FilterButtonEnabled:hover { | ||
background:#3277e5; | ||
} | ||
</style> | ||
<script> | ||
|
||
const version = "v2024_05_05"; | ||
function get(id) { return document.getElementById(id); } | ||
|
||
|
||
function copyCommand(id) { | ||
pre = get('command' + id); | ||
console.log("TODO: copy command '" + pre.innerHTML + "'"); | ||
} | ||
|
||
function generateCommandHtml(ids, cmd) { | ||
const id = ids.next_id; | ||
ids.next_id++; | ||
return ( | ||
'<div>' + | ||
'<button class="CopyButton" onclick="copyCommand(' + id + ')">Copy</button> ' + | ||
'<pre style="display:inline-block" id="command' + id + '">' + cmd + '</pre>' + | ||
'</div>' | ||
); | ||
} | ||
|
||
function updateButton(button, enable) { | ||
if (enable) { | ||
button.classList.add("FilterButtonEnabled"); | ||
} else { | ||
button.classList.remove("FilterButtonEnabled"); | ||
} | ||
} | ||
|
||
function toggleOs(os) { | ||
if (current_os == os) { | ||
current_os = -1; | ||
} else { | ||
current_os = os; | ||
} | ||
updateButton(get("ButtonLinux"), current_os == OS_LINUX); | ||
updateButton(get("ButtonMacos"), current_os == OS_MACOS); | ||
updateButton(get("ButtonWindows"), current_os == OS_WINDOWS); | ||
updateInstallDiv(); | ||
} | ||
function toggleArch(arch) { | ||
if (current_arch == arch) { | ||
current_arch = -1; | ||
} else { | ||
current_arch = arch; | ||
} | ||
updateButton(get("ButtonX86_64"), current_arch == ARCH_X86_64); | ||
updateButton(get("ButtonAArch64"), current_arch == ARCH_AARCH64); | ||
updateInstallDiv(); | ||
} | ||
|
||
const OS_LINUX = 0; | ||
const OS_MACOS = 1; | ||
const OS_WINDOWS = 2; | ||
const ARCH_X86_64 = 0; | ||
const ARCH_AARCH64 = 1; | ||
|
||
var current_os = -1; | ||
var current_arch = -1; | ||
var include_curl = true; | ||
var include_wget = true; | ||
|
||
function updateInstallDiv() { | ||
var arch_os_list = []; | ||
if (current_os == OS_LINUX) { | ||
if (current_arch == ARCH_X86_64) { | ||
arch_os_list.push("x86_64-linux"); | ||
} | ||
if (current_arch == ARCH_AARCH64) { | ||
arch_os_list.push("aarch64-linux"); | ||
} | ||
} else if (current_os == OS_MACOS) { | ||
if (current_arch == ARCH_X86_64) { | ||
arch_os_list.push("x86_64-macos"); | ||
} | ||
if (current_arch == ARCH_AARCH64) { | ||
arch_os_list.push("aarch64-macos"); | ||
} | ||
} else if (current_os == OS_WINDOWS) { | ||
if (current_arch == ARCH_X86_64) { | ||
arch_os_list.push("x86_64-windows"); | ||
} | ||
} | ||
|
||
html = ''; | ||
|
||
var ids = { next_id: 0 }; | ||
if (include_curl) { | ||
for (var i = 0; i < arch_os_list.length; i++) { | ||
const arch_os = arch_os_list[i]; | ||
html += generateCommandHtml(ids, 'curl -L https://github.com/marler8997/zigup/releases/download/' + version + '/zigup-' + arch_os + '.tar.gz | tar xz'); | ||
} | ||
} | ||
if (include_wget) { | ||
for (var i = 0; i < arch_os_list.length; i++) { | ||
const arch_os = arch_os_list[i]; | ||
html += generateCommandHtml(ids, 'wget -O - https://github.com/marler8997/zigup/releases/download/' + version + '/zigup-' + arch_os + '.tar.gz | tar xz'); | ||
} | ||
} | ||
get('InstallDiv').innerHTML = html; | ||
} | ||
|
||
function bodyOnload() { | ||
updateInstallDiv() | ||
} | ||
|
||
</script> | ||
</head><body onload="bodyOnload()"> | ||
|
||
<h1>Install Zigup</h1> | ||
<div style="margin:10px"> | ||
<span id="ButtonLinux" class="FilterButton" onclick="toggleOs(OS_LINUX)">Linux</span> | ||
<span id="ButtonMacos" class="FilterButton" onclick="toggleOs(OS_MACOS)">Macos</span> | ||
<span id="ButtonWindows" class="FilterButton" onclick="toggleOs(OS_WINDOWS)">Windows</span> | ||
</div> | ||
<div style="margin:10px"> | ||
<span id="ButtonX86_64" class="FilterButton" onclick="toggleArch(ARCH_X86_64)">x86_64</span> | ||
<span id="ButtonAArch64" class="FilterButton" onclick="toggleArch(ARCH_AARCH64)">aarch64</span> | ||
</div> | ||
<div id="InstallDiv"></div> | ||
|
||
|
||
</html> |