@@ -32,6 +32,7 @@ const baseURLPrefix = (() => {
3232$ ( document ) . ready ( function ( ) {
3333 BrowserFallbacks . init ( ) ;
3434 DarkMode . init ( ) ;
35+ GitTurns20 . init ( ) ;
3536 Search . init ( ) ;
3637 Dropdowns . init ( ) ;
3738 Forms . init ( ) ;
@@ -102,6 +103,69 @@ var BrowserFallbacks = {
102103
103104}
104105
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.gg/UcjvsNQR">--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+ disableForReducedMotion : true ,
149+ } ;
150+
151+ for ( const [ particleRatio , opts ] of [
152+ [ 0.25 , { spread : 26 , startVelocity : 55 } ] ,
153+ [ 0.2 , { spread : 60 } ] ,
154+ [ 0.35 , { spread : 100 , decay : 0.91 , scalar : 0.8 } ] ,
155+ [ 0.1 , { spread : 120 , startVelocity : 25 , decay : 0.92 , scalar : 1.2 } ] ,
156+ [ 0.1 , { spread : 120 , startVelocity : 45 } ] ,
157+ ] ) {
158+ window . confetti ( {
159+ ...defaults ,
160+ ...opts ,
161+ particleCount : Math . floor ( count * particleRatio )
162+ } ) ;
163+ }
164+ } ) ( ) . catch ( console . error ) ;
165+ }
166+ }
167+ } ;
168+
105169var Search = {
106170 searching : false ,
107171 currentSearch : '' ,
@@ -166,6 +230,7 @@ var Search = {
166230 e . preventDefault ( ) ;
167231 $ ( 'form#search input' ) . focus ( ) ;
168232 }
233+ else if ( e . target . tagName . toUpperCase ( ) !== 'INPUT' ) GitTurns20 . keydown ( e ) ;
169234 } ) ;
170235 } ,
171236
0 commit comments