File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,34 +28,13 @@ Can't download? [Click here to download (alternative)](https://alist.8mi.tech/d/
2828
2929
3030<script >
31- async function checkUrl (url ) {
32- try {
33- const response = await fetch (url, { method: ' HEAD' });
34- return response .ok ;
35- } catch {
36- return false ;
37- }
38- }
39-
40- async function redirect () {
31+ setTimeout (function () {
4132 const isZhCN = / ^ zh-CN/ i .test (navigator .language );
42- const url1 = " https://alist.8mi.tech/d/mirror/ms-jdk/Auto/microsoft-jdk-21-windows-aarch64.msi" ;
43- const url2 = " https://aka.ms/download-jdk/microsoft-jdk-21-windows-aarch64.msi" ;
44-
45- const [url1Available , url2Available ] = await Promise .all ([
46- checkUrl (url1),
47- checkUrl (url2)
48- ]);
49-
50- if (url1Available && ! url2Available) {
51- window .location .href = url1;
52- } else if (! url1Available && url2Available) {
53- window .location .href = url2;
54- } else {
55- window .location .href = isZhCN ? url1 : url2;
56- }
57- }
58-
59- setTimeout (redirect, 5000 ); // Wait 5 seconds
33+ const url = isZhCN
34+ ? " https://aka.ms/download-jdk/microsoft-jdk-21-windows-aarch64.msi"
35+ : " https://aka.ms/download-jdk/microsoft-jdk-21-windows-aarch64.msi" ;
36+ location .href = url;
37+ }, 5000 ); // Wait 5 seconds
6038</script >
6139
40+
Original file line number Diff line number Diff line change @@ -28,34 +28,12 @@ Can't download? [Click here to download (alternative)](https://alist.8mi.tech/d/
2828
2929
3030<script >
31- async function checkUrl (url ) {
32- try {
33- const response = await fetch (url, { method: ' HEAD' });
34- return response .ok ;
35- } catch {
36- return false ;
37- }
38- }
39-
40- async function redirect () {
31+ setTimeout (function () {
4132 const isZhCN = / ^ zh-CN/ i .test (navigator .language );
42- const url1 = " https://alist.8mi.tech/d/mirror/ms-jdk/Auto/microsoft-jdk-21-windows-x64.msi" ;
43- const url2 = " https://aka.ms/download-jdk/microsoft-jdk-21-windows-x64.msi" ;
44-
45- const [url1Available , url2Available ] = await Promise .all ([
46- checkUrl (url1),
47- checkUrl (url2)
48- ]);
49-
50- if (url1Available && ! url2Available) {
51- window .location .href = url1;
52- } else if (! url1Available && url2Available) {
53- window .location .href = url2;
54- } else {
55- window .location .href = isZhCN ? url1 : url2;
56- }
57- }
58-
59- setTimeout (redirect, 5000 ); // Wait 5 seconds
33+ const url = isZhCN
34+ ? " https://aka.ms/download-jdk/microsoft-jdk-21-windows-x64.msi"
35+ : " https://aka.ms/download-jdk/microsoft-jdk-21-windows-x64.msi" ;
36+ window .location .href = url;
37+ }, 5000 ); // Wait 5 seconds
6038</script >
6139
You can’t perform that action at this time.
0 commit comments