Skip to content

Commit 1b4fd80

Browse files
authored
Update homepage.js
1 parent e37675f commit 1b4fd80

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

homepage/homepage.js

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
const isMobile = navigator.userAgent.match('Mobile') || false;
33
const isMac = navigator.platform.indexOf('Mac') > -1;
44
const isSafari = navigator.userAgent.toLowerCase().indexOf('safari') != -1;
5-
5+
/*
66
window.addEventListener('appinstalled', logAppInstalled);
77
88
// Log the installation
@@ -24,8 +24,8 @@ function logAppInstalled(evt) {
2424
2525
});
2626
27-
}
28-
27+
}*/
28+
/*
2929
let deferredInstallPrompt = null;
3030
3131
window.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.
4949
function 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+
*/
9394
window.location.replace(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
144141
if ('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

@@ -174,9 +167,9 @@ function checkPWA() {
174167
}
175168

176169
};
177-
170+
/*
178171
document.addEventListener('visibilitychange', () => { window.setTimeout(checkPWA, 2000) });
179-
checkPWA();
172+
checkPWA();*/
180173

181174

182175
// add scroll event listeners

0 commit comments

Comments
 (0)