Skip to content

Commit

Permalink
Show release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
Martchus committed Oct 6, 2024
1 parent ae2fc1e commit 96180e8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
9 changes: 7 additions & 2 deletions css/specifics.css
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ section, .into-text {
animation-duration: 0.5s;
transform: scale(1.5) translate(-2px, 7px) rotate(0.25turn);
}
.downloads-platform p {
.downloads-platform p, #downloads-release-notes {
font-size: 90%;
padding: 5px !important;
border-radius: 5px;
Expand All @@ -168,8 +168,13 @@ section, .into-text {
color: #555;
font-style: italic;
}
#downloads-release-notes span:first-child {
font-size: 80%;
line-height: 220%;
font-variant-caps: small-caps;
}

/* elements of the documentation section */
#doc-section p {
line-height: 140%;
}
}
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ <h2>Downloads</h2>
Checkout the <a href="https://github.com/Martchus/syncthingtray/releases" target="blank">releases section
on GitHub</a> for older releases.
</p>
<p id="downloads-release-notes" style="display: none">
<span>Release notes<br /></span>
</p>
<p>
This page is supposed to provide an overview. Checkout the <a href="https://github.com/Martchus/syncthingtray/blob/master/README.md#download" target="blank">"Downloads"-section</a>
of the README for all options and further details.
Expand Down
11 changes: 11 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ function renderRelease(releaseInfo, otherReleases)
{
const releaseName = releaseInfo.name ?? "unknown";
const releaseDate = releaseInfo.published_at ?? "unknown";
const releaseNotes = releaseInfo.body ?? '';
document.getElementById("downloads-latest-release").innerText = `${releaseName} from ${releaseDate}`;

const assets = Array.isArray(releaseInfo.assets) ? releaseInfo.assets : [];
Expand Down Expand Up @@ -208,6 +209,16 @@ function renderRelease(releaseInfo, otherReleases)

document.getElementById('downloads-loading').style.display = 'none';
document.getElementById('downloads-release-info').style.display = 'block';

if (releaseNotes.length > 10) {
const releaseNotesElement = document.getElementById("downloads-release-notes");
let formatted = releaseNotes;
formatted = formatted.replaceAll(/\*\*([^\*]*)\*\*/gi, '<strong>$1</strong>');
formatted = formatted.replaceAll(/\*([^\*]*)\*/gi, '<em>$1</em>');
formatted = formatted.replaceAll(/\~\~([^\~]*)\~\~/gi, '<del>$1</del>');
releaseNotesElement.insertAdjacentHTML("beforeend", formatted);
releaseNotesElement.style.display = 'block';
}
}

main();

0 comments on commit 96180e8

Please sign in to comment.