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
|
// Function to select a platform
|
||||||
async function selectPlatform(platform: string) {
|
async function selectPlatform(platform: string) {
|
||||||
// Update button styling
|
// Update button styling
|
||||||
platformButtons.forEach((button) => {
|
for (const button of platformButtons) {
|
||||||
const buttonPlatform = button.getAttribute('data-platform')
|
const buttonPlatform = button.getAttribute('data-platform')
|
||||||
if (buttonPlatform === platform) {
|
if (buttonPlatform === platform) {
|
||||||
button.setAttribute('data-active', 'true')
|
button.setAttribute('data-active', 'true')
|
||||||
} else {
|
} else {
|
||||||
button.setAttribute('data-active', 'false')
|
button.setAttribute('data-active', 'false')
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
// Show/hide platform sections
|
// Show/hide platform sections
|
||||||
platformSections.forEach((section) => {
|
for (const section of platformSections) {
|
||||||
if (section.id === `${platform}-downloads`) {
|
if (section.id === `${platform}-downloads`) {
|
||||||
section.setAttribute('data-active', 'true')
|
section.setAttribute('data-active', 'true')
|
||||||
} else {
|
} else {
|
||||||
section.setAttribute('data-active', 'false')
|
section.setAttribute('data-active', 'false')
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle platform button clicks
|
// Handle platform button clicks
|
||||||
platformButtons.forEach((button) => {
|
for (const button of platformButtons) {
|
||||||
button.addEventListener('click', () => {
|
button.addEventListener('click', () => {
|
||||||
const platform = button.getAttribute('data-platform') ?? ''
|
const platform = button.getAttribute('data-platform') ?? ''
|
||||||
selectPlatform(platform)
|
selectPlatform(platform)
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
|
|
||||||
// Check for twilight mode
|
// Check for twilight mode
|
||||||
async function checkTwilightMode() {
|
async function checkTwilightMode() {
|
||||||
|
@ -70,21 +70,21 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const tags = document.querySelectorAll('.release-type-tag')
|
const tags = document.querySelectorAll('.release-type-tag')
|
||||||
tags.forEach((tag) => {
|
for (const tag of tags) {
|
||||||
tag.innerHTML = tag.innerHTML.replace('Beta', 'Twilight')
|
tag.innerHTML = tag.innerHTML.replace('Beta', 'Twilight')
|
||||||
})
|
}
|
||||||
|
|
||||||
// Apply twilight mode to all relevant elements
|
// Apply twilight mode to all relevant elements
|
||||||
const coralElements = document.querySelectorAll(
|
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')
|
element.setAttribute('data-twilight', 'true')
|
||||||
})
|
}
|
||||||
|
|
||||||
// Replace all download links with twilight versions
|
// Replace all download links with twilight versions
|
||||||
const downloadLinks = document.querySelectorAll('a.download-link')
|
const downloadLinks = document.querySelectorAll('a.download-link')
|
||||||
downloadLinks.forEach((link) => {
|
for (const link of downloadLinks) {
|
||||||
if (!link.id.includes('beta')) {
|
if (!link.id.includes('beta')) {
|
||||||
const href = link.getAttribute('href')
|
const href = link.getAttribute('href')
|
||||||
if (href && href.includes('/latest/download/')) {
|
if (href && href.includes('/latest/download/')) {
|
||||||
|
@ -95,7 +95,7 @@
|
||||||
link.setAttribute('href', twilightHref)
|
link.setAttribute('href', twilightHref)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ function isFlatReleaseInfo(obj: unknown): obj is ReleaseInfo {
|
||||||
platform === "linux" ? (
|
platform === "linux" ? (
|
||||||
<>
|
<>
|
||||||
{releases.flathub && releases.flathub.all.label && (
|
{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>
|
<h4 class="mb-3 text-lg font-medium">Package Managers</h4>
|
||||||
<div class="space-y-3">
|
<div class="space-y-3">
|
||||||
<DownloadCard
|
<DownloadCard
|
||||||
|
@ -68,13 +68,13 @@ function isFlatReleaseInfo(obj: unknown): obj is ReleaseInfo {
|
||||||
variant="flathub"
|
variant="flathub"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</article>
|
||||||
)}
|
)}
|
||||||
{releases.x86_64 &&
|
{releases.x86_64 &&
|
||||||
typeof releases.x86_64 === "object" &&
|
typeof releases.x86_64 === "object" &&
|
||||||
"tarball" in releases.x86_64 &&
|
"tarball" in releases.x86_64 &&
|
||||||
(releases.x86_64.tarball) && (
|
(releases.x86_64.tarball) && (
|
||||||
<div>
|
<article>
|
||||||
<h4 class="mb-3 text-lg font-medium">x86_64</h4>
|
<h4 class="mb-3 text-lg font-medium">x86_64</h4>
|
||||||
<div class="">
|
<div class="">
|
||||||
{releases.x86_64.tarball && (
|
{releases.x86_64.tarball && (
|
||||||
|
@ -94,13 +94,13 @@ function isFlatReleaseInfo(obj: unknown): obj is ReleaseInfo {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</article>
|
||||||
)}
|
)}
|
||||||
{releases.aarch64 &&
|
{releases.aarch64 &&
|
||||||
typeof releases.aarch64 === "object" &&
|
typeof releases.aarch64 === "object" &&
|
||||||
"tarball" in releases.aarch64 &&
|
"tarball" in releases.aarch64 &&
|
||||||
(releases.aarch64.tarball) && (
|
(releases.aarch64.tarball) && (
|
||||||
<div>
|
<article>
|
||||||
<h4 class="mb-3 text-lg font-medium">ARM64</h4>
|
<h4 class="mb-3 text-lg font-medium">ARM64</h4>
|
||||||
<div class="gap-3">
|
<div class="gap-3">
|
||||||
{releases.aarch64.tarball && (
|
{releases.aarch64.tarball && (
|
||||||
|
@ -120,7 +120,7 @@ function isFlatReleaseInfo(obj: unknown): obj is ReleaseInfo {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</article>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue