Skip to content

Commit 38cc437

Browse files
committed
Update top-level download logic
* Remove JDK vs JRE toggle. * Add Windows ARM64 download. * Fix macOS x64 behavior bug.
1 parent 1829f59 commit 38cc437

1 file changed

Lines changed: 35 additions & 52 deletions

File tree

index.html

Lines changed: 35 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -116,21 +116,6 @@ <h1 class="display-3">Fiji</h1>
116116
</div>
117117
</div>
118118

119-
<!-- Java toggle -->
120-
<div class="download-toggle row mb-2">
121-
<label class="col-5 col-xs-4 col-xxl-3 col-form-label">Bundled&nbsp;Java</label>
122-
<div class="col-7 col-xs-8 ps-3">
123-
<div class="btn-group w-100" role="group">
124-
<input type="radio" class="btn-check" name="java" id="java-jdk" value="jdk" checked>
125-
<label class="btn btn-outline-secondary" for="java-jdk" title="Include a full copy of Java, so that all Fiji features work directly.">JDK</label>
126-
<input type="radio" class="btn-check" name="java" id="java-jre" value="jre" title="Hello">
127-
<label class="btn btn-outline-secondary" for="java-jre" title="Include a slim copy of Java. Smaller download size than the JDK version, but on-the-fly compilation of Java source code and certain JavaFX features will not work.">JRE</label>
128-
<input type="radio" class="btn-check" name="java" id="java-none" value="none">
129-
<label class="btn btn-outline-secondary" for="java-none" title="Do not include a copy of Java. You will need to install Java yourself.">None</label>
130-
</div>
131-
</div>
132-
</div>
133-
134119
<!-- Mirror toggle -->
135120
<div class="download-toggle row">
136121
<label class="col-5 col-xs-4 col-xxl-3 col-form-label">Mirror</label>
@@ -348,13 +333,11 @@ <h2>Partnered Projects</h2>
348333
text: 'for macOS &nbsp;|&nbsp; Intel',
349334
divider: true
350335
},
351-
/*
352336
windows_arm64: {
353337
prefix: 'fiji-latest-win-arm64',
354338
icon: 'fab fa-windows',
355339
text: 'for Windows &nbsp;|&nbsp; arm64'
356340
},
357-
*/
358341
windows_x64: {
359342
prefix: 'fiji-latest-win64',
360343
icon: 'fab fa-windows',
@@ -374,21 +357,21 @@ <h2>Partnered Projects</h2>
374357
text: 'for Linux &nbsp;|&nbsp; x86-64',
375358
divider: true
376359
},
377-
macosx: {
360+
macos_x64: {
378361
prefix: 'fiji-stable-macosx',
379362
icon: 'fab fa-apple',
380363
text: 'for macOS &nbsp;|&nbsp; Intel',
381364
divider: true
382365
},
383-
windows_x32: {
384-
prefix: 'fiji-stable-win32',
385-
icon: 'fab fa-windows',
386-
text: 'for Windows &nbsp;|&nbsp; x86-32'
387-
},
388366
windows_x64: {
389367
prefix: 'fiji-stable-win64',
390368
icon: 'fab fa-windows',
391-
text: 'for Windows &nbsp;|&nbsp; x86-64',
369+
text: 'for Windows &nbsp;|&nbsp; x86-64'
370+
},
371+
windows_x32: {
372+
prefix: 'fiji-stable-win32',
373+
icon: 'fab fa-windows',
374+
text: 'for Windows &nbsp;|&nbsp; x86-32',
392375
divider: true
393376
},
394377
other: {
@@ -403,74 +386,75 @@ <h2>Partnered Projects</h2>
403386
return document.querySelector('input[name="distribution"]:checked').value;
404387
}
405388

406-
function selectedJava() {
407-
return document.querySelector('input[name="java"]:checked').value;
408-
}
409-
410389
function selectedMirror() {
411390
return document.querySelector('input[name="mirror"]:checked').value;
412391
}
413392

414-
function javaSlug(prefix, java, force) {
393+
function javaSlug(prefix, force) {
415394
if (prefix.endsWith('-portable')) {
416395
// Portable bundle never includes Java.
417396
return force ? 'nojava' : '';
418397
}
419-
if (java === 'none') {
420-
// Platform-specific bundle always includes Java.
421-
return 'jdk';
422-
}
423-
return java;
398+
return 'jdk';
424399
}
425400

426-
function urlForDownload(option, distro, java, mirror) {
401+
function urlForDownload(option, distro, mirror) {
427402
if (option === undefined) return undefined;
428403
const prefix = option['prefix'];
429-
const suffix = javaSlug(prefix, java, true)
404+
const suffix = javaSlug(prefix, true)
430405
return `${mirrors[mirror].prefix}${distro}/${prefix}-${suffix}.zip`;
431406
}
432407

433408
function updateDownloadOptions() {
434409
const distro = selectedDistribution();
435-
const java = selectedJava();
436410
const mirror = selectedMirror();
437-
currentPlatform = java === 'none' ? 'other' : autoDetectPlatform();
438-
setDownload(currentPlatform, distro, java, mirror);
439-
updateDropdownOptions(distro, java, mirror);
411+
currentPlatform = autoDetectPlatform();
412+
setDownload(currentPlatform, distro, mirror);
413+
updateDropdownOptions(distro, mirror);
440414
}
441415

442-
function setDownload(platform, distro, java, mirror) {
416+
function setDownload(platform, distro, mirror) {
443417
const autoDownload = document.getElementById('auto-download');
444418
autoDownload.classList.remove('btn-danger');
445419
autoDownload.classList.add('btn-success');
446-
const option = downloadLinks[distro][platform];
447-
const url = urlForDownload(option, distro, java, mirror);
420+
421+
// Handle platform-specific fallbacks.
422+
console.log(`setDownload: platform=${platform} distro=${distro}`);
423+
if (platform === 'macos_arm64' && distro === 'stable') {
424+
// Note: No stable macOS ARM64; fall back to x64.
425+
platform = 'macos_x64';
426+
}
427+
if (platform === 'windows_arm64' && distro === 'stable') {
428+
// Note: No stable Windows ARM64; fall back to x64.
429+
platform = 'windows_x64';
430+
}
431+
console.log(`final answer: platform=${platform} distro=${distro}`);
432+
433+
const option = downloadLinks[distro][platform] || downloadLinks[distro]['other'];
434+
const url = urlForDownload(option, distro, mirror);
448435
if (url === undefined) return;
449436
autoDownload.href = url;
450-
const javaLabel = platform === 'other' || java === 'none' ?
451-
'' : ` &nbsp;|&nbsp; ${java}`;
452437
const downloadText = '<span class="big-text">Download</span><br>' +
453438
`<span class="scaled-text">${distro} ` +
454-
`&nbsp;|&nbsp; ${option['text'].replace('for ', '')}${javaLabel} ` +
439+
`&nbsp;|&nbsp; ${option['text'].replace('for ', '')} ` +
455440
`&nbsp;|&nbsp; ${mirror}</span>`;
456441
autoDownload.innerHTML =
457442
`<span class="big-text ${option['icon']}"></span>&nbsp;
458443
${downloadText}`;
459444
}
460445

461-
function updateDropdownOptions(distro, java, mirror) {
446+
function updateDropdownOptions(distro, mirror) {
462447
const dropdownMenu = document.getElementById('download-options');
463448
// Clear existing options
464449
dropdownMenu.innerHTML = '';
465450

466451
// Add all available options for the selected distribution
467452
for (const platform in downloadLinks[distro]) {
468453
const option = downloadLinks[distro][platform];
469-
const url = urlForDownload(option, distro, java, mirror);
454+
const url = urlForDownload(option, distro, mirror);
470455
if (url === undefined) continue;
471-
const slug = javaSlug(option.prefix, java, false);
472-
const javaSuffix = slug === '' ? '' : ` &nbsp;|&nbsp; ${slug}`;
473-
const downloadText = `Download ${option.text}${javaSuffix}`;
456+
const slug = javaSlug(option.prefix, false);
457+
const downloadText = `Download ${option.text}`;
474458

475459
const listItem = document.createElement('li');
476460
const link = document.createElement('a');
@@ -554,7 +538,6 @@ <h2>Partnered Projects</h2>
554538
selectClosestMirror();
555539
const toggleIDs = [
556540
'dist-latest', 'dist-stable',
557-
'java-jdk', 'java-jre', 'java-none',
558541
'mirror-us', 'mirror-uk'
559542
];
560543
toggleIDs.forEach(id => {

0 commit comments

Comments
 (0)