mirror of
https://github.com/zen-browser/www.git
synced 2025-07-08 01:10:02 +02:00
fix(download): hide flathub download for twilight download page
This commit is contained in:
parent
6730aa0a39
commit
fe71ede8c5
2 changed files with 19 additions and 19 deletions
|
@ -26,32 +26,32 @@
|
|||
// Function to select a platform
|
||||
async function selectPlatform(platform: string) {
|
||||
// Update button styling
|
||||
platformButtons.forEach((button) => {
|
||||
for (const button of platformButtons) {
|
||||
const buttonPlatform = button.getAttribute('data-platform')
|
||||
if (buttonPlatform === platform) {
|
||||
button.setAttribute('data-active', 'true')
|
||||
} else {
|
||||
button.setAttribute('data-active', 'false')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Show/hide platform sections
|
||||
platformSections.forEach((section) => {
|
||||
for (const section of platformSections) {
|
||||
if (section.id === `${platform}-downloads`) {
|
||||
section.setAttribute('data-active', 'true')
|
||||
} else {
|
||||
section.setAttribute('data-active', 'false')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Handle platform button clicks
|
||||
platformButtons.forEach((button) => {
|
||||
for (const button of platformButtons) {
|
||||
button.addEventListener('click', () => {
|
||||
const platform = button.getAttribute('data-platform') ?? ''
|
||||
selectPlatform(platform)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// Check for twilight mode
|
||||
async function checkTwilightMode() {
|
||||
|
@ -70,21 +70,21 @@
|
|||
}
|
||||
|
||||
const tags = document.querySelectorAll('.release-type-tag')
|
||||
tags.forEach((tag) => {
|
||||
for (const tag of tags) {
|
||||
tag.innerHTML = tag.innerHTML.replace('Beta', 'Twilight')
|
||||
})
|
||||
}
|
||||
|
||||
// Apply twilight mode to all relevant elements
|
||||
const coralElements = document.querySelectorAll(
|
||||
'.download-browser-logo, .release-type-tag, .decorative-gradient, .download-link, .download-arrow-icon, .download-card__icon, .checksum-icon-btn, .copy-btn',
|
||||
'.download-browser-logo, .release-type-tag, .decorative-gradient, .download-link, .download-arrow-icon, .download-card__icon, .checksum-icon-btn, .copy-btn, .flathub-download',
|
||||
)
|
||||
coralElements.forEach((element) => {
|
||||
for (const element of coralElements) {
|
||||
element.setAttribute('data-twilight', 'true')
|
||||
})
|
||||
}
|
||||
|
||||
// Replace all download links with twilight versions
|
||||
const downloadLinks = document.querySelectorAll('a.download-link')
|
||||
downloadLinks.forEach((link) => {
|
||||
for (const link of downloadLinks) {
|
||||
if (!link.id.includes('beta')) {
|
||||
const href = link.getAttribute('href')
|
||||
if (href && href.includes('/latest/download/')) {
|
||||
|
@ -95,7 +95,7 @@
|
|||
link.setAttribute('href', twilightHref)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ function isFlatReleaseInfo(obj: unknown): obj is ReleaseInfo {
|
|||
platform === "linux" ? (
|
||||
<>
|
||||
{releases.flathub && releases.flathub.all.label && (
|
||||
<div>
|
||||
<article class="flathub-download data-[twilight='true']:hidden">
|
||||
<h4 class="mb-3 text-lg font-medium">Package Managers</h4>
|
||||
<div class="space-y-3">
|
||||
<DownloadCard
|
||||
|
@ -68,13 +68,13 @@ function isFlatReleaseInfo(obj: unknown): obj is ReleaseInfo {
|
|||
variant="flathub"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
)}
|
||||
{releases.x86_64 &&
|
||||
typeof releases.x86_64 === "object" &&
|
||||
"tarball" in releases.x86_64 &&
|
||||
(releases.x86_64.tarball) && (
|
||||
<div>
|
||||
<article>
|
||||
<h4 class="mb-3 text-lg font-medium">x86_64</h4>
|
||||
<div class="">
|
||||
{releases.x86_64.tarball && (
|
||||
|
@ -94,13 +94,13 @@ function isFlatReleaseInfo(obj: unknown): obj is ReleaseInfo {
|
|||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
)}
|
||||
{releases.aarch64 &&
|
||||
typeof releases.aarch64 === "object" &&
|
||||
"tarball" in releases.aarch64 &&
|
||||
(releases.aarch64.tarball) && (
|
||||
<div>
|
||||
<article>
|
||||
<h4 class="mb-3 text-lg font-medium">ARM64</h4>
|
||||
<div class="gap-3">
|
||||
{releases.aarch64.tarball && (
|
||||
|
@ -120,7 +120,7 @@ function isFlatReleaseInfo(obj: unknown): obj is ReleaseInfo {
|
|||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue