mirror of
https://github.com/LCE-Hub/lce-hub.github.io.git
synced 2026-08-20 04:27:36 +00:00
Update links & Download
This commit is contained in:
parent
5e72a0ed9a
commit
8febdc0c7e
24
index.html
24
index.html
|
|
@ -93,33 +93,26 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="action-buttons">
|
<div class="action-buttons">
|
||||||
<a href="https://github.com/Emerald-Legacy-Launcher/Emerald-Legacy-Launcher/releases/latest"
|
<a href="https://github.com/LCE-Hub/LCE-Emerald-Launcher/releases/latest"
|
||||||
class="main-btn get-launcher" id="main-download-btn">
|
class="main-btn get-launcher" id="main-download-btn">
|
||||||
<div class="btn-content">
|
<div class="btn-content">
|
||||||
<span>Get Launcher</span>
|
<span>Get Launcher</span>
|
||||||
</div>
|
</div>
|
||||||
<img src="logo.png" class="btn-icon">
|
<img src="logo.png" class="btn-icon">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/Emerald-Legacy-Launcher/Emerald-Legacy-Launcher"
|
<a href="https://github.com/LCE-Hub/LCE-Emerald-Launcher" class="main-btn github-repo"
|
||||||
class="main-btn github-repo" target="_blank">
|
target="_blank">
|
||||||
<div class="btn-content">
|
<div class="btn-content">
|
||||||
<span class="btn-title">GitHub Repo</span>
|
<span class="btn-title">GitHub Repo</span>
|
||||||
</div>
|
</div>
|
||||||
<img src="github-icon.png" class="btn-icon-github">
|
<img src="github-icon.png" class="btn-icon-github">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://discord.gg/RHGRUwpmVc" class="main-btn join-discord" target="_blank">
|
<a href="https://discord.gg/xeqvKPrwwS" class="main-btn join-discord" target="_blank">
|
||||||
<div class="btn-content">
|
<div class="btn-content">
|
||||||
<span class="btn-title">Join Discord</span>
|
<span class="btn-title">Join Discord</span>
|
||||||
</div>
|
</div>
|
||||||
<img src="discord-icon.jpg" class="btn-icon-discord">
|
<img src="discord-icon.jpg" class="btn-icon-discord">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://fluxer.gg/s9ySzCPb" class="main-btn join-fluxer" target="_blank">
|
|
||||||
<div class="btn-content">
|
|
||||||
<span class="btn-title">Join Fluxer</span>
|
|
||||||
</div>
|
|
||||||
<img src="fluxer.svg" class="btn-icon">
|
|
||||||
</a>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="screenshot-carousel">
|
<div class="screenshot-carousel">
|
||||||
|
|
@ -184,9 +177,6 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content-footer">
|
<div class="content-footer">
|
||||||
<div class="roadmap-link">
|
|
||||||
<a href="https://github.com/orgs/Emerald-Legacy-Launcher/projects/2">DEVELOPMENT ROADMAP →</a>
|
|
||||||
</div>
|
|
||||||
<div class="acknowledgments">
|
<div class="acknowledgments">
|
||||||
<p>Developed by the Emerald Team. Original creators: 4J Studios & Mojang.</p>
|
<p>Developed by the Emerald Team. Original creators: 4J Studios & Mojang.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -216,8 +206,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="gallery-item large">
|
<div class="gallery-item large">
|
||||||
<div class="gallery-frame">
|
<div class="gallery-frame">
|
||||||
<img src="Launcher/settings.png" alt="Launcher Settings">
|
<img src="Launcher/settings.png" alt="LCE Workshop">
|
||||||
<div class="frame-caption">Settings</div>
|
<div class="frame-caption">Workshop</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -358,4 +348,4 @@
|
||||||
<script type="module" src="src/main.ts"></script>
|
<script type="module" src="src/main.ts"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 369 KiB After Width: | Height: | Size: 528 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 204 KiB After Width: | Height: | Size: 998 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 216 KiB After Width: | Height: | Size: 679 KiB |
147
src/main.ts
147
src/main.ts
|
|
@ -134,7 +134,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
document.querySelector('.carousel-arrow.left')?.addEventListener('click', () => rotateScreenshot(-1, true));
|
document.querySelector('.carousel-arrow.left')?.addEventListener('click', () => rotateScreenshot(-1, true));
|
||||||
document.querySelector('.carousel-arrow.right')?.addEventListener('click', () => rotateScreenshot(1, true));
|
document.querySelector('.carousel-arrow.right')?.addEventListener('click', () => rotateScreenshot(1, true));
|
||||||
|
|
||||||
const repo = 'Emerald-Legacy-Launcher/Emerald-Legacy-Launcher';
|
const repo = 'LCE-Hub/LCE-Emerald-Launcher';
|
||||||
const modal = document.getElementById('download-modal');
|
const modal = document.getElementById('download-modal');
|
||||||
const modalOptions = document.getElementById('modal-options');
|
const modalOptions = document.getElementById('modal-options');
|
||||||
const modalTitle = document.getElementById('modal-title');
|
const modalTitle = document.getElementById('modal-title');
|
||||||
|
|
@ -143,6 +143,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
let latestAssets: any[] = [];
|
let latestAssets: any[] = [];
|
||||||
let nightlyAssets: any[] = [];
|
let nightlyAssets: any[] = [];
|
||||||
let currentOSType = 'Windows';
|
let currentOSType = 'Windows';
|
||||||
|
let fetchStatus: 'loading' | 'success' | 'error' = 'loading';
|
||||||
|
|
||||||
const detectOS = () => {
|
const detectOS = () => {
|
||||||
const ua = window.navigator.userAgent.toLowerCase();
|
const ua = window.navigator.userAgent.toLowerCase();
|
||||||
|
|
@ -185,6 +186,36 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getReadableAssetName = (name: string, osType: string) => {
|
||||||
|
const lowerName = name.toLowerCase();
|
||||||
|
if (osType === 'Windows') {
|
||||||
|
if (lowerName.endsWith('.exe')) return 'Windows Setup (.exe)';
|
||||||
|
if (lowerName.endsWith('.msi')) return 'Windows Installer (.msi)';
|
||||||
|
}
|
||||||
|
if (osType === 'macOS') {
|
||||||
|
if (lowerName.includes('aarch64') || lowerName.includes('arm64')) {
|
||||||
|
return 'macOS Apple Silicon';
|
||||||
|
}
|
||||||
|
return 'macOS Intel';
|
||||||
|
}
|
||||||
|
if (osType === 'Linux') {
|
||||||
|
if (lowerName.endsWith('.flatpak')) return 'Flatpak';
|
||||||
|
if (lowerName.endsWith('.deb')) return 'Debian/Ubuntu (.deb)';
|
||||||
|
if (lowerName.endsWith('.rpm')) return 'RedHat/Fedora (.rpm)';
|
||||||
|
if (lowerName.endsWith('.appimage')) return 'AppImage';
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatBytes = (bytes: number) => {
|
||||||
|
if (!bytes || bytes === 0) return 'Size Unknown';
|
||||||
|
const k = 1024;
|
||||||
|
const dm = 1;
|
||||||
|
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
|
||||||
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||||
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
||||||
|
};
|
||||||
|
|
||||||
const openDownloadModal = (osType: string) => {
|
const openDownloadModal = (osType: string) => {
|
||||||
if (!modal || !modalOptions || !modalTitle) return;
|
if (!modal || !modalOptions || !modalTitle) return;
|
||||||
currentOSType = osType;
|
currentOSType = osType;
|
||||||
|
|
@ -203,7 +234,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
filteredAssets = assets.filter(a => a.name.endsWith('.dmg'));
|
filteredAssets = assets.filter(a => a.name.endsWith('.dmg'));
|
||||||
title = `Emerald Legacy for macOS ${isNightly ? '(Nightly)' : ''}`;
|
title = `Emerald Legacy for macOS ${isNightly ? '(Nightly)' : ''}`;
|
||||||
} else if (osType === 'Linux') {
|
} else if (osType === 'Linux') {
|
||||||
filteredAssets = assets.filter(a => a.name.endsWith('.flatpak') || a.name.endsWith('.deb') || a.name.endsWith('.rpm'));
|
filteredAssets = assets.filter(a => a.name.endsWith('.flatpak') || a.name.endsWith('.deb') || a.name.endsWith('.rpm') || a.name.endsWith('.AppImage'));
|
||||||
title = `Emerald Legacy for Linux ${isNightly ? '(Nightly)' : ''}`;
|
title = `Emerald Legacy for Linux ${isNightly ? '(Nightly)' : ''}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -211,17 +242,46 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
const recommended = getRecommendedAsset(osType, arch, filteredAssets);
|
const recommended = getRecommendedAsset(osType, arch, filteredAssets);
|
||||||
|
|
||||||
modalTitle.innerText = title;
|
modalTitle.innerText = title;
|
||||||
modalOptions.innerHTML = filteredAssets.length > 0 ? filteredAssets.map(asset => {
|
|
||||||
const isRecommended = asset.name === recommended?.name;
|
if (filteredAssets.length > 0) {
|
||||||
return `
|
modalOptions.innerHTML = filteredAssets.map(asset => {
|
||||||
<div class="modal-btn-container">
|
const isRecommended = asset.name === recommended?.name;
|
||||||
<a href="${asset.browser_download_url}" class="main-btn" onclick="window.playAudioSFX('levelup.ogg')">
|
const readableName = getReadableAssetName(asset.name, osType);
|
||||||
<span>${asset.name.split('_').pop()?.split('-').pop() || asset.name}</span>
|
const readableSize = formatBytes(asset.size);
|
||||||
</a>
|
return `
|
||||||
${isRecommended ? '<span class="splash-text">Recommended!</span>' : ''}
|
<div class="modal-btn-container">
|
||||||
</div>
|
<a href="${asset.browser_download_url}" class="main-btn" onclick="window.playAudioSFX('levelup.ogg')">
|
||||||
`;
|
<span>${readableName} <small style="opacity: 0.7; font-size: 0.8rem; margin-left: 8px;">(${readableSize})</small></span>
|
||||||
}).join('') : `<div style="color: grey; font-size: 1.2rem; padding: 20px;">No builds found for this platform.</div>`;
|
</a>
|
||||||
|
${isRecommended ? '<span class="splash-text">Recommended!</span>' : ''}
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}).join('');
|
||||||
|
} else {
|
||||||
|
if (fetchStatus === 'loading') {
|
||||||
|
modalOptions.innerHTML = `<div style="color: #ccc; font-size: 1.2rem; padding: 20px; text-align: center;"><i class="fas fa-spinner fa-spin" style="margin-right: 8px;"></i>Loading download links...</div>`;
|
||||||
|
} else if (fetchStatus === 'error') {
|
||||||
|
modalOptions.innerHTML = `
|
||||||
|
<div style="color: #ff8888; font-size: 1.1rem; padding: 20px; text-align: center; font-family: var(--font-pixel);">
|
||||||
|
<p style="margin-bottom: 15px;">Failed to retrieve download links automatically.</p>
|
||||||
|
<a href="https://github.com/${repo}/releases" target="_blank" class="main-btn" style="display: inline-flex; justify-content: center; align-items: center; text-decoration: none; max-width: 320px; margin: 0 auto;">
|
||||||
|
VIEW RELEASES ON GITHUB
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
} else {
|
||||||
|
if (isNightly) {
|
||||||
|
modalOptions.innerHTML = `
|
||||||
|
<div style="color: #ccc; font-size: 1.1rem; padding: 20px; text-align: center;">
|
||||||
|
<p>No nightly builds are currently available.</p>
|
||||||
|
<p style="font-size: 0.9rem; margin-top: 10px; opacity: 0.8;">Please toggle Nightly off to download stable versions.</p>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
} else {
|
||||||
|
modalOptions.innerHTML = `<div style="color: #ccc; font-size: 1.2rem; padding: 20px; text-align: center;">No builds found for this platform.</div>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
modal.classList.add('active');
|
modal.classList.add('active');
|
||||||
};
|
};
|
||||||
|
|
@ -235,45 +295,52 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
(window as any).playAudioSFX = (file: string) => audio.playSFX(file);
|
(window as any).playAudioSFX = (file: string) => audio.playSFX(file);
|
||||||
|
|
||||||
const updateDownloadButtons = async () => {
|
const updateDownloadButtons = async () => {
|
||||||
|
fetchStatus = 'loading';
|
||||||
try {
|
try {
|
||||||
const [latestRes, nightlyRes] = await Promise.all([
|
const [latestRes, nightlyRes] = await Promise.allSettled([
|
||||||
fetch(`https://api.github.com/repos/${repo}/releases/latest`),
|
fetch(`https://api.github.com/repos/${repo}/releases/latest`),
|
||||||
fetch(`https://api.github.com/repos/${repo}/releases/tags/nightly`)
|
fetch(`https://api.github.com/repos/${repo}/releases/tags/nightly`)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const [latestData, nightlyData] = await Promise.all([
|
if (latestRes.status === 'fulfilled' && latestRes.value.ok) {
|
||||||
latestRes.json(),
|
const latestData = await latestRes.value.json();
|
||||||
nightlyRes.json()
|
latestAssets = latestData.assets || [];
|
||||||
]);
|
fetchStatus = 'success';
|
||||||
|
} else {
|
||||||
latestAssets = latestData.assets || [];
|
fetchStatus = 'error';
|
||||||
nightlyAssets = nightlyData.assets || [];
|
|
||||||
|
|
||||||
const { os } = detectOS();
|
|
||||||
|
|
||||||
const mainBtn = document.getElementById('main-download-btn');
|
|
||||||
if (mainBtn) {
|
|
||||||
mainBtn.addEventListener('click', (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
openDownloadModal(os === 'Unknown' ? 'Windows' : os);
|
|
||||||
});
|
|
||||||
const span = mainBtn.querySelector('span');
|
|
||||||
if (span) span.innerText = `Download for ${os === 'Unknown' ? 'Your OS' : os}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const winBtn = document.getElementById('download-win');
|
if (nightlyRes.status === 'fulfilled' && nightlyRes.value.ok) {
|
||||||
const linuxBtn = document.getElementById('download-linux');
|
const nightlyData = await nightlyRes.value.json();
|
||||||
const macBtn = document.getElementById('download-macos');
|
nightlyAssets = nightlyData.assets || [];
|
||||||
|
} else {
|
||||||
winBtn?.addEventListener('click', (e) => { e.preventDefault(); openDownloadModal('Windows'); });
|
nightlyAssets = [];
|
||||||
linuxBtn?.addEventListener('click', (e) => { e.preventDefault(); openDownloadModal('Linux'); });
|
}
|
||||||
macBtn?.addEventListener('click', (e) => { e.preventDefault(); openDownloadModal('macOS'); });
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching releases:', error);
|
console.error('Error fetching releases:', error);
|
||||||
|
fetchStatus = 'error';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const winBtn = document.getElementById('download-win');
|
||||||
|
const linuxBtn = document.getElementById('download-linux');
|
||||||
|
const macBtn = document.getElementById('download-macos');
|
||||||
|
|
||||||
|
winBtn?.addEventListener('click', (e) => { e.preventDefault(); openDownloadModal('Windows'); });
|
||||||
|
linuxBtn?.addEventListener('click', (e) => { e.preventDefault(); openDownloadModal('Linux'); });
|
||||||
|
macBtn?.addEventListener('click', (e) => { e.preventDefault(); openDownloadModal('macOS'); });
|
||||||
|
|
||||||
|
const { os } = detectOS();
|
||||||
|
const mainBtn = document.getElementById('main-download-btn');
|
||||||
|
if (mainBtn) {
|
||||||
|
mainBtn.addEventListener('click', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
openDownloadModal(os === 'Unknown' ? 'Windows' : os);
|
||||||
|
});
|
||||||
|
const span = mainBtn.querySelector('span');
|
||||||
|
if (span) span.innerText = `Download for ${os === 'Unknown' ? 'Your OS' : os}`;
|
||||||
|
}
|
||||||
|
|
||||||
closeModal?.addEventListener('click', () => {
|
closeModal?.addEventListener('click', () => {
|
||||||
audio.playSFX('back.ogg');
|
audio.playSFX('back.ogg');
|
||||||
modal?.classList.remove('active');
|
modal?.classList.remove('active');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue