| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278 |
- <!DOCTYPE html>
- <html lang="de-ch">
-
- <head>
- <title>Caritas PWA</title>
- <base href="/" /> <!--For localhost development-->
- <!--<base href="/cwebplusApp/" />--> <!--For VM-CARITAS-->
- <!--<base href="/cwebplusApp/" />--> <!--For cwebplus.ch-->
- <meta charset="utf-8" />
- <meta name="description" content="Caritas PWA, developed by INTEGRATE AG, Switzerland">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, user-scalable=yes" />
- <meta name="apple-mobile-web-app-status-bar" content="#db001b">
- <meta name="theme-color" content="#db001b">
- <script src="_content/BlazorAnimate/blazorAnimateInterop.js"></script>
- <script src="_content/MatBlazor/dist/matBlazor.js"></script>
- <link href="_content/MatBlazor/dist/matBlazor.css" rel="stylesheet" />
- <link href="css/united/bootstrap.min.css" rel="stylesheet" />
- <link href="css/united/_bootswatch.min.css" rel="stylesheet" />
- <link href="css/united/_variables.min.css" rel="stylesheet" />
- <link href="css/app.css" rel="stylesheet" />
- <link href="manifest.json" rel="manifest" />
- <link rel="apple-touch-icon" href="icons/icon-60@3x.png" />
- <link href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" rel="stylesheet"
- integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
- crossorigin="" />
- </head>
-
- <body>
-
- <app>App wird geladen...</app>
-
- <div id="blazor-error-ui">
- Ein unbehandelter Fehler ist aufgetreten.
- <a href="" class="reload">Neu laden</a>
- <a class="dismiss">🗙</a>
- </div>
-
- <!-- The actual snackbar -->
- <div id="snackbarDiv">
- <div id="snackbar">Eine neue Version der App ist verfügbar. Klicken Sie <a id="reload" style="color:deepskyblue">hier</a> um die App zu aktualisieren. Eventuell müssen Sie die App neu starten.</div>
- </div>
-
- <div class="ios-prompt">
- <span style="color: rgb(187, 187, 187); float: right; margin-top: -14px; margin-right: -11px;">×</span>
- <p style="margin-top: -3px; line-height: 1.3rem;">Um die App auf dem Homebildschirm zu installieren, klicken Sie auf <img src="images/ios-share-icon.png" style="display: inline-block; margin-top: 0px; margin-bottom: 4px; height: 16px; width: auto;"> und dann "Zum Home-Bildschirm".</p>
- </div>
-
- <script src="_framework/blazor.webassembly.js"></script>
- <script src="_content/TG.Blazor.IndexedDB/indexedDb.Blazor.js"></script>
- <script>
- let newWorker;
-
- function showUpdateBar() {
- let snackbarDiv = document.getElementById('snackbarDiv');
- let snackbar = document.getElementById('snackbar');
- snackbar.className = 'show';
- snackbarDiv.className = 'show';
- }
-
- function hideUpdateBar() {
- let snackbarDiv = document.getElementById('snackbarDiv');
- let snackbar = document.getElementById('snackbar');
- snackbar.className = '';
- snackbarDiv.className = '';
- }
-
- // The click event on the pop up notification
- document.getElementById('reload').addEventListener('click', function () {
- newWorker.postMessage({ action: 'skipWaiting' });
- hideUpdateBar();
- });
-
- if ('serviceWorker' in navigator) {
- navigator.serviceWorker.register('service-worker.js').then(reg => {
- reg.addEventListener('updatefound', () => {
- // A wild service worker has appeared in reg.installing!
- newWorker = reg.installing;
-
- newWorker.addEventListener('statechange', () => {
- // Has newWorker.state changed?
- switch (newWorker.state) {
- case 'installed':
- if (navigator.serviceWorker.controller) {
- // new update available
- showUpdateBar();
- }
- // No update available
- break;
- }
- });
- });
- }).catch((err) => console.log('Failed to register Service worker.', err));
-
- let refreshing;
- navigator.serviceWorker.addEventListener('controllerchange', function () {
- if (refreshing) return;
- window.location = window.location.origin;
- refreshing = true;
- console.log('Reload to page ' + window.location.origin + ' on controller change.');
- });
- }
- </script>
-
- <script>
- function BlazorSetLocalStorage(key, value) {
- localStorage.setItem(key, value);
- }
-
- function BlazorGetLocalStorage(key) {
- return localStorage.getItem(key);
- }
-
- function BlazorRegisterStorageEvent(component) {
- window.addEventListener("storage", async e => {
- await component.invokeMethodAsync("OnStorageUpdated", e.key);
- });
- }
-
- function registerOnlineStatusHandler(dotNetObjRef) {
- function onlineStatusHandler() {
- dotNetObjRef.invokeMethodAsync("SetOnlineStatus", navigator.onLine);
- };
- onlineStatusHandler();
- window.addEventListener("online", onlineStatusHandler);
- window.addEventListener("offline", onlineStatusHandler);
- }
-
- function IsGeoLocationAllowed(dotNetObjRef) {
- console.log("IsGeoLocationAllowed...");
- if (isSafari()) {
- navigator.geolocation.getCurrentPosition(
- position => {
- console.log("IsGeoLocationAllowed.position");
- // this function is called only if the user grant permission so here you can handle the granted state
- dotNetObjRef.invokeMethodAsync("GeoLocationPermissionChanged", "granted");
- return "granted";
- },
- error => {
- console.log("IsGeoLocationAllowed.error");
- // this function is called if the user denied permission or some other errors occurs
- dotNetObjRef.invokeMethodAsync("GeoLocationPermissionChanged", "denied");
- return "denied";
- }
- );
- }
- else {
- navigator.permissions.query({ name: 'geolocation' }).then(function (result) {
- console.log("GeoLocation permission: " + result.state);
- result.onchange = function () {
- console.log("GeoLocation permission: " + result.state);
- dotNetObjRef.invokeMethodAsync("GeoLocationPermissionChanged", result.state);
- }
- dotNetObjRef.invokeMethodAsync("GeoLocationPermissionChanged", result.state);
- return result.state;
- });
- }
- return "";
- }
-
- function RemoveScrollLock(dotNetObjRef) {
- document.querySelector("body.mdc-dialog-scroll-lock")?.classList.remove("mdc-dialog-scroll-lock");
- }
-
- function MoveCursorToNextInput(dotNetObjRef, key) {
- if (key == "Enter" || key == "ArrowRight") {
- var activeElement = document.activeElement;
- var inputs = getKeyboardFocusableElements();
- var arr = Array.prototype.slice.call(inputs)
- var index = arr.indexOf(activeElement);
- if (index + 1 < arr.length && CanNavigateForward(activeElement, key)) {
- activeElement.dispatchEvent(new Event('focusout'));
- setTimeout(function () { arr[index + 1].focus(); }, 50);
- if (arr[index + 1].localName.includes('input') || arr[index + 1].localName.includes('textarea')) {
- setTimeout(function () { arr[index + 1].select(); }, 50);
- }
- }
- }
- }
-
- function MoveCursorToPreviousInput(dotNetObjRef) {
- var activeElement = document.activeElement;
- var inputs = getKeyboardFocusableElements();
- var arr = Array.prototype.slice.call(inputs)
- var index = arr.indexOf(activeElement);
- if (index - 1 >= 0 && CanNavigateBack(activeElement)) {
- activeElement.dispatchEvent(new Event('focusout'));
- setTimeout(function () { arr[index + 1].focus(); }, 50);
- if (arr[index - 1].localName.includes('input') || arr[index - 1].localName.includes('textarea')) {
- setTimeout(function () { arr[index - 1].select(); }, 50);
- }
- }
- }
-
- function DispatchKeyboardEvent(dotNetObjRef, key) {
- window.dispatchEvent(new KeyboardEvent('keydown', { 'key': key }));
- }
-
- function getKeyboardFocusableElements(element = document) {
- return [...element.querySelectorAll('input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])')]
- .filter(el => el.localName != 'li' && !el.getAttribute("aria-hidden"))
- }
-
- function CanNavigateForward(element, key) {
- if (element.getAttribute('class').includes('select') || element.getAttribute('class').includes('button')) {
- if (key == "Enter") {
- return false;
- }
- return true;
- } else {
- return key == "Enter" || element.selectionStart == element.value.length
- || (element.selectionStart == 0 && element.selectionEnd == element.value.length);
- }
- }
-
- function CanNavigateBack(element) {
- if (element.getAttribute('class').includes('select') || element.getAttribute('class').includes('button')) {
- return true;
- } else {
- return element.selectionStart == null || element.selectionStart == 0;
- }
- }
-
- function CheckConstrainedInput(dotNetObjRef, key) {
- const ignoredKeys = ["Backspace", "Tab"];
- var theEvent = window.event;
- var activeElement = document.activeElement;
- var regex = new RegExp(activeElement.pattern);
- if (!ignoredKeys.includes(key) && !regex.test(activeElement.value + key)) {
- theEvent.returnValue = false;
- if (theEvent.preventDefault) theEvent.preventDefault();
- }
- }
- </script>
-
- <script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
- integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
- crossorigin="">
- </script>
-
- <!-- ----------------- iOS Support for home screen ----------------- -->
- <script>
- function showIosInstall() {
- let iosPrompt = document.querySelector(".ios-prompt");
- iosPrompt.style.display = "block";
- iosPrompt.addEventListener("click", () => {
- iosPrompt.style.display = "none";
- });
- }
-
- function isSafari() {
- console.log("isSafari...");
- var is_safari = navigator.userAgent.toLowerCase().indexOf('safari/') > -1;
- return is_safari;
- }
-
- function isIOS() {
- console.log("isIOS...");
- // Detects if device is on iOS
- const userAgent = window.navigator.userAgent.toLowerCase();
- return /iphone|ipad|ipod/.test(userAgent);
- }
-
- function iOSInstallerCheck() {
- // Detects if device is in standalone mode
- const isInStandaloneMode = () => ('standalone' in window.navigator) && (window.navigator.standalone);
- // Checks if should display install popup notification:
- if (isIOS() && !isInStandaloneMode()) {
- showIosInstall();
- }
- }
-
- iOSInstallerCheck();
- </script>
- </body>
-
- </html>
-
-
|