Skip to content

Commit fccbe70

Browse files
committed
Change logic for "NEW" badge
1 parent 214a58f commit fccbe70

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

docs/index.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<head>
33
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
44
<meta charset="UTF-8">
5-
<meta http-equiv="last-modified" content="Sun, 13 Oct 2024 15:20:00 GMT+02:00">
5+
<meta http-equiv="last-modified" content="Sun, 13 Oct 2024 16:10:00 GMT+02:00">
66
<link rel="preconnect" href="https://cdnjs.cloudflare.com">
77
<title>Java Versions Cheat Sheet</title>
88
<meta name="author" content="Andrea Binello">
@@ -20,8 +20,8 @@
2020
<link rel="canonical" href="https://andbin.github.io/java-versions-cheat-sheet/">
2121
<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">
2222
<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">
23-
<link rel="stylesheet" href="fonts/roboto.css?v=2410131520">
24-
<link rel="stylesheet" href="styles.css?v=2410131520">
23+
<link rel="stylesheet" href="fonts/roboto.css?v=2410131610">
24+
<link rel="stylesheet" href="styles.css?v=2410131610">
2525
</head>
2626
<body>
2727
<div class="container">
@@ -1362,5 +1362,5 @@ <h5 class="card-header">Java 26 / Java SE 26</h5>
13621362
</div>
13631363
<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>
13641364
</footer>
1365-
</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>
1365+
</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>
13661366
</html>

docs/script.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ $(function() {
2020
$("#jvcstable span.latest-build").each(function() {
2121
var releaseDateStr = $(this).data("release-date");
2222
if (releaseDateStr) {
23-
if (daysDiff(now, new Date(releaseDateStr)) < 90) {
24-
$(this).after(" ", "<span class='jv-new badge rounded-pill' title='This build was released less than 90 days ago'>NEW</span>");
23+
var days = daysDiff(now, new Date(releaseDateStr));
24+
if (days <= 90) {
25+
var msg = "This build was released " + days + (days == 1 ? " day" : " days") + " ago";
26+
var clr = Math.floor(102 + 102 * (90 - days) / 90);
27+
$(this).after(" ", "<span class='jv-new badge rounded-pill' title='" + msg + "' style='background-color: rgb(0," + clr + ",0)'>NEW</span>");
2528
}
2629
}
2730
});

docs/styles.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ footer .fa-li i { font-size: 110%; vertical-align: -5%; }
2828
.jv-extra-info { font-size: 82%; font-weight: 700; margin-top: 0.6em; margin-bottom: 0.3em; }
2929
.jv-ico-right { padding-left: 0.2em; }
3030
.jv-lts.badge { background-color: #0000ee; font-size: 76%; font-weight: 700; padding-top: 0.4em; padding-bottom: 0.38em; vertical-align: 12%; }
31-
.jv-new.badge { background-color: #228b22; font-size: 64%; font-weight: 500; padding-top: 0.4em; padding-bottom: 0.38em; vertical-align: 18%; }
31+
.jv-new.badge { background-color: #009900; font-size: 64%; font-weight: 500; padding-top: 0.4em; padding-bottom: 0.38em; vertical-align: 18%; }
3232
.jv-sep { color: #90979d; font-size: 130%; vertical-align: -5%; line-height: 1; }
3333
.jv-status { font-size: 112%; margin-right: 0.25em; vertical-align: -6%; }
3434
.jv-status.jv-current { color: #00d800; }

0 commit comments

Comments
 (0)