-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
172 lines (158 loc) · 7.65 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#1DE9B6" />
<meta name="description" content="The Bible Scout App was created to help you scout (to examine, seek and observe) the Holy Bible as text and audio through reading plans in multiple languages." />
<meta name="google-site-verification" content="QdLn8_wxfm2IN5GefR3UJ4FaZqSytowpXEuNrfuzdvg" />
<title>Bible Scout: Finding your way through the scriptures</title>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebApplication",
"name": "Bible Scout",
"operatingSystem": "Any with a modern browser",
"applicationCategory": "LifestyleApplication",
"browserRequirements": "Chrome, Safari, Edge or Chromium",
"review": {
"@type": "Review",
"author": {
"@type": "Person",
"name": "Christina J",
"givenName": "Christina",
"familyName": "J"
},
"reviewRating": {
"@type": "Rating",
"ratingValue": "4",
"ratingExplanation": "As Bible Scout improves it will become a 5 star Bible reading app."
}
},
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "USD"
}
}
</script>
<link rel="icon" type="image/png" href="media/bible-scout-192x192.png" sizes="192x192" />
<link rel="apple-touch-icon" href="media//bible-scout-192x192.png">
<link rel='manifest' href='/manifest.webmanifest'>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<link rel="stylesheet" href="third-party/materialize.min.css">
<link rel="stylesheet" href="app-styles.css" />
<!-- <script src="https://unpkg.com/[email protected]/mithril.js"></script> -->
<script src="third-party/lodash.min.js"></script>
<script src="third-party/mithril2.min.js"></script>
<script src="third-party/mithril-stream.min.js"></script>
<script src="third-party/materialize.min.js"></script>
<!-- input data for reading plan 1 https://gitlab.com/ericop/bible-reading-plan-to-json -->
<script>
var globalServiceWorker = null;
function listenForWaitingServiceWorker(reg, callback) {
function awaitStateChange() {
reg.installing.addEventListener('statechange', function () {
if (this.state === 'installed') {
globalServiceWorker = reg
callback(reg)
}
})
}
if (!reg) {
return
}
if (reg.waiting) {
globalServiceWorker = reg
return callback(reg)
}
if (reg.installing) {
awaitStateChange()
}
reg.addEventListener('updatefound', awaitStateChange)
}
function reloadPage() {
console.log('reloading...')
setTimeout(function () { window.location.reload() }, 2000);
}
function ignoreUpdate() {
console.warn('ignore Bible Scout new version or Cache clear')
document.querySelector('#toast-container').setAttribute('style', 'display:none')
}
// This is the 'Offline copy of pages' service worker from https://preview.pwabuilder.com/serviceworker
// Add this below content to your HTML page, or add the js file to your page at the very top to register service worker
// Check compatibility for the browser we're running this in
if ('serviceWorker' in navigator) {
//if (navigator.serviceWorker.controller) {
console.log('[PWA] active service worker found, no need to register.')
//} else {
// Register the service worker
navigator.serviceWorker
.register('service-worker.js'
// , {scope: './'}
)
.then(function (reg) {
console.log('[PWA] Service worker has been registered for scope:', reg)
globalServiceWorker = reg
// example starts from https://stackoverflow.com/questions/40100922/activate-updated-service-worker-on-refresh/40130378#40130378
// reload once when the new Service Worker starts activating
var refreshing = false
navigator.serviceWorker.addEventListener('controllerchange',
function () {
if (refreshing) return
refreshing = true
window.location.reload()
}
)
function promptUserToRefresh(registeredWorker) {
console.log('promptUserToRefresh reg=', registeredWorker)
globalServiceWorker = registeredWorker
var toastHtml =
`<span>New version available</span>
<button class="btn-flat toast-action"
onclick="globalServiceWorker.waiting.postMessage({action:'skipWaiting'});reloadPage();">
update
</button>
<button class="btn-flat toast-action" onclick="ignoreUpdate()">
nah
</button>'`
M.toast({
html: toastHtml,
displayLength: 8000,
classes: 'update-app-toast'
})
// this is just an example
// don't use window.confirm in real life; it's terrible
// if (window.confirm("New version available! OK to refresh?")) {
// reg.waiting.postMessage('skipWaiting')
// }
}
listenForWaitingServiceWorker(reg, promptUserToRefresh)
//example ends
})
.catch(function (err) {
console.log('[PWA] Service worker did not work. This happened: ', err)
})
//}
}
</script>
</head>
<body>
<noscript>Please Enable JavaScript, it is needed to use Bible Scout App.</noscript>
<div id="app"></div>
<script src="dist/biblescout.min.js" type="module"></script>
<!-- <script src="data/esv-book.data.js" type="module"></script>
<script src="data/discipleship-journal-plan.data.js" type="module"></script>
<script src="services/bible-media.service.js" type="module"></script>
<script src="components/settings.component.js" type="module"></script>
<script src="components/reading-card.component.js" type="module"></script>
<script src="components/law-and-prophets.component.js" type="module"></script>
<script src="components/nav.component.js" type="module"></script>
<script src="components/gospels.component.js" type="module"></script>
<script src="components/wisdom.component.js" type="module"></script>
<script src="components/epistles.component.js" type="module"></script>
<script src="components/home.component.js" type="module"></script>
<script src="components/about.component.js" type="module"></script>
<script src="bible-scout-core-app.js" type="module"></script> -->
</body>
</html>