-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalendar.html
More file actions
198 lines (158 loc) · 9.87 KB
/
calendar.html
File metadata and controls
198 lines (158 loc) · 9.87 KB
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>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale:1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="stylesheet" href="css/style.css" />
<link rel="favorite icon" href="favicon.ico" sizes="any" type="image/x-icon">
<link rel="icon" href="favicon.svg" type="image/svg+xml">
<script src="js/app.js" type="text/javascript"></script>
<script src="js/computus.js" type="text/javascript"></script>
<script type="text/javascript">
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
var serviceId;
let year = (new Date()).getFullYear();
if(urlParams.has("year")) {
year = urlParams.get("year");
}
onload = function() {
document.getElementById("lastYear").setAttribute("href", "./calendar.html?year=" + (parseInt(year) - 1));
document.getElementById("nextYear").setAttribute("href", "./calendar.html?year=" + (parseInt(year) + 1));
GetTodaysService()
.then (function(result) {
serviceId = result.id;
})
.then (function(result) {
GetAllSundays(year)
.then(function(result) {
let lastSunday = new Date();
let today = new Date().toDateString();
lastSunday.setDate(lastSunday.getDate() - lastSunday.getDay());
lastSunday = lastSunday.toDateString();
let output = "<table><thead style=\"position: sticky; top: 10rem;\"><tr><th>Name</th><th>Date</th><th></th></tr></thead><tbody>";
for (let i in result) {
output += "<tr id=\"" + result[i].id + "\"><td>";
if(result[i].id == serviceId) {
output += "<strong>";
}
output += result[i].name;
if (result[i].altname) {
output += " <span class=\"small\">(" + result[i].altname + ")</span>";
}
if(result[i].id == serviceId) {
output += "</strong></td><td><strong>";
}
else {
output += "</td><td>";
}
output += result[i].Date.toDateString();
if(result[i].id == serviceId) {
output += "</strong></td>";
}
else {
output += "</td>";
}
output += "<td>";
output += "<a class=\"noDecoration\" href=\"./services/The-Lords-Supper-or-Holy-Communion.html?serviceId=" + result[i].id + "\">";
output += "<img src=\"./images/EucharistElements.png\" class=\"icon\">";
output += "</a>";
output += "<img src=\"./images/Readings.png\" style=\"cursor: pointer\" class=\"icon\" onclick=\"showReadings('" + result[i].id + "')\">";
output += "</td></tr>";
}
output += "</tbody></table>";
document.querySelector("#calendar").innerHTML = output;
window.scrollTo(0, (document.getElementById(serviceId).offsetTop) - convertRemToPixels(2));
});
});
}
function showReadings(serviceId) {
document.querySelector("#blurout").classList.remove("hidden");
document.querySelector("#readings").classList.remove("hidden");
GetServiceFromId(serviceId)
.then(function(service) {
SetServiceContent(service);
});
}
function hideReadings() {
document.querySelector("#blurout").classList.add("hidden");
document.querySelector("#readings").classList.add("hidden");
return false;
}
function SetServiceContent(today) {
document.querySelector("#serviceTitle").innerHTML = today.name;
document.querySelector("#serviceTitle").classList.remove("placeholder");
return fetch("./js/readings.json")
.then(function(response) {
return response.json();
})
.then(function(readings) {
var reading = Object.values(readings).find(sunday => sunday.id === today.id)
var epistleIntro = bookLookup[reading.epistle.ref.book].cw + " " + reading.epistle.ref.verses[0].chapter + ":" + reading.epistle.ref.verses[0].from + "-" + reading.epistle.ref.verses[0].to;
epistleIntro = "<a href=\"https://www.biblegateway.com/passage/?search=" + epistleIntro.replace(" ", "") + "&version=KJV\" target=\"_blank\">" + epistleIntro + "</a>";
var gospelIntro = bookLookup[reading.gospel.ref.book].cw + " " + reading.gospel.ref.verses[0].chapter + ":" + reading.gospel.ref.verses[0].from + "-" + reading.gospel.ref.verses[0].to;
gospelIntro = "<a href=\"https://www.biblegateway.com/passage/?search=" + gospelIntro.replace(" ", "") + "&version=KJV\" target=\"_blank\">" + gospelIntro + "</a>";
document.querySelector("#collect-of-the-day").innerHTML = "";
reading.collects.forEach(function(collect) {
document.querySelector("#collect-of-the-day").innerHTML += collect + "<br><br>";
})
document.querySelector("#collect-of-the-day").classList.replace("placeholder", "liturgy");
document.querySelector("#epistle").innerHTML = epistleIntro + "<br><br>" + reading.epistle.text;
document.querySelector("#epistle").classList.replace("placeholder", "liturgy");
document.querySelector("#gospel").innerHTML = gospelIntro + "<br><br>" + reading.gospel.text;
document.querySelector("#gospel").classList.replace("placeholder", "liturgy");
});
}
</script>
<!-- ios support -->
<link rel="apple-touch-icon" href="images/icons/icon-72x72.png" />
<link rel="apple-touch-icon" href="images/icons/icon-96x96.png" />
<link rel="apple-touch-icon" href="images/icons/icon-128x128.png" />
<link rel="apple-touch-icon" href="images/icons/icon-144x144.png" />
<link rel="apple-touch-icon" href="images/icons/icon-152x152.png" />
<link rel="apple-touch-icon" href="images/icons/icon-192x192.png" />
<link rel="apple-touch-icon" href="images/icons/icon-384x384.png" />
<link rel="apple-touch-icon" href="images/icons/icon-512x512.png" />
<meta name="apple-mobile-web-app-status-bar" content="#FCCB00" />
<meta name="theme-color" content="#FCCB00" />
<title>PrayerBook.online | Calendar</title>
</head>
<body>
<main>
<nav>
<object type="image/svg+xml" data="./images/EucharistElementsHeader-noFont.svg" class="logo"></object>
<div class="topnav" style="z-index: 10" id="navbar">
<a href="./">About</a>
<a href="#calendar" class="active">Calendar</a>
<a href="services/The-Lords-Supper-or-Holy-Communion.html">Holy Communion</a>
<a href="./settings.html">Settings</a>
<a href="javascript:void(0);" class="icon" onclick="toggleHamburger()">
<div class="hamburger"></div>
<div class="hamburger"></div>
<div class="hamburger"></div>
</a>
</div>
</nav>
<div class="container">
<div class="nav" style="position: fixed; width: -webkit-fill-available; left: 0; margin: 0 0.5rem;">
<a href="." id="lastYear"><</a> <script>document.write(year);</script> <a href="." id="nextYear">></a>
</div>
<div id="calendar" style="padding-top: 2.5rem;"></div>
<div id="blurout" class="blurry hidden"></div>
<div id="readings" class="readings hidden">
<div style="text-align: right; cursor: pointer" onclick="hideReadings()">X</div>
<h1 id="serviceTitle" class="placeholder"></h1>
<div id="scroller" class="scrollVer">
<p class="direction">The Collect:</p>
<p id="collect-of-the-day" class="placeholder"></p>
<p class="direction">The Epistle:</p>
<p id="epistle" class="placeholder"></p>
<p class="direction">The Gospel:</p>
<p id="gospel" class="placeholder"></p>
</div>
</div>
</div>
</main>
</body>
</html>