mirror of
https://gitee.com/huanghongxun/HMCL-docs.git
synced 2025-08-07 11:14:25 +08:00
Revert "Download link (#235)"
Some checks reported errors
continuous-integration/drone/push Build was killed
Some checks reported errors
continuous-integration/drone/push Build was killed
This reverts commit 32cef46dd2
.
This commit is contained in:
parent
32cef46dd2
commit
79a689c516
@ -28,13 +28,34 @@ Can't download? [Click here to download (alternative)](https://alist.8mi.tech/d/
|
||||
|
||||
|
||||
<script>
|
||||
setTimeout(function() {
|
||||
async function checkUrl(url) {
|
||||
try {
|
||||
const response = await fetch(url, { method: 'HEAD' });
|
||||
return response.ok;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async function redirect() {
|
||||
const isZhCN = /^zh-CN/i.test(navigator.language);
|
||||
const url = isZhCN
|
||||
? "https://aka.ms/download-jdk/microsoft-jdk-21-windows-aarch64.msi"
|
||||
: "https://aka.ms/download-jdk/microsoft-jdk-21-windows-aarch64.msi";
|
||||
location.href = url;
|
||||
}, 5000); // Wait 5 seconds
|
||||
const url1 = "https://alist.8mi.tech/d/mirror/ms-jdk/Auto/microsoft-jdk-21-windows-aarch64.msi";
|
||||
const url2 = "https://aka.ms/download-jdk/microsoft-jdk-21-windows-aarch64.msi";
|
||||
|
||||
const [url1Available, url2Available] = await Promise.all([
|
||||
checkUrl(url1),
|
||||
checkUrl(url2)
|
||||
]);
|
||||
|
||||
if (url1Available && !url2Available) {
|
||||
window.location.href = url1;
|
||||
} else if (!url1Available && url2Available) {
|
||||
window.location.href = url2;
|
||||
} else {
|
||||
window.location.href = isZhCN ? url1 : url2;
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(redirect, 5000); // Wait 5 seconds
|
||||
</script>
|
||||
|
||||
|
||||
|
@ -28,12 +28,34 @@ Can't download? [Click here to download (alternative)](https://alist.8mi.tech/d/
|
||||
|
||||
|
||||
<script>
|
||||
setTimeout(function() {
|
||||
async function checkUrl(url) {
|
||||
try {
|
||||
const response = await fetch(url, { method: 'HEAD' });
|
||||
return response.ok;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async function redirect() {
|
||||
const isZhCN = /^zh-CN/i.test(navigator.language);
|
||||
const url = isZhCN
|
||||
? "https://aka.ms/download-jdk/microsoft-jdk-21-windows-x64.msi"
|
||||
: "https://aka.ms/download-jdk/microsoft-jdk-21-windows-x64.msi";
|
||||
window.location.href = url;
|
||||
}, 5000); // Wait 5 seconds
|
||||
const url1 = "https://alist.8mi.tech/d/mirror/ms-jdk/Auto/microsoft-jdk-21-windows-x64.msi";
|
||||
const url2 = "https://aka.ms/download-jdk/microsoft-jdk-21-windows-x64.msi";
|
||||
|
||||
const [url1Available, url2Available] = await Promise.all([
|
||||
checkUrl(url1),
|
||||
checkUrl(url2)
|
||||
]);
|
||||
|
||||
if (url1Available && !url2Available) {
|
||||
window.location.href = url1;
|
||||
} else if (!url1Available && url2Available) {
|
||||
window.location.href = url2;
|
||||
} else {
|
||||
window.location.href = isZhCN ? url1 : url2;
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(redirect, 5000); // Wait 5 seconds
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user