forked from hugovk/whyaretheflagsup
-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.html
198 lines (172 loc) · 4.98 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
<!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/images/flag.jpg"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.0/gh-fork-ribbon.min.css"
/>
<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;
}
</style>
<script
src="https://code.jquery.com/jquery-3.7.1.slim.min.js"
integrity="sha256-kmHvs0B+OpCW5GVHUNjv9rOmY0IvSIRcf7zGUDTDQM8="
crossorigin="anonymous"
></script>
<script src="jquery.textfill.min.js"></script>
<script src="whyaretheflagsup.js"></script>
<script type="text/javascript">
<!--
$(document).ready(function () {
function getURLParameter(name) {
return decodeURI(
(RegExp(name + "=" + "(.+?)(&|$)").exec(location.search) || [, null])[1],
);
}
let dateParam = getURLParameter("date");
let date;
if (dateParam !== "null") {
dateParam = dateParam.replace(/\+/g, "-"); // Replace all + with -
date = new Date(dateParam);
} else {
date = new Date(); // Today
}
const why = why_are_the_flags_up(date);
const flags_up = why[0];
const intro = why[1];
let reasons = why[2].join(" and ");
// Capitalise first letter
reasons = reasons.charAt(0).toUpperCase() + reasons.slice(1);
const other_reason = why[3];
$("#intro").html(intro);
$("#reason").html(reasons);
$("#other_reason").html(other_reason);
if (flags_up) {
const htmlElement = document.querySelector("html");
htmlElement.style.backgroundImage = "url(images/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">
<a
class="github-fork-ribbon left-right"
href="https://github.com/whyaretheflagsup/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>