Skip to content

Commit 4a1c91d

Browse files
committed
Support a key sequence for testing the celebration
Since it is not yet April 7th, 2025, the code to turn on the 20th birthday celebration needs to be tested either by changing the clock, or by a hack like this: typing the digits `2` and `0` will do it. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 670cd01 commit 4a1c91d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

assets/js/application.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,26 @@ var BrowserFallbacks = {
104104
}
105105

106106
var GitTurns20 = {
107+
keySequence: '20',
108+
keySequenceOffset: 0,
109+
107110
init: function() {
108111
const today = new Date();
109112
if (today.getFullYear() === 2025 && today.getMonth() === 3 && today.getDate() === 7) {
110113
this.celebrate();
111114
}
112115
},
113116

117+
keydown: function(e) {
118+
if (this.keySequenceOffset >= this.keySequence.length) return;
119+
if (this.keySequence[this.keySequenceOffset] === e.key) {
120+
if (++this.keySequenceOffset === this.keySequence.length) {
121+
this.celebrate();
122+
this.keySequenceOffset = 0;
123+
}
124+
}
125+
},
126+
114127
celebrate: function() {
115128
document.documentElement.dataset.celebration = 'git-turns-20';
116129
}
@@ -180,6 +193,7 @@ var Search = {
180193
e.preventDefault();
181194
$('form#search input').focus();
182195
}
196+
else if (e.target.tagName.toUpperCase() !== 'INPUT') GitTurns20.keydown(e);
183197
});
184198
},
185199

0 commit comments

Comments
 (0)