update
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
.DS_Store
|
||||||
|
**/.DS_Store
|
||||||
|
node_modules
|
||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>My App</title>
|
<title>My App</title>
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "My App",
|
"name": "Broadcast",
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
|
|||||||
Vendored
+14
-2
@@ -105,6 +105,10 @@ header {
|
|||||||
accent-color: var(--primary);
|
accent-color: var(--primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: var(--link);
|
||||||
|
}
|
||||||
|
|
||||||
/* text */
|
/* text */
|
||||||
|
|
||||||
.success {
|
.success {
|
||||||
@@ -605,6 +609,7 @@ select + .icon,
|
|||||||
article,
|
article,
|
||||||
main,
|
main,
|
||||||
select + .icon,
|
select + .icon,
|
||||||
|
.height-100,
|
||||||
.modal > div,
|
.modal > div,
|
||||||
.modal main {
|
.modal main {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@@ -683,6 +688,7 @@ code {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.secondary,
|
.secondary,
|
||||||
|
.secondary *,
|
||||||
.helper-text,
|
.helper-text,
|
||||||
.error-text,
|
.error-text,
|
||||||
label {
|
label {
|
||||||
@@ -749,7 +755,8 @@ input[type="radio"]:checked::before {
|
|||||||
LAYOUT
|
LAYOUT
|
||||||
*/
|
*/
|
||||||
/* basic */
|
/* basic */
|
||||||
body {
|
body,
|
||||||
|
html {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column-reverse;
|
flex-direction: column-reverse;
|
||||||
|
|
||||||
@@ -758,12 +765,17 @@ body {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body,
|
||||||
|
.modal {
|
||||||
padding-left: var(--safe-area-left);
|
padding-left: var(--safe-area-left);
|
||||||
padding-right: var(--safe-area-right);
|
padding-right: var(--safe-area-right);
|
||||||
padding-top: var(--safe-area-top);
|
padding-top: var(--safe-area-top);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modal {
|
||||||
|
padding-bottom: var(--safe-area-bottom);
|
||||||
|
}
|
||||||
|
|
||||||
menu {
|
menu {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: var(--menu-height-mobile);
|
height: var(--menu-height-mobile);
|
||||||
|
|||||||
Vendored
+21
@@ -1,3 +1,4 @@
|
|||||||
|
// TABS
|
||||||
document.querySelector("main").addEventListener("scroll", () => {
|
document.querySelector("main").addEventListener("scroll", () => {
|
||||||
const links = document.querySelectorAll(".tab-link");
|
const links = document.querySelectorAll(".tab-link");
|
||||||
links.forEach((element) => element.removeAttribute("active"));
|
links.forEach((element) => element.removeAttribute("active"));
|
||||||
@@ -8,3 +9,23 @@ document.querySelector("main").addEventListener("scroll", () => {
|
|||||||
|
|
||||||
if (links[currentPage]) links[currentPage].setAttribute("active", "");
|
if (links[currentPage]) links[currentPage].setAttribute("active", "");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// SERVICE WORKER
|
||||||
|
async function registerServiceWorker() {
|
||||||
|
if ("serviceWorker" in navigator) {
|
||||||
|
try {
|
||||||
|
const registration = await navigator.serviceWorker.register("/sw.js", {
|
||||||
|
scope: "/",
|
||||||
|
});
|
||||||
|
if (registration.installing) {
|
||||||
|
setTimeout(() => window.location.reload(), 500);
|
||||||
|
} else if (registration.active) {
|
||||||
|
console.log("Service worker active");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Could not install service worker: ${error}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
registerServiceWorker();
|
||||||
|
|||||||
Vendored
+38
@@ -0,0 +1,38 @@
|
|||||||
|
const CACHE_VERSION = "v1";
|
||||||
|
|
||||||
|
async function handleRequest(event) {
|
||||||
|
const responsePromise = getResponse(event);
|
||||||
|
event.respondWith(responsePromise);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getResponse(event) {
|
||||||
|
try {
|
||||||
|
return await fetchAndCache(event);
|
||||||
|
} catch {
|
||||||
|
return await getFromCache(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchAndCache(event) {
|
||||||
|
const request = event.request;
|
||||||
|
|
||||||
|
const response = await fetch(request);
|
||||||
|
|
||||||
|
const cache = await caches.open(CACHE_VERSION);
|
||||||
|
await cache.put(request, response.clone());
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getFromCache(event) {
|
||||||
|
const request = event.request;
|
||||||
|
|
||||||
|
const cache = await caches.open(CACHE_VERSION);
|
||||||
|
const response = await cache.match(request);
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.addEventListener("fetch", (event) => {
|
||||||
|
handleRequest(event);
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user