/
index.html
173 lines (141 loc) · 6.05 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
<html>
<head>
<title>Days since Northern Ireland had a government</title>
<!-- Opengraph -->
<meta property="og:site_name" content="How long has Northern Ireland not had a government?">
<meta property="og:description" content="How long has Northern Ireland not had a government?">
<meta property="og:title" content="How long has Northern Ireland not had a government?">
<meta property="og:url" content="https://howlonghasnorthernirelandnothadagovernment.com">
<meta property="og:type" content="website">
<meta name="google-site-verification" content="3KyhJ3NKj7pfThv6Gy2u-ks9HzILtMFuURFd4SpRqTY" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href='https://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
<style>
#days-container {
display: block;
font-size: calc(300% + 1.0vw);
}
#mla-container,
#salary-container {
display: block;
font-size: calc(180% + 2.0vw);
}
#main {
width: 80%;
color: #fff;
padding: 10%;
font-family: 'Oswald', sans-serif;
background-color: #dd9ca6;
text-align: center;
font-size: 2.25em;
}
.record {
font-size: 80%;
padding-top: 2em;
padding-bottom: 2em;
}
a {
color: #7d4c56;
}
small {
font-size: 50%;
}
</style>
</head>
<body>
<div id="main">
<span><a href="">We have a government!</a></span>
<p>
Northern Ireland has had a government for
<span id="days-container"></span>
days!
</p>
<p>
<small><a href="about.html">More info</a><br /><br /></small>
<small><a href="https://github.com/andrewbolster/howlonghasnorthernirelandnothadagovernment.com">Built with
♥ by NITD #Politics</a></br></br></small>
<small>With thanks to https://github.com/hearmecode/days-since</small><br>
<small>Salary information obtained from: <a
href="http://www.niassembly.gov.uk/your-mlas/members-salaries-and-expenses/salaries-and-expenditure-rates-2016-2021/">www.niassembly.gov.uk</a></small>
</p>
</div>
<script type="text/javascript">
"use strict";
var noGovDate = new Date(2024, 1, 3, 13, 0); // Curse your Zero indexed dates....
Date.daysSince = function (compareDate) {
var millisecondsInDay = 24 * 60 * 60 * 1000;
var timeDiff = new Date().getTime() - compareDate.getTime();
return Math.floor(timeDiff / millisecondsInDay);
}
Date.monthsSince = function (compareDate) {
var millisecondsInDay = 24 * 60 * 60 * 1000;
var millisecondsInMonth = millisecondsInDay * 31;
var todaysDate = new Date();
if (todaysDate.getMonth() == 1) {
millisecondsInMonth = millisecondsInDay * 28;
} else if (todaysDate.getMonth() == 10 || todaysDate.getMonth() == 3 || todaysDate.getMonth() == 5 || todaysDate.getMonth() == 8) {
millisecondsInMonth = millisecondsInDay * 30;
}
var timeDiff = todaysDate.getTime() - compareDate.getTime();
return Math.floor(timeDiff / millisecondsInMonth);
}
Date.secondsSince = function (compareDate) {
var timeDiff = new Date().getTime() - compareDate.getTime();
return Math.floor(timeDiff / 1000);
}
var noGov = (function () {
var currentRecordDays = 589;
var daysSinceGov = Date.daysSince(noGovDate);
return {
totalDays: function () {
return daysSinceGov;
},
description: function () {
return "Northern Ireland has had a government for " + daysSinceGov + "days.";
}
};
})();
var salaryCount = (function () {
var dailyBaseSalaryFrom2020 = 51000 / 365; // http://www.niassembly.gov.uk/your-mlas/members-salaries-and-expenses/salaries-and-expenditure-rates-2016-2021/
var salaryPerSecond = (((dailyBaseSalaryFrom2020 / 24) / 60) / 60);
var noOfMLAs = 90;
return {
totalPay: function () {
return (((salaryPerSecond * Date.secondsSince(noGovDate))) * noOfMLAs);
},
perMLA: function () {
return (this.totalPay() / noOfMLAs);
}
};
})();
function displayCurrency(val) {
return Math.round(val).toLocaleString('en-GB', {
style: 'currency',
currency: 'GBP',
minimumFractionDigits: 0
});
}
function updateCounter() {
setTimeout(function () {
document.getElementById("salary-container").innerHTML = displayCurrency(salaryCount.totalPay());
document.getElementById("mla-container").innerHTML = displayCurrency(salaryCount.perMLA());
updateCounter();
}, 1000)
}
document.addEventListener("DOMContentLoaded", function () {
document.getElementById("days-container").innerHTML = noGov.totalDays();
updateCounter();
document.querySelector("meta[property='og:description']").setAttribute('content', noGov.description());
document.querySelector("meta[property='og:title']").setAttribute('content', noGov.description());
});
</script>
<!-- Global site tag (gtag.js) - Google Analytics Ask Bolster for numbers-->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-8275151-10"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'UA-8275151-10');
</script>
</body>
</html>