From f23a2d508f02c3dd9cf705e63d9672d18793df81 Mon Sep 17 00:00:00 2001 From: Ludy Date: Sun, 23 Feb 2025 17:19:30 +0100 Subject: [PATCH] Fix showupdate (#3032) # Description of Changes Please provide a summary of the changes, including: ![image](https://github.com/user-attachments/assets/1cfda2a0-32a3-4404-90cf-d0a4b77b65a7) --- ## Checklist ### General - [x] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [x] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md) (if applicable) - [ ] I have performed a self-review of my own code - [x] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### UI Changes (if applicable) - [x] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing) for more details. --- src/main/resources/static/js/githubVersion.js | 21 ++++--- src/main/resources/static/js/homecard.js | 6 -- src/main/resources/templates/home-legacy.html | 3 +- src/main/resources/templates/home.html | 56 +++++++++---------- 4 files changed, 41 insertions(+), 45 deletions(-) diff --git a/src/main/resources/static/js/githubVersion.js b/src/main/resources/static/js/githubVersion.js index eebb0ae88..2aef90d8c 100644 --- a/src/main/resources/static/js/githubVersion.js +++ b/src/main/resources/static/js/githubVersion.js @@ -57,13 +57,17 @@ async function checkForUpdate() { // Initialize the update button as hidden var updateBtn = document.getElementById("update-btn") || null; var updateLink = document.getElementById("update-link") || null; + var updateLinkLegacy = document.getElementById("update-link-legacy") || null; if (updateBtn !== null) { updateBtn.style.display = "none"; } if (updateLink !== null) { + updateLink.style.display = "none"; + } + if (updateLinkLegacy !== null) { console.log("hidden!"); - if (!updateLink.classList.contains("visually-hidden")) { - updateLink.classList.add("visually-hidden"); + if (!updateLinkLegacy.classList.contains("visually-hidden")) { + updateLinkLegacy.classList.add("visually-hidden"); } } @@ -76,16 +80,19 @@ async function checkForUpdate() { document.getElementById("update-btn").style.display = "block"; } if (updateLink !== null) { + document.getElementById("update-link").style.display = "flex"; + } + if (updateLinkLegacy !== null) { document.getElementById("app-update").innerHTML = updateAvailable.replace("{0}", '' + currentVersion + '').replace("{1}", '' + latestVersion + ''); - if (updateLink.classList.contains("visually-hidden")) { - updateLink.classList.remove("visually-hidden"); + if (updateLinkLegacy.classList.contains("visually-hidden")) { + updateLinkLegacy.classList.remove("visually-hidden"); } } console.log("visible"); } else { - if (updateLink !== null) { - if (!updateLink.classList.contains("visually-hidden")) { - updateLink.classList.add("visually-hidden"); + if (updateLinkLegacy !== null) { + if (!updateLinkLegacy.classList.contains("visually-hidden")) { + updateLinkLegacy.classList.add("visually-hidden"); } } console.log("hidden"); diff --git a/src/main/resources/static/js/homecard.js b/src/main/resources/static/js/homecard.js index 09d5a8cbd..891706605 100644 --- a/src/main/resources/static/js/homecard.js +++ b/src/main/resources/static/js/homecard.js @@ -73,12 +73,6 @@ function reorderCards(container) { cards.sort(function (a, b) { var aIsFavorite = localStorage.getItem(a.id) === 'favorite'; var bIsFavorite = localStorage.getItem(b.id) === 'favorite'; - if (a.id === 'update-link') { - return -1; - } - if (b.id === 'update-link') { - return 1; - } if (aIsFavorite && !bIsFavorite) { return -1; diff --git a/src/main/resources/templates/home-legacy.html b/src/main/resources/templates/home-legacy.html index e1f2ee364..0d57f8df7 100644 --- a/src/main/resources/templates/home-legacy.html +++ b/src/main/resources/templates/home-legacy.html @@ -55,8 +55,7 @@
-