Skip to content

Commit

Permalink
Change logic for "NEW" badge
Browse files Browse the repository at this point in the history
  • Loading branch information
andbin committed Oct 13, 2024
1 parent 214a58f commit fccbe70
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
8 changes: 4 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<meta http-equiv="last-modified" content="Sun, 13 Oct 2024 15:20:00 GMT+02:00">
<meta http-equiv="last-modified" content="Sun, 13 Oct 2024 16:10:00 GMT+02:00">
<link rel="preconnect" href="https://cdnjs.cloudflare.com">
<title>Java Versions Cheat Sheet</title>
<meta name="author" content="Andrea Binello">
Expand All @@ -20,8 +20,8 @@
<link rel="canonical" href="https://andbin.github.io/java-versions-cheat-sheet/">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.3/css/bootstrap.min.css" integrity="sha512-SbiR/eusphKoMVVXysTKG/7VseWii+Y3FdHrt0EpKgpToZeemhqHeZeLWLhJutz/2ut2Vw1uQEj2MbRF+TVBUA==" crossorigin="anonymous" referrerpolicy="no-referrer">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" integrity="sha512-SnH5WK+bZxgPHs44uWIX+LLJAJ9/2PkPKZ5QiAj6Ta86w+fsb2TkcmfRyVX3pBnMFcV7oQPJkl9QevSCWr3W6A==" crossorigin="anonymous" referrerpolicy="no-referrer">
<link rel="stylesheet" href="fonts/roboto.css?v=2410131520">
<link rel="stylesheet" href="styles.css?v=2410131520">
<link rel="stylesheet" href="fonts/roboto.css?v=2410131610">
<link rel="stylesheet" href="styles.css?v=2410131610">
</head>
<body>
<div class="container">
Expand Down Expand Up @@ -1362,5 +1362,5 @@ <h5 class="card-header">Java 26 / Java SE 26</h5>
</div>
<div class="pt-3 mb-3 border-top border-2 border-secondary-subtle text-center"><a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/"><img decoding="async" loading="lazy" src="images/cc-by-sa.svg" class="jv-cc-banner" alt="Creative Commons Attribution-ShareAlike License" title="Creative Commons Attribution-ShareAlike License"></a></div>
</footer>
</div><button type="button" id="scrolltop" data-bs-placement="left" title="Scroll to top"><i class="fa-solid fa-turn-up" aria-hidden="true"></i></button><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.slim.min.js" integrity="sha512-sNylduh9fqpYUK5OYXWcBleGzbZInWj8yCJAU57r1dpSK9tP2ghf/SRYCMj+KsslFkCOt3TvJrX2AV/Gc3wOqA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.3/js/bootstrap.bundle.min.js" integrity="sha512-i9cEfJwUwViEPFKdC1enz4ZRGBj8YQo6QByFTF92YXHi7waCqyexvRD75S5NVTsSiTv7rKWqG9Y5eFxmRsOn0A==" crossorigin="anonymous" referrerpolicy="no-referrer"></script><script src="script.js?v=2410131520"></script></body>
</div><button type="button" id="scrolltop" data-bs-placement="left" title="Scroll to top"><i class="fa-solid fa-turn-up" aria-hidden="true"></i></button><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.slim.min.js" integrity="sha512-sNylduh9fqpYUK5OYXWcBleGzbZInWj8yCJAU57r1dpSK9tP2ghf/SRYCMj+KsslFkCOt3TvJrX2AV/Gc3wOqA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.3/js/bootstrap.bundle.min.js" integrity="sha512-i9cEfJwUwViEPFKdC1enz4ZRGBj8YQo6QByFTF92YXHi7waCqyexvRD75S5NVTsSiTv7rKWqG9Y5eFxmRsOn0A==" crossorigin="anonymous" referrerpolicy="no-referrer"></script><script src="script.js?v=2410131610"></script></body>
</html>
7 changes: 5 additions & 2 deletions docs/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ $(function() {
$("#jvcstable span.latest-build").each(function() {
var releaseDateStr = $(this).data("release-date");
if (releaseDateStr) {
if (daysDiff(now, new Date(releaseDateStr)) < 90) {
$(this).after(" ", "<span class='jv-new badge rounded-pill' title='This build was released less than 90 days ago'>NEW</span>");
var days = daysDiff(now, new Date(releaseDateStr));
if (days <= 90) {
var msg = "This build was released " + days + (days == 1 ? " day" : " days") + " ago";
var clr = Math.floor(102 + 102 * (90 - days) / 90);
$(this).after(" ", "<span class='jv-new badge rounded-pill' title='" + msg + "' style='background-color: rgb(0," + clr + ",0)'>NEW</span>");
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion docs/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ footer .fa-li i { font-size: 110%; vertical-align: -5%; }
.jv-extra-info { font-size: 82%; font-weight: 700; margin-top: 0.6em; margin-bottom: 0.3em; }
.jv-ico-right { padding-left: 0.2em; }
.jv-lts.badge { background-color: #0000ee; font-size: 76%; font-weight: 700; padding-top: 0.4em; padding-bottom: 0.38em; vertical-align: 12%; }
.jv-new.badge { background-color: #228b22; font-size: 64%; font-weight: 500; padding-top: 0.4em; padding-bottom: 0.38em; vertical-align: 18%; }
.jv-new.badge { background-color: #009900; font-size: 64%; font-weight: 500; padding-top: 0.4em; padding-bottom: 0.38em; vertical-align: 18%; }
.jv-sep { color: #90979d; font-size: 130%; vertical-align: -5%; line-height: 1; }
.jv-status { font-size: 112%; margin-right: 0.25em; vertical-align: -6%; }
.jv-status.jv-current { color: #00d800; }
Expand Down

0 comments on commit fccbe70

Please sign in to comment.