File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 25
25
< div id ="app "> </ div >
26
26
< script type ="module " src ="/src/main.ts "> </ script >
27
27
< script async defer src ="https://cabin.archiguesser.com/hello.js "> </ script >
28
+ < script >
29
+ const urlParameters = new URLSearchParams ( window . location . search ) ;
30
+ const requestedDay = urlParameters . get ( "day" ) ;
31
+ const isArcadeMode = urlParameters . get ( "challenge" ) || false ;
32
+
33
+ if ( ! isArcadeMode ) {
34
+ try {
35
+ let day ;
36
+ if (
37
+ requestedDay &&
38
+ ! isNaN ( parseInt ( requestedDay ) )
39
+ ) {
40
+ day = parseInt ( requestedDay ) ;
41
+ } else {
42
+ const StartDate = Date . UTC ( 2022 , 6 , 1 ) ;
43
+ const now = new Date ( ) ;
44
+ const timestamp1 = Date . UTC (
45
+ now . getFullYear ( ) ,
46
+ now . getMonth ( ) ,
47
+ now . getDate ( ) ,
48
+ ) ;
49
+ const differenceInMilliseconds = timestamp1 - StartDate ;
50
+ const differenceInDays = differenceInMilliseconds / 1000 / 60 / 60 / 24 ;
51
+
52
+ day = differenceInDays ;
53
+ }
54
+
55
+ let link = document . createElement ( 'link' ) ;
56
+ link . as = 'image' ;
57
+ link . type = 'image/jpeg' ;
58
+ link . rel = 'preload' ;
59
+ link . href = `${ day } /1.jpg` ;
60
+ document . head . appendChild ( link ) ;
61
+ } catch ( e ) { console . error ( e ) ; }
62
+ }
63
+ </ script >
28
64
</ body >
29
65
</ html >
You can’t perform that action at this time.
0 commit comments