Update web files

This commit is contained in:
Hillel Coren 2021-08-13 07:43:33 +03:00
parent 13a9e6033c
commit 8f49a73666
2 changed files with 81 additions and 19 deletions

View File

@ -1,16 +1,24 @@
<!DOCTYPE html> <!DOCTYPE html>
<html data-report-errors="1"> <html>
<head> <head>
<base href="/">
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="report_errors" content="1">
<title>Invoice Ninja</title>
<link rel="manifest" href="manifest.json">
<script src="//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.4.456/pdf.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.4.456/pdf.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
pdfjsLib.GlobalWorkerOptions.workerSrc = "//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.4.456/pdf.worker.min.js"; pdfjsLib.GlobalWorkerOptions.workerSrc = "//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.4.456/pdf.worker.min.js";
</script> </script>
</head> <meta content="IE=Edge" http-equiv="X-UA-Compatible">
<body style="background-color:#888888;"> <meta name="description" content="Invoice Clients, Track Work-Time, Get Paid Online.">
<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="invoiceninja_client">
<link rel="apple-touch-icon" href="icons/Icon-192.png">
<title>Invoice Ninja</title>
<link rel="manifest" href="manifest.json">
<style> <style>
@ -72,26 +80,80 @@
box-shadow: 0 2.5em 0 0; box-shadow: 0 2.5em 0 0;
} }
} }
</style> </style>
</head>
<body style="background-color:#888888;">
<!-- This script installs service_worker.js to provide PWA functionality to
application. For more information, see:
https://developers.google.com/web/fundamentals/primers/service-workers -->
<script> <script>
if ('serviceWorker' in navigator) { var serviceWorkerVersion = null;
window.addEventListener('load', function () { var scriptLoaded = false;
navigator.serviceWorker.register('/flutter_service_worker.js'); function loadMainDartJs() {
}); if (scriptLoaded) {
return;
}
scriptLoaded = true;
var scriptTag = document.createElement('script');
scriptTag.src = 'main.dart.js';
scriptTag.type = 'application/javascript';
document.body.append(scriptTag);
} }
document.addEventListener('DOMContentLoaded', function(event) { if ('serviceWorker' in navigator) {
document.getElementById('loader').style.display = 'none'; // Service workers are supported. Use them.
}); window.addEventListener('load', function () {
</script> // Wait for registration to finish before dropping the <script> tag.
// Otherwise, the browser will load the script multiple times,
// potentially different versions.
var serviceWorkerUrl = 'flutter_service_worker.js?v=' + serviceWorkerVersion;
navigator.serviceWorker.register(serviceWorkerUrl)
.then((reg) => {
function waitForActivation(serviceWorker) {
serviceWorker.addEventListener('statechange', () => {
if (serviceWorker.state == 'activated') {
console.log('Installed new service worker.');
loadMainDartJs();
}
});
}
if (!reg.active && (reg.installing || reg.waiting)) {
// No active web worker and we have installed or are installing
// one for the first time. Simply wait for it to activate.
waitForActivation(reg.installing ?? reg.waiting);
} else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) {
// When the app updates the serviceWorkerVersion changes, so we
// need to ask the service worker to update.
console.log('New service worker available.');
reg.update();
waitForActivation(reg.installing);
} else {
// Existing service worker is still good.
console.log('Loading app from service worker.');
loadMainDartJs();
}
});
<script defer src="main.dart.js" type="application/javascript"></script> // If service worker doesn't succeed in a reasonable amount of time,
// fallback to plaint <script> tag.
setTimeout(() => {
if (!scriptLoaded) {
console.warn(
'Failed to load app from service worker. Falling back to plain <script> tag.',
);
loadMainDartJs();
}
}, 4000);
});
} else {
// Service workers not supported. Just drop the <script> tag.
loadMainDartJs();
}
</script>
<center style="padding-top: 150px" id="loader"> <center style="padding-top: 150px" id="loader">
<div class="loader"></div> <div class="loader"></div>
</center> </center>
</body> </body>
</html> </html>

View File

@ -5,7 +5,7 @@
"display": "standalone", "display": "standalone",
"background_color": "#0175C2", "background_color": "#0175C2",
"theme_color": "#0175C2", "theme_color": "#0175C2",
"description": "The leading open-source invoicing app", "description": "Invoice Clients, Track Work-Time, Get Paid Online.",
"orientation": "portrait-primary", "orientation": "portrait-primary",
"prefer_related_applications": true, "prefer_related_applications": true,
"related_applications": [ "related_applications": [