22const isMobile = navigator . userAgent . match ( 'Mobile' ) || false ;
33const isMac = navigator . platform . indexOf ( 'Mac' ) > - 1 ;
44const isSafari = navigator . userAgent . toLowerCase ( ) . indexOf ( 'safari' ) != - 1 ;
5-
5+ /*
66window.addEventListener('appinstalled', logAppInstalled);
77
88// Log the installation
@@ -19,13 +19,13 @@ function logAppInstalled(evt) {
1919 localStorage.setItem('installed', 'true');
2020
2121 if (!isMobile) {
22- window . location . replace ( window . location . origin + '/full' ) ;
22+ // window.location.replace(window.location.origin + '/full');
2323 }
2424
2525 });
2626
27- }
28-
27+ }*/
28+ /*
2929let deferredInstallPrompt = null;
3030
3131window.addEventListener('beforeinstallprompt', saveBeforeInstallPromptEvent);
@@ -43,11 +43,12 @@ function saveBeforeInstallPromptEvent(evt) {
4343
4444 deferredInstallPrompt = evt;
4545
46- }
46+ }*/
4747
4848// Event handler for butInstall - Does the PWA installation.
4949function installPWA ( evt ) {
5050
51+ /*
5152 // if codeit isn't already installed
5253 if (!localStorage.getItem('installed')) {
5354
@@ -89,13 +90,13 @@ function installPWA(evt) {
8990 }
9091
9192 } else { // open in the browser
92-
93- window . location . replace ( window . location . origin + '/full' ) ;
93+ */
94+ window . location . href = ( window . location . origin + '/full' ) ;
9495
9596 // save installation in local storage
9697 localStorage . setItem ( 'installed' , 'true' ) ;
9798
98- }
99+ /*}*/
99100
100101}
101102
@@ -116,11 +117,7 @@ document.querySelectorAll('.btn.install').forEach(button => {
116117
117118 button . addEventListener ( 'click' , installPWA ) ;
118119
119- if ( isSafari ) {
120-
121- button . classList . remove ( 'loading' ) ;
122-
123- }
120+ button . classList . remove ( 'loading' ) ;
124121
125122 if ( ! checkLocalStorage ( ) ) {
126123
@@ -143,11 +140,7 @@ document.querySelectorAll('.btn.install').forEach(button => {
143140// Register service worker
144141if ( 'serviceWorker' in navigator ) {
145142
146- window . addEventListener ( 'load' , ( ) => {
147-
148- navigator . serviceWorker . register ( '/service-worker.js' ) ;
149-
150- } ) ;
143+ navigator . serviceWorker . register ( '/service-worker.js' ) ;
151144
152145}
153146
@@ -169,14 +162,14 @@ function checkPWA() {
169162
170163 if ( displayMode != 'browser tab' ) {
171164
172- window . location . replace ( window . location . origin + '/full' ) ;
165+ // window.location.replace(window.location.origin + '/full');
173166
174167 }
175168
176169} ;
177-
170+ /*
178171document.addEventListener('visibilitychange', () => { window.setTimeout(checkPWA, 2000) });
179- checkPWA ( ) ;
172+ checkPWA();*/
180173
181174
182175// add scroll event listeners
0 commit comments