This repository has been archived by the owner on Dec 22, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.html
322 lines (287 loc) · 11.9 KB
/
index.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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<!DOCTYPE html>
<html lang="en">
<head>
<link href="favicon.ico" rel="icon" type="image/x-icon"/>
<title>
Why are the flags up in Finland?
</title>
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@finnishflags">
<meta name="twitter:title" content="Why Are The Flags Up in Finland?">
<meta name="twitter:description" content="Are the flags up in Finland? Find out why.">
<meta name="twitter:image" content="https://whyaretheflagsup.github.io/flag.jpg">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.0/gh-fork-ribbon.min.css">
<!--[if lt IE 9]>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.0/gh-fork-ribbon.ie.min.css">
<![endif]-->
<style type="text/css">
.intro, .reason, .other_reason {
font-family: sans-serif;
font-weight: normal;
text-align: center;
}
body {
background-image: url(pattern.png);
}
.intro {
padding-top: 5px;
}
.outline {
color: white;
text-shadow:
-2px -2px 0 black,
2px -2px 0 black,
-2px 2px 0 black,
2px 2px 0 black;
}
#reason-container {
padding: 5px;
position: absolute;
top: 48px;
bottom: 60px;
left: 0;
right: 0;
text-align: center;
}
/* Sticky footer */
* {
margin: 0;
}
html, body {
height: 100%;
}
.page-wrap {
min-height: 100%;
/* equal to footer height */
margin-bottom: -60px;
}
.page-wrap:after {
content: "";
display: block;
}
.site-footer, .page-wrap:after {
/* .push must be the same height as footer */
height: 60px;
}
.site-footer {
}
/* Background image */
html {
background: no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.github-fork-ribbon:before {
background-color: #18447E;
}
.twitter-button {
top: 5px;
left: 5px;
position: absolute;
}
</style>
<script src='jquery-1.11.2.min.js'></script>
<script src="jquery.textfill.min.js"></script>
<script type="text/javascript">
<!--
var SUNDAY = 0;
var MONDAY = 1;
var TUESDAY = 2;
var WEDNESDAY = 3;
var THURSDAY = 4;
var FRIDAY = 5;
var SATURDAY = 6;
var JANUARY = 1;
var FEBRUARY = 2;
var MARCH = 3;
var APRIL = 4;
var MAY = 5;
var JUNE = 6;
var JULY = 7;
var AUGUST = 8;
var SEPTEMBER = 9;
var OCTOBER = 10;
var NOVEMBER = 11;
var DECEMBER = 12;
function getURLParameter(name) {
return decodeURI(
(RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
);
}
function is_xth_day_in_month(date, required_xth, required_day, required_mm) {
// Is this the required_xth required_day in required_mm?
// For example, is this the second Sunday in May?
var day = date.getDay(); // Sunday is 0, Monday is 1, ... Saturday is 6
var dd = date.getDate();
var mm = date.getMonth() + 1; // January is 0!
var max_dd = required_xth * 7;
var min_dd = max_dd - 6;
if (mm === required_mm && dd >= min_dd && dd <= max_dd && day === required_day) {
return true;
}
return false;
}
var today = new Date();
var past = false;
var future = false;
var intro = 'Flags are up in Finland because today, <span id="date" class="date"></span>, is:';
today.setHours(0, 0, 0, 0); // keep date, ditch time
dateParam = getURLParameter('date');
if (dateParam !== 'null') {
dateParam = dateParam.replace(/\+/g, '-'); // Replace all + with -
var date = new Date(dateParam);
if (date < today) {
past = true;
intro = 'Flags were up in Finland because <span id="date" class="date"></span> was:';
} else if (today < date) {
future = true;
intro = 'Flags will be up in Finland because <span id="date" class="date"></span> will be:';
}
} else {
var date = today;
}
var day = date.getDay(); // Sunday is 0, Monday is 1, ... Saturday is 6
var dd = date.getDate();
var mm = date.getMonth() + 1; // January is 0!
var yyyy = date.getFullYear();
var reason = "";
var other_reason = "";
var enable_background_image = true;
// Static dates
if (mm === FEBRUARY && dd === 5) {
reason = 'Birthday of the national poet Johan Ludvig Runeberg';
} else if (mm === FEBRUARY && dd === 28) {
reason = 'Day of Kalevala; the occasion is also celebrated as the Day of Finnish culture';
} else if (mm === MARCH && dd === 19) {
reason = 'Birthday of novelist and playwright Minna Canth, Day of Equality';
} else if (mm === APRIL && dd === 9) {
reason = 'The day Mikael Agricola, the founder of the literary Finnish died and Elias Lönnrot, a collector of folklore was born; the occasion is also celebrated as the Day of the Finnish language';
} else if (mm === APRIL && dd === 27) {
reason = "National War Veterans' Day";
} else if (mm === MAY && dd === 1) {
reason = 'Vappu, the Day of Finnish Labour';
} else if (mm === MAY && dd === 9) {
reason = 'Europe Day';
} else if (mm === MAY && dd === 12) {
reason = 'Day of the Finnish Identity, birthday of the statesman Johan Vilhelm Snellman';
} else if (mm === JUNE && dd === 4) {
reason = 'Birthday of Carl Gustaf Emil Mannerheim, Marshal of Finland; the occasion is also celebrated as the Flag Day of the Finnish Defence Forces';
} else if (mm === JULY && dd === 6) {
reason = 'Birthday of the poet Eino Leino; the occasion is also a celebration of poetry and summer';
} else if (mm === OCTOBER && dd === 10) {
reason = 'Birthday of the National writer Aleksis Kivi; the occasion is also celebrated as the Day of Finnish literature';
} else if (mm === OCTOBER && dd === 24) {
reason = 'Day of the United Nations';
} else if (mm === NOVEMBER && dd === 6) {
reason = 'Day of the Swedish Identity and Gustavus Adolphus Day';
} else if (mm === NOVEMBER && dd === 20) {
reason = "Universal Children's Day";
} else if (mm === DECEMBER && dd === 6) {
reason = 'Independence Day';
} else if (mm === DECEMBER && dd === 8) {
reason = 'Birthday of the composer Jean Sibelius; the occasion is also celebrated as the Day of Finnish music';
}
// Moveable dates
if (is_xth_day_in_month(date, 2, SUNDAY, MAY)) {
reason = "Mother's Day";
} else if (is_xth_day_in_month(date, 3, SUNDAY, MAY)) {
reason = "Memorial day for the war dead (everyone who has died in Finnish wars, combat-like duties or peacekeeping operations both during fighting and after they've ceased, including those executed or who have died as a POW)";
} else if (mm === JUNE && dd >= 19 && dd <= 25 && day === FRIDAY) {
reason = "Midsummer's eve";
} else if (mm === JUNE && dd >= 20 && dd <= 26 && day === SATURDAY) {
reason = "Midsummer";
} else if (is_xth_day_in_month(date, 2, SUNDAY, NOVEMBER)) {
reason = "Father's Day";
}
// General election every fourth year. Since 2011: third Sunday in April.
if (is_xth_day_in_month(date, 3, SUNDAY, APRIL)) {
if ((yyyy - 2011) % 4 === 0) {
reason = "A parliamentary election";
}
}
// One-offs
if (dd === 4 && mm === SEPTEMBER && yyyy === 2014) {
reason = "70 years since the end of the Continuation War";
}
// Format like 4th June 2014
var m_names = ["January", "February", "March",
"April", "May", "June", "July", "August", "September",
"October", "November", "December"];
var suffix = "";
if (dd === 1 || dd === 21 || dd === 31) {
suffix = "st";
} else if (dd === 2 || dd === 22) {
suffix = "nd";
} else if (dd === 3 || dd === 23) {
suffix = "rd";
} else {
suffix = "th";
}
var date_format = dd + "" + suffix + " " + m_names[mm - 1] + " " + yyyy;
if (reason === "") {
intro = '';
if (past) {
reason = 'Flags were not up in Finland on <span id="date" class="date"></span>';
} else if (future) {
reason = 'Flags will not be up in Finland on <span id="date" class="date"></span>';
} else {
reason = 'Flags are not up in Finland today, <span id="date" class="date"></span>';
}
other_reason = "(Unless there's elections, a referendum, the president is inaugurated, or something else – <a href=\"https://github.com/hugovk/whyaretheflagsup/issues/new\">let us know</a>)";
enable_background_image = false;
}
$(document).ready(function() {
$('#intro').html(intro);
$('#reason').html(reason);
$('#other_reason').html(other_reason);
$('#date').html(date_format);
if (enable_background_image) {
var htmlElement = document.querySelector("html");
htmlElement.style.backgroundImage = 'url(flag.jpg)';
$("#reason").addClass("outline");
$(".reason-container").css({"bottom": "0"});
}
$('#reason-container').textfill({maxFontPixels: 0});
});
$(window).resize(function() {
$('#reason-container').textfill({maxFontPixels: 0});
});
-->
</script>
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-2827121-8', 'hugovk.github.io');
ga('send', 'pageview');
</script>
</head>
<body>
<div class="page-wrap">
<div class="twitter-button">
<a href="https://twitter.com/FinnishFlags" class="twitter-follow-button" data-show-count="false" data-dnt="true">Follow @FinnishFlags</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
</div>
<a class="github-fork-ribbon left-right" href="https://github.com/hugovk/whyaretheflagsup" title="Fork me on GitHub">Fork me on GitHub</a>
<H2>
<div id="intro" class="intro outline"></div>
</H2>
<H1>
<div id="reason-container"><span id="reason" class="reason"></span></div>
</H1>
</div>
<footer class="site-footer"><P> </P>
<div id="other_reason" class="other_reason"></div>
</footer>
</body>
</html>