mirror of
				https://github.com/Frooodle/Stirling-PDF.git
				synced 2025-11-01 01:21:18 +01:00 
			
		
		
		
	Fix showupdate (#3032)
# Description of Changes Please provide a summary of the changes, including:  --- ## 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.
This commit is contained in:
		
							parent
							
								
									f5ca02df1d
								
							
						
					
					
						commit
						f23a2d508f
					
				@ -57,13 +57,17 @@ async function checkForUpdate() {
 | 
				
			|||||||
  // Initialize the update button as hidden
 | 
					  // Initialize the update button as hidden
 | 
				
			||||||
  var updateBtn = document.getElementById("update-btn") || null;
 | 
					  var updateBtn = document.getElementById("update-btn") || null;
 | 
				
			||||||
  var updateLink = document.getElementById("update-link") || null;
 | 
					  var updateLink = document.getElementById("update-link") || null;
 | 
				
			||||||
 | 
					  var updateLinkLegacy = document.getElementById("update-link-legacy") || null;
 | 
				
			||||||
  if (updateBtn !== null) {
 | 
					  if (updateBtn !== null) {
 | 
				
			||||||
    updateBtn.style.display = "none";
 | 
					    updateBtn.style.display = "none";
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (updateLink !== null) {
 | 
					  if (updateLink !== null) {
 | 
				
			||||||
 | 
					    updateLink.style.display = "none";
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  if (updateLinkLegacy !== null) {
 | 
				
			||||||
    console.log("hidden!");
 | 
					    console.log("hidden!");
 | 
				
			||||||
    if (!updateLink.classList.contains("visually-hidden")) {
 | 
					    if (!updateLinkLegacy.classList.contains("visually-hidden")) {
 | 
				
			||||||
      updateLink.classList.add("visually-hidden");
 | 
					      updateLinkLegacy.classList.add("visually-hidden");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -76,16 +80,19 @@ async function checkForUpdate() {
 | 
				
			|||||||
      document.getElementById("update-btn").style.display = "block";
 | 
					      document.getElementById("update-btn").style.display = "block";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (updateLink !== null) {
 | 
					    if (updateLink !== null) {
 | 
				
			||||||
 | 
					      document.getElementById("update-link").style.display = "flex";
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (updateLinkLegacy !== null) {
 | 
				
			||||||
      document.getElementById("app-update").innerHTML = updateAvailable.replace("{0}", '<b>' + currentVersion + '</b>').replace("{1}", '<b>' + latestVersion + '</b>');
 | 
					      document.getElementById("app-update").innerHTML = updateAvailable.replace("{0}", '<b>' + currentVersion + '</b>').replace("{1}", '<b>' + latestVersion + '</b>');
 | 
				
			||||||
      if (updateLink.classList.contains("visually-hidden")) {
 | 
					      if (updateLinkLegacy.classList.contains("visually-hidden")) {
 | 
				
			||||||
        updateLink.classList.remove("visually-hidden");
 | 
					        updateLinkLegacy.classList.remove("visually-hidden");
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    console.log("visible");
 | 
					    console.log("visible");
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    if (updateLink !== null) {
 | 
					    if (updateLinkLegacy !== null) {
 | 
				
			||||||
      if (!updateLink.classList.contains("visually-hidden")) {
 | 
					      if (!updateLinkLegacy.classList.contains("visually-hidden")) {
 | 
				
			||||||
        updateLink.classList.add("visually-hidden");
 | 
					        updateLinkLegacy.classList.add("visually-hidden");
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    console.log("hidden");
 | 
					    console.log("hidden");
 | 
				
			||||||
 | 
				
			|||||||
@ -73,12 +73,6 @@ function reorderCards(container) {
 | 
				
			|||||||
  cards.sort(function (a, b) {
 | 
					  cards.sort(function (a, b) {
 | 
				
			||||||
    var aIsFavorite = localStorage.getItem(a.id) === 'favorite';
 | 
					    var aIsFavorite = localStorage.getItem(a.id) === 'favorite';
 | 
				
			||||||
    var bIsFavorite = localStorage.getItem(b.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) {
 | 
					    if (aIsFavorite && !bIsFavorite) {
 | 
				
			||||||
      return -1;
 | 
					      return -1;
 | 
				
			||||||
 | 
				
			|||||||
@ -55,8 +55,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        <div class="features-container">
 | 
					        <div class="features-container">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          <div th:if="${@shouldShow}" class="feature-card favorite update-notice" id="update-link"
 | 
					          <div th:if="${@shouldShow}" class="feature-card favorite update-notice visually-hidden" id="update-link-legacy">
 | 
				
			||||||
            style="display: none;">
 | 
					 | 
				
			||||||
            <a href="https://github.com/Stirling-Tools/Stirling-PDF/releases" target="_blank" rel="noopener">
 | 
					            <a href="https://github.com/Stirling-Tools/Stirling-PDF/releases" target="_blank" rel="noopener">
 | 
				
			||||||
              <div class="d-flex align-items-center">
 | 
					              <div class="d-flex align-items-center">
 | 
				
			||||||
                <div id="tool-icon" class="advance" alt="icon">
 | 
					                <div id="tool-icon" class="advance" alt="icon">
 | 
				
			||||||
 | 
				
			|||||||
@ -26,14 +26,16 @@
 | 
				
			|||||||
          <div style="justify-content: center; display: flex;">
 | 
					          <div style="justify-content: center; display: flex;">
 | 
				
			||||||
            <div style="margin:0 3rem">
 | 
					            <div style="margin:0 3rem">
 | 
				
			||||||
              <div>
 | 
					              <div>
 | 
				
			||||||
                <div style="display:flex; flex-direction: column; justify-content: center; width:100%; margin-bottom:1rem">
 | 
					                <div
 | 
				
			||||||
 | 
					                  style="display:flex; flex-direction: column; justify-content: center; width:100%; margin-bottom:1rem">
 | 
				
			||||||
                  <div style="width:fit-content; margin: 0 auto; padding: 0 3rem">
 | 
					                  <div style="width:fit-content; margin: 0 auto; padding: 0 3rem">
 | 
				
			||||||
                    <p class="lead fs-4"
 | 
					                    <p class="lead fs-4"
 | 
				
			||||||
                      th:text="${@homeText != 'null' and @homeText != null and @homeText != ''} ? ${@homeText} : #{home.desc}">
 | 
					                      th:text="${@homeText != 'null' and @homeText != null and @homeText != ''} ? ${@homeText} : #{home.desc}">
 | 
				
			||||||
                    </p>
 | 
					                    </p>
 | 
				
			||||||
                  </div>
 | 
					                  </div>
 | 
				
			||||||
                  <div id="groupRecent" style="width: fit-content; margin: 0 auto">
 | 
					                  <div id="groupRecent" style="width: fit-content; margin: 0 auto">
 | 
				
			||||||
                    <div th:replace="~{fragments/featureGroupHeader :: featureGroupHeader(groupTitle=#{navbar.recent})}">
 | 
					                    <div
 | 
				
			||||||
 | 
					                      th:replace="~{fragments/featureGroupHeader :: featureGroupHeader(groupTitle=#{navbar.recent})}">
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                    <div class="recent-features">
 | 
					                    <div class="recent-features">
 | 
				
			||||||
                      <div class="newfeature"
 | 
					                      <div class="newfeature"
 | 
				
			||||||
@ -57,17 +59,19 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
              <div style="display: flex; column-gap: 3rem; flex-wrap: wrap; margin-left:1rem">
 | 
					              <div style="display: flex; column-gap: 3rem; flex-wrap: wrap; margin-left:1rem">
 | 
				
			||||||
                <div
 | 
					                <div
 | 
				
			||||||
                style="height:2.5rem;  display: flex; align-items: center; cursor: pointer; justify-content: center;">
 | 
					                  style="height:2.5rem;  display: flex; align-items: center; cursor: pointer; justify-content: center;">
 | 
				
			||||||
                <label for="sort-options" th:text="#{home.sortBy}">Sort by:</label>
 | 
					                  <label for="sort-options" th:text="#{home.sortBy}">Sort by:</label>
 | 
				
			||||||
                <select id="sort-options" style="border:none;">
 | 
					                  <select id="sort-options" style="border:none;">
 | 
				
			||||||
                  <option value="alphabetical" th:text="#{home.alphabetical}"> </option>
 | 
					                    <option value="alphabetical" th:text="#{home.alphabetical}"> </option>
 | 
				
			||||||
                  <!-- <option value="personal">Your most used</option> -->
 | 
					                    <!-- <option value="personal">Your most used</option> -->
 | 
				
			||||||
                  <option value="global" th:text="#{home.globalPopularity}"></option>
 | 
					                    <option value="global" th:text="#{home.globalPopularity}"></option>
 | 
				
			||||||
                  <!-- <option value="server">Popularity in organisation</option> -->
 | 
					                    <!-- <option value="server">Popularity in organisation</option> -->
 | 
				
			||||||
                </select>
 | 
					                  </select>
 | 
				
			||||||
              </div>
 | 
					                </div>
 | 
				
			||||||
                <div style="display: flex; align-items: center; flex-wrap: wrap; align-content: flex-start; width: fit-content; max-width: 100%; gap:2rem;  justify-content: center;">
 | 
					                <div
 | 
				
			||||||
                <div th:title="#{home.setFavorites}" style="display: flex; align-items: center; cursor: pointer;" onclick="toggleFavoritesMode()">
 | 
					                  style="display: flex; align-items: center; flex-wrap: wrap; align-content: flex-start; width: fit-content; max-width: 100%; gap:2rem;  justify-content: center;">
 | 
				
			||||||
 | 
					                  <div th:title="#{home.setFavorites}" style="display: flex; align-items: center; cursor: pointer;"
 | 
				
			||||||
 | 
					                    onclick="toggleFavoritesMode()">
 | 
				
			||||||
                    <span class="material-symbols-rounded toggle-favourites"
 | 
					                    <span class="material-symbols-rounded toggle-favourites"
 | 
				
			||||||
                      style="font-size: 2rem;  margin-left: 0.2rem;">
 | 
					                      style="font-size: 2rem;  margin-left: 0.2rem;">
 | 
				
			||||||
                      star
 | 
					                      star
 | 
				
			||||||
@ -82,13 +86,19 @@
 | 
				
			|||||||
                  </div>
 | 
					                  </div>
 | 
				
			||||||
                  <a href="home" onclick="setAsDefault('home-legacy')" th:title="#{home.legacyHomepage}"
 | 
					                  <a href="home" onclick="setAsDefault('home-legacy')" th:title="#{home.legacyHomepage}"
 | 
				
			||||||
                    style="text-decoration: none; color: inherit; cursor: pointer; display: flex; align-items: center;">
 | 
					                    style="text-decoration: none; color: inherit; cursor: pointer; display: flex; align-items: center;">
 | 
				
			||||||
                    </span>
 | 
					 | 
				
			||||||
                    <span class="material-symbols-rounded toggle-favourites"
 | 
					                    <span class="material-symbols-rounded toggle-favourites"
 | 
				
			||||||
                      style="font-size: 2rem; margin-left: 0.2rem;">
 | 
					                      style="font-size: 2rem; margin-left: 0.2rem;">
 | 
				
			||||||
                      home
 | 
					                      home
 | 
				
			||||||
                    </span>
 | 
					                    </span>
 | 
				
			||||||
                  </a>
 | 
					                  </a>
 | 
				
			||||||
 | 
					                  <a th:if="${@shouldShow}" href="https://github.com/Stirling-Tools/Stirling-PDF/releases"
 | 
				
			||||||
 | 
					                    target="_blank" id="update-link" rel="noopener" th:title="#{settings.update}"
 | 
				
			||||||
 | 
					                    style="text-decoration: none; color: inherit; cursor: pointer; display: flex; align-items: center;">
 | 
				
			||||||
 | 
					                    <span class="material-symbols-rounded toggle-favourites"
 | 
				
			||||||
 | 
					                      style="font-size: 2rem; margin-left: 0.2rem;">
 | 
				
			||||||
 | 
					                      update
 | 
				
			||||||
 | 
					                    </span>
 | 
				
			||||||
 | 
					                  </a>
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              </div>
 | 
					              </div>
 | 
				
			||||||
@ -102,20 +112,6 @@
 | 
				
			|||||||
        border-color: var(--md-nav-color-on-seperator);
 | 
					        border-color: var(--md-nav-color-on-seperator);
 | 
				
			||||||
        margin-top: 1rem;
 | 
					        margin-top: 1rem;
 | 
				
			||||||
      ">
 | 
					      ">
 | 
				
			||||||
          <div th:if="${@shouldShow}" class="feature-card favorite update-notice" id="update-link"
 | 
					 | 
				
			||||||
            style="display: none;">
 | 
					 | 
				
			||||||
            <a href="https://github.com/Stirling-Tools/Stirling-PDF/releases" target="_blank" rel="noopener">
 | 
					 | 
				
			||||||
              <div class="d-flex align-items-center">
 | 
					 | 
				
			||||||
                <div id="tool-icon" class="advance" alt="icon">
 | 
					 | 
				
			||||||
                  <span class="material-symbols-rounded nav-icon">update</span>
 | 
					 | 
				
			||||||
                </div>
 | 
					 | 
				
			||||||
                <div id="tool-text">
 | 
					 | 
				
			||||||
                  <h5 class="card-title" th:text="#{settings.update}"></h5>
 | 
					 | 
				
			||||||
                  <p class="card-text" id="app-update"></p>
 | 
					 | 
				
			||||||
                </div>
 | 
					 | 
				
			||||||
              </div>
 | 
					 | 
				
			||||||
            </a>
 | 
					 | 
				
			||||||
          </div>
 | 
					 | 
				
			||||||
          <div class="feature-rows">
 | 
					          <div class="feature-rows">
 | 
				
			||||||
            <div id="groupFavorites" class="feature-group">
 | 
					            <div id="groupFavorites" class="feature-group">
 | 
				
			||||||
              <div th:replace="~{fragments/featureGroupHeader :: featureGroupHeader(groupTitle=#{navbar.favorite})}">
 | 
					              <div th:replace="~{fragments/featureGroupHeader :: featureGroupHeader(groupTitle=#{navbar.favorite})}">
 | 
				
			||||||
@ -223,4 +219,4 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
</body>
 | 
					</body>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user