@@ -32,6 +32,7 @@ const baseURLPrefix = (() => {
32
32
$ ( document ) . ready ( function ( ) {
33
33
BrowserFallbacks . init ( ) ;
34
34
DarkMode . init ( ) ;
35
+ GitTurns20 . init ( ) ;
35
36
Search . init ( ) ;
36
37
Dropdowns . init ( ) ;
37
38
Forms . init ( ) ;
@@ -102,6 +103,68 @@ var BrowserFallbacks = {
102
103
103
104
}
104
105
106
+ var GitTurns20 = {
107
+ keySequence : '20' ,
108
+ keySequenceOffset : 0 ,
109
+
110
+ init : function ( ) {
111
+ const today = new Date ( ) ;
112
+ if ( today . getFullYear ( ) === 2025 && today . getMonth ( ) === 3 && today . getDate ( ) === 7 ) {
113
+ this . celebrate ( ) ;
114
+ } else {
115
+ let start = 0
116
+ let count = 0
117
+ $ ( "#tagline" ) . click ( e => {
118
+ if ( count === 0 || e . timeStamp > start + count * 1000 ) {
119
+ start = e . timeStamp ;
120
+ count = 1 ;
121
+ } else if ( ++ count === 6 ) {
122
+ this . celebrate ( ) ;
123
+ count = 0 ;
124
+ }
125
+ } )
126
+ }
127
+ } ,
128
+
129
+ keydown : function ( e ) {
130
+ if ( this . keySequenceOffset >= this . keySequence . length ) return ;
131
+ if ( this . keySequence [ this . keySequenceOffset ] === e . key ) {
132
+ if ( ++ this . keySequenceOffset === this . keySequence . length ) {
133
+ this . celebrate ( ) ;
134
+ this . keySequenceOffset = 0 ;
135
+ }
136
+ }
137
+ } ,
138
+
139
+ celebrate : function ( ) {
140
+ document . documentElement . dataset . celebration = 'git-turns-20' ;
141
+ $ ( "#tagline" ) . html ( '<a href="https://discord.com/channels/1042895022950994071/1356927327388434564">--20th-anniversary</a>' ) ;
142
+ if ( $ ( "#masthead" ) . length ) { // only do this on the front page
143
+ ( async ( ) => {
144
+ await import ( 'https://cdn.jsdelivr.net/npm/[email protected] /dist/confetti.browser.min.js' ) ;
145
+ const count = 200 ;
146
+ const defaults = {
147
+ origin : { y : 0.7 }
148
+ } ;
149
+
150
+ for ( const [ particleRatio , opts ] of [
151
+ [ 0.25 , { spread : 26 , startVelocity : 55 } ] ,
152
+ [ 0.2 , { spread : 60 } ] ,
153
+ [ 0.35 , { spread : 100 , decay : 0.91 , scalar : 0.8 } ] ,
154
+ [ 0.1 , { spread : 120 , startVelocity : 25 , decay : 0.92 , scalar : 1.2 } ] ,
155
+ [ 0.1 , { spread : 120 , startVelocity : 45 } ] ,
156
+ ] ) {
157
+ window . confetti ( {
158
+ ...defaults ,
159
+ ...opts ,
160
+ particleCount : Math . floor ( count * particleRatio )
161
+ } ) ;
162
+ }
163
+ } ) ( ) . catch ( console . error ) ;
164
+ }
165
+ }
166
+ } ;
167
+
105
168
var Search = {
106
169
searching : false ,
107
170
currentSearch : '' ,
@@ -166,6 +229,7 @@ var Search = {
166
229
e . preventDefault ( ) ;
167
230
$ ( 'form#search input' ) . focus ( ) ;
168
231
}
232
+ else if ( e . target . tagName . toUpperCase ( ) !== 'INPUT' ) GitTurns20 . keydown ( e ) ;
169
233
} ) ;
170
234
} ,
171
235
0 commit comments