1
+ <!DOCTYPE html>
2
+ < html >
3
+
4
+ < style type ="text/css ">
5
+
6
+
7
+ html , body {
8
+ height : 100% ;
9
+ }
10
+
11
+ .bg {
12
+ /* bottom, image */
13
+ background : url (bg.jpg);
14
+ background-size : cover;
15
+ }
16
+
17
+ .center {
18
+ margin : auto;
19
+ position : relative;
20
+ text-align : center;
21
+ top : 37% ;
22
+ width : 100% ;
23
+ }
24
+
25
+ .intro {
26
+ color : white;
27
+ font-size : 70px ;
28
+ }
29
+
30
+ .sensation {
31
+ color : white;
32
+ font-size : 100px ;
33
+ }
34
+
35
+ </ style >
36
+
37
+ < body class ="bg ">
38
+
39
+ < div class ="center ">
40
+ < a id ="intro " class ="intro "> </ a >
41
+ < br >
42
+ < a id ="sensation " class ="sensation "> </ a >
43
+ </ div >
44
+
45
+ < script >
46
+ function hashCode ( num ) {
47
+ var hash = 0 , i , chr ;
48
+ if ( num . length === 0 ) return hash ;
49
+ for ( i = 0 ; i < num . length ; i ++ ) {
50
+ chr = num . charCodeAt ( i ) ;
51
+ hash = ( ( hash << 5 ) - hash ) + chr ;
52
+ hash |= 0 ; // Convert to 32bit integer
53
+ }
54
+ return hash ;
55
+ } ;
56
+
57
+ function readIntroFile ( file )
58
+ {
59
+ var rawFile = new XMLHttpRequest ( ) ;
60
+ rawFile . open ( "GET" , file , false ) ;
61
+ rawFile . onreadystatechange = function ( )
62
+ {
63
+ if ( rawFile . readyState === 4 )
64
+ {
65
+ if ( rawFile . status === 200 || rawFile . status == 0 )
66
+ {
67
+ var allText = rawFile . responseText ;
68
+ var words = allText . split ( "\n" ) ;
69
+ var intro = words [ Math . abs ( num % ( words . length - 1 ) ) ] ;
70
+
71
+ document . getElementById ( "intro" ) . innerHTML = intro + "..." ;
72
+ }
73
+ }
74
+ }
75
+ rawFile . send ( null ) ;
76
+ }
77
+
78
+ function readTextFile ( file , num )
79
+ {
80
+ var rawFile = new XMLHttpRequest ( ) ;
81
+ rawFile . open ( "GET" , file , false ) ;
82
+ rawFile . onreadystatechange = function ( )
83
+ {
84
+ if ( rawFile . readyState === 4 )
85
+ {
86
+ if ( rawFile . status === 200 || rawFile . status == 0 )
87
+ {
88
+ var allText = rawFile . responseText ;
89
+ var words = allText . split ( "\n" ) ;
90
+ var sensation = words [ Math . abs ( num % ( words . length - 1 ) ) ] ;
91
+
92
+ document . getElementById ( "sensation" ) . innerHTML = sensation + " sensation" ;
93
+ }
94
+ }
95
+ }
96
+ rawFile . send ( null ) ;
97
+ }
98
+ var d = new Date ( ) ;
99
+ var num = d . getDate ( ) * 10000000 + d . getMonth ( ) * 10000 + d . getFullYear ( ) ;
100
+ num = hashCode ( num . toString ( ) ) ;
101
+
102
+ readIntroFile ( "https://raw.githubusercontent.com/nmssilva/sensation/master/intros.txt?token=ALAZViPgAMsmH-wz-8ejFpkVxXuvSFyRks5ahksJwA%3D%3D" ) ;
103
+ readTextFile ( "https://raw.githubusercontent.com/nmssilva/sensation/master/sensations.txt?token=ALAZVglc5bpEZafoqIuTH4xUXXvrb5y6ks5ahkKmwA%3D%3D" , num ) ;
104
+
105
+ </ script >
106
+
107
+ </ body >
108
+ </ html >
0 commit comments