From 2c8c400035616acc2de5e55ab556fdf169894a72 Mon Sep 17 00:00:00 2001 From: Jeel Dobariya Date: Wed, 15 Nov 2023 11:10:04 +0530 Subject: [PATCH 1/9] updated download.js todo its work after website loaded --- docs/download.html | 3 +-- docs/scripts/download.js | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/download.html b/docs/download.html index 29b3d9d..c6ffa40 100644 --- a/docs/download.html +++ b/docs/download.html @@ -5,6 +5,7 @@ Smart Manager | Download +
@@ -35,7 +36,5 @@

Download Page Of Smart Manager

Recommendation: We strongly recommend downloading the Python version, especially if you are familiar with Python. This ensures a smoother experience and avoids any false positive warnings. Simply select the "Python" option from the dropdown.

- - diff --git a/docs/scripts/download.js b/docs/scripts/download.js index 8a29deb..adecac4 100644 --- a/docs/scripts/download.js +++ b/docs/scripts/download.js @@ -18,8 +18,6 @@ function is_on_windows() { return platformDropdown.value === 'windows'; } -const downloadButton = document.getElementById('downloadButton'); - async function fetchLatestRelease() { try { const response = await fetch(apiEndpoint); @@ -54,4 +52,7 @@ function getSourceCodeDownloadURL(assets, version) { return path; } -downloadButton.addEventListener('click', fetchLatestRelease); +document.addEventListener("DOMContentLoaded" , function() { + const downloadButton = document.getElementById('downloadButton'); + downloadButton.addEventListener('click', fetchLatestRelease); +}); From 6f7ad7de85046df358eaa3374c9760a856e23557 Mon Sep 17 00:00:00 2001 From: Jeel Dobariya Date: Wed, 15 Nov 2023 11:39:31 +0530 Subject: [PATCH 2/9] add download link for other version --- docs/scripts/otherversion.js | 57 ++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 docs/scripts/otherversion.js diff --git a/docs/scripts/otherversion.js b/docs/scripts/otherversion.js new file mode 100644 index 0000000..897f641 --- /dev/null +++ b/docs/scripts/otherversion.js @@ -0,0 +1,57 @@ +/* */ + +document.addEventListener("DOMContentLoaded", function () { + // Ensure marked.js is loaded + if (typeof marked === 'undefined') { + console.error("marked.js is not loaded"); + return; + } + + fetch("https://api.github.com/repos/JeelDobariya38/Smart-Manager/releases") + .then(response => response.json()) + .then(releases => { + console.log(releases); + + // Find the "Other Releases" container + const otherReleasesContainer = document.querySelector('.other-version'); + console.log(otherReleasesContainer) + + for (var release of releases) { + if (!release.draft) { + var convertedBody = marked(release.body); + var pythondownloadlink = '#'; + var windowsdownloadlink = '#'; + for (var asset of release.assets) { + if (asset.name.endsWith(".zip")) { + if (asset.name.endsWith("python.zip")) { + pythondownloadlink = asset.browser_download_url; + } + if (asset.name.endsWith("windows.zip")) { + windowsdownloadlink = asset.browser_download_url; + } + } + } + var releaseElement = document.createElement('div'); + releaseElement.classList.add('release'); + releaseElement.innerHTML = ` +

${release.name}

+
+
Prerelease: ${release.prerelease}
+
Published At: ${release.published_at}
+
+

${convertedBody}

+ + + `; + otherReleasesContainer.appendChild(releaseElement); + } + } + + // Check if there are no other releases and display an error message + if (otherReleasesContainer.children.length === 0) { + const errorMsg = document.querySelector('.other-version .error-msg'); + errorMsg.style.display = 'block'; + } + }) + .catch(error => console.error("Error fetching latest release:", error)); +}); From 3fd0ce9b480b4155472c052f1c6a1e435d5a71aa Mon Sep 17 00:00:00 2001 From: Jeel Dobariya Date: Wed, 15 Nov 2023 11:39:36 +0530 Subject: [PATCH 3/9] Update download.html --- docs/download.html | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/download.html b/docs/download.html index c6ffa40..f4bf3c5 100644 --- a/docs/download.html +++ b/docs/download.html @@ -6,6 +6,8 @@ Smart Manager | Download + +
@@ -36,5 +38,23 @@

Download Page Of Smart Manager

Recommendation: We strongly recommend downloading the Python version, especially if you are familiar with Python. This ensures a smoother experience and avoids any false positive warnings. Simply select the "Python" option from the dropdown.

+ + +
+
+

Other Releases

+ +
+
From 520e47f8b04d4e155aad53f45ec2f1b142dc3684 Mon Sep 17 00:00:00 2001 From: Jeel Dobariya Date: Wed, 15 Nov 2023 11:58:43 +0530 Subject: [PATCH 4/9] updated styling of download page --- docs/scripts/otherversion.js | 6 +++--- docs/stylesheets/style.css | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/docs/scripts/otherversion.js b/docs/scripts/otherversion.js index 897f641..a3c88bb 100644 --- a/docs/scripts/otherversion.js +++ b/docs/scripts/otherversion.js @@ -39,9 +39,9 @@ document.addEventListener("DOMContentLoaded", function () {
Prerelease: ${release.prerelease}
Published At: ${release.published_at}
-

${convertedBody}

- - +
${convertedBody}
+ + `; otherReleasesContainer.appendChild(releaseElement); } diff --git a/docs/stylesheets/style.css b/docs/stylesheets/style.css index 6ce4a57..436dbf6 100644 --- a/docs/stylesheets/style.css +++ b/docs/stylesheets/style.css @@ -35,6 +35,36 @@ section { background-color: var(--secondary-text-color); } +.release { + color: white; + background-color: #211e1e; + padding: 5px 10px; + border: 6px solid #000; + border-radius: 20px; + margin: 10px 0px; +} + +.release .info { + display: flex; + flex-wrap: wrap; +} + +.release .info div { + margin: 5px; +} + +.release a { + color: rgb(36, 118, 185); + margin: 0px; + text-decoration: dashed; +} + +.downloadbtn { + background-color: rgb(36, 118, 185); + border-radius: 12px; + border: 0px; +} + @media (max-width: 296px) { html, body { width: 296px; From 00bfadebe43cc5567ad5ceb004e20e01cca993bd Mon Sep 17 00:00:00 2001 From: Jeel Dobariya Date: Wed, 15 Nov 2023 12:39:17 +0530 Subject: [PATCH 5/9] updated bit more styling --- docs/download.html | 6 +++--- docs/stylesheets/style.css | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/docs/download.html b/docs/download.html index f4bf3c5..38b5e1e 100644 --- a/docs/download.html +++ b/docs/download.html @@ -19,10 +19,10 @@

Download Page Of Smart Manager

-

Welcome to the download page for Smart Manager. Select your platform and click the button below to download the latest release.

-

For specific release or version, visit your GitHub repository's release page

+

Latest Releases

+

Welcome to the download page for Smart Manager. Select your platform and click the button below to download the latest release.

- +