Skip to content

Commit 9596606

Browse files
committed
Only show days in the calendar once that date has been reached.
1 parent cb180a6 commit 9596606

File tree

2 files changed

+32
-11
lines changed

2 files changed

+32
-11
lines changed

index.html

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<title>Patterns Advent Calendar / InnerSource Commons</title>
88
<meta name="description" content="An advent calendar for 2025, to highlight InnerSource patterns that need your help!" />
99
<meta name="keywords" content="advent calendar, web, html template, 3d, cubes, css, javascript, anime.js" />
10-
<meta name="author" content="Codrops" />
10+
<meta name="author" content="InnerSource Commons" />
1111
<link rel="shortcut icon" href="favicon.ico">
1212
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700|Droid+Sans+Mono" rel="stylesheet" />
1313
<link rel="stylesheet" type="text/css" href="css/normalize.css" />
@@ -77,9 +77,9 @@ <h1 class="codrops-header__title">Patterns Advent Calendar</h1>
7777
<div class="cube" data-bg-color="#E0E1F5" data-title="Principle Of Having"></div>
7878
<div class="cube" data-bg-color="#DFD1F0" data-title="Enemies"></div>
7979
<div class="cube" data-bg-color="#DFD1F0" data-title="Better World"></div>
80-
<div class="cube" data-inactive data-bg-color="#6161616" data-title="Coming soon"></div>
81-
<div class="cube" data-inactive data-bg-color="#6161616" data-title="Coming soon"></div>
82-
<div class="cube" data-inactive data-bg-color="#6161616" data-title="Coming soon"></div>
80+
<div class="cube" data-bg-color="#6161616" data-title="23"></div>
81+
<div class="cube" data-bg-color="#6161616" data-title="24"></div>
82+
<div class="cube" data-bg-color="#6161616" data-title="25"></div>
8383
</div>
8484
<div class="content">
8585
<!-- 1 -->
@@ -197,6 +197,21 @@ <h3 class="content__title">Better World</h3>
197197
<p class="content__description">If you assume that there is no hope, you guarantee that there will be no hope. If you assume that there is an instinct for freedom, that there are opportunities to change things, then there is a possibility that you can contribute to making a better world.</p>
198198
<p class="content__meta">Noam Chomsky</p>
199199
</div>
200+
<div class="content__block">
201+
<h3 class="content__title">23</h3>
202+
<p class="content__description">23</p>
203+
<p class="content__meta">23</p>
204+
</div>
205+
<div class="content__block">
206+
<h3 class="content__title">24</h3>
207+
<p class="content__description">24</p>
208+
<p class="content__meta">24</p>
209+
</div>
210+
<div class="content__block">
211+
<h3 class="content__title">25</h3>
212+
<p class="content__description">25</p>
213+
<p class="content__meta">25</p>
214+
</div>
200215
<div class="content__number">0</div>
201216
<button class="btn-back" aria-label="Back to the grid view">&crarr;</button>
202217
</div><!-- /content -->

js/main2.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,20 @@
200200
this.days = [];
201201
var self = this;
202202
this.calendarDays.forEach(function(d, pos) {
203-
// Get the bg color defined in the data-bg-color of each division.
203+
// Advent calendar logic: only activate days that have been reached
204+
var today = new Date(2025, 11, 5); // Simulates December 5, 2025: //new Date();
205+
var year = 2025;
206+
var month = 11; // December (0-based)
207+
var dayOfMonth = pos + 1;
208+
var unlockDate = new Date(year, month, dayOfMonth);
209+
var isActive = today >= unlockDate && !d.hasAttribute('data-inactive');
204210
var day = new Day({
205-
number: pos,
206-
color: d.getAttribute('data-bg-color') || '#f1f1f1',
207-
previewTitle: d.getAttribute('data-title') || '',
208-
inactive: d.hasAttribute('data-inactive')
209-
}),
210-
content = contents[pos];
211+
number: pos,
212+
color: d.getAttribute('data-bg-color') || '#f1f1f1',
213+
previewTitle: d.getAttribute('data-title') || '',
214+
inactive: !isActive
215+
}),
216+
content = contents[pos];
211217

212218
if( content !== undefined ) {
213219
var contentTitle = contents[pos].querySelector('.content__title');

0 commit comments

Comments
 (0)