add offline functionality by making this a PWA
- added favicons - added manifest - split javascript into main.js and elevators.js
This commit is contained in:
parent
192e59d9f8
commit
e72ad0cf07
15 changed files with 257 additions and 34 deletions
41
main.js
Normal file
41
main.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
const version = '0.6.0'
|
||||
const minorVersion = version.split('.').splice(0, 2).join('.');
|
||||
const numberFormat = new Intl.NumberFormat('de-DE', {
|
||||
maximumFractionDigits: 1
|
||||
});
|
||||
|
||||
Object.defineProperty(String.prototype, 'capitalize', {
|
||||
value: function () {
|
||||
return this.charAt(0).toUpperCase() + this.toLowerCase().slice(1);
|
||||
},
|
||||
enumerable: false
|
||||
});
|
||||
|
||||
const dateTimeStyle = new Intl.DateTimeFormat('de-DE', {
|
||||
dateStyle: 'medium',
|
||||
timeStyle: 'medium',
|
||||
timeZone: 'Europe/Berlin',
|
||||
})
|
||||
|
||||
// set version
|
||||
document.querySelector('#version').innerHTML = `v${version}`;
|
||||
|
||||
|
||||
function openDialog(selector) {
|
||||
document.querySelector('body').classList.add('has-dialog')
|
||||
document.querySelector('#dialog_layer').classList.add('active')
|
||||
document.querySelector(selector).classList.remove('hidden')
|
||||
}
|
||||
|
||||
function closeDialog(selector) {
|
||||
document.querySelector('body').classList.remove('has-dialog')
|
||||
document.querySelector('#dialog_layer').classList.remove('active')
|
||||
document.querySelector(selector).classList.add('hidden')
|
||||
}
|
||||
|
||||
if ("serviceWorker" in navigator) {
|
||||
console.log('installing sw');
|
||||
navigator.serviceWorker.register("/sw.js").then((registration) => {
|
||||
console.log('done installing sw');
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue