This repository has been archived by the owner on Aug 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
/
time_of_day.html
181 lines (145 loc) · 3.16 KB
/
time_of_day.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<head>
<title>Reader Aware Design Demo</title>
<script src="http://xoxco.com/js/jquery.min.js"></script>
<script src="aware.js"></script>
<script>
$(function() {
$().aware();
});
</script>
<style>
body {
font-family: 'helvetica';
}
#wrapper {
width: 90%;
max-width: 1024px;
margin: 0px auto;
overflow: visible;
text-align: center;
}
h1 {
font-size: 40px;
}
#time_of_day {
width: 50%;
}
#time {
font-weight: bold;
font-size: 60px;
margin:0;
}
/* Hide messages by default */
h1.morning, h1.afternoon, h1.nighttime {
display: none;
}
/* special styles for day time */
body.daytime {
color: #369;
background-color: #FFF;
}
body.morning {
background-image: -webkit-linear-gradient(#f1d97a 0%, #ffffff 25%)
}
body.morning.earlymorning {
background-color: #333;
background-image: -webkit-linear-gradient( #333 0%,#f1d97a 90%);
}
body.earlymorning h1,
body.earlymorning h2 {
color: #FFF;
}
.morning h1.morning {
display: block;
}
.morning .h1.earlymorning {
display: none;
}
.morning.earlymorning .h1.morning {
display: block;
}
.afternoon h1.afternoon {
display: block;
}
/* special styles for night time */
body.nighttime {
color: #fff;
background-color: #333;
}
body.nighttime h1,
body.nighttime h2 {
color: #610a8d;
}
body.nighttime a {
color: #8331cb;
}
.nighttime h1.nighttime {
display: block;
}
body.night {
background-image: -webkit-linear-gradient(#000 0%, #333 60%)
}
body.latenight {
background-image: -webkit-linear-gradient(#000 0%, #333 90%)
}
body.latenight h1 {
color:fuchsia;
}
body.latenight h2 {
color: #e806f7;
}
body.latenight a {
color: #07ff56;
}
</style>
<script>
$(function() {
function showTime(time) {
m = ' AM';
if (time >= 12 && time < 24) {
m = ' PM';
}
if (time > 12) {
time -= 12;
}
if (time == 0) {
time = 12;
}
time = time +m;
$('#time').html(time);
}
$('#time_of_day').on('change',function() {
$('body').removeClass();
showTime($(this).val());
$().time_of_day($(this).val());
});
$('#time_of_day').val(new Date().getHours());
showTime(new Date().getHours());
})
</script>
</head>
<body>
<div style="background: #5DACE2; color: #FFF; padding: 5px; text-align: right;">
Powered by Aware.js: <a href="http://xoxco.com/projects/code/aware/">Get the code</a>
</div>
<div id="wrapper">
<h1 class="morning">Good Morning!</h1>
<h1 class="afternoon">Good Afternoon!</h1>
<h1 class="nighttime">Good Evening!</h1>
<h1>
The design of this page<Br/>
responds to the time<br/>
where you're sitting right now.</h1>
<form>
<p>Change the time</p>
<p id="time">12</p>
<input id="time_of_day" type="range" min="0" max="24" />
</form>
<h2>Alter the layout or content of your site<br />
based on the time of day<br />
and a bunch of other "reader aware" attributes<br />
with no server side code:
</h2>
<h1><a href="http://xoxco.com/projects/code/aware/">Aware.js</a></h1>
</div>
</body>