summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraltaf-creator <64111012+altaf-creator@users.noreply.github.com>2023-05-04 19:46:05 +0700
committeraltaf-creator <64111012+altaf-creator@users.noreply.github.com>2023-05-04 19:46:05 +0700
commite3eaf62842087028e54c1a6008c8dfa7b3f45f14 (patch)
tree514a070a933903c97e0dc3d31d679d4b066589ee
parentc0e8971309f57d10abecc33074b5bc5cc1e348bd (diff)
PWA Update - attempt 3.2
-rw-r--r--src/scripts/main.js45
-rw-r--r--src/scripts/service-worker.js43
2 files changed, 43 insertions, 45 deletions
diff --git a/src/scripts/main.js b/src/scripts/main.js
index 24fc769..becd684 100644
--- a/src/scripts/main.js
+++ b/src/scripts/main.js
@@ -1,34 +1,31 @@
-
const assets = [
- "/",
- "/sura.html",
- "/src/index.html",
- "/src/sura.html",
- "/src/attribution.html",
- "/src/styles/style.css",
- "/src/styles/css/fontawesome.css",
- "/src/styles/css/brands.css",
- "/src/styles/css/solid.css",
- "/src/styles/webfonts/fa-brands-400.ttf",
- "/src/styles/webfonts/fa-brands-400.woff2",
- "/src/styles/webfonts/fa-solid-900.ttf",
- "/src/styles/webfonts/fa-solid-900.woff2",
- "/src/styles/css/solid.css",
- "/src/data/en.sahih.xml",
- "/src/data/id.indonesian.xml",
- "/src/data/quran-data.xml",
- "/src/data/quran-uthmani.xml",
- "/src/scripts/main.js",
- "/src/scripts/quran.js",
- "/src/scripts/sura-list.js",
+ "../../",
+ "../../index.html",
+ "../src/index.html",
+ "../src/sura.html",
+ "../src/attribution.html",
+ "../src/styles/style.css",
+ "../src/styles/css/fontawesome.css",
+ "../src/styles/css/brands.css",
+ "../src/styles/css/solid.css",
+ "../src/styles/webfonts/fa-brands-400.ttf",
+ "../src/styles/webfonts/fa-brands-400.woff2",
+ "../src/styles/webfonts/fa-solid-900.ttf",
+ "../src/styles/webfonts/fa-solid-900.woff2",
+ "../src/styles/css/solid.css",
+ "../src/data/en.sahih.xml",
+ "../src/data/id.indonesian.xml",
+ "../src/data/quran-data.xml",
+ "../src/data/quran-uthmani.xml",
+ "main.js",
+ "quran.js",
+ "sura-list.js",
];
function urlExists(url) {
- console.log(url);
var http = new XMLHttpRequest();
http.open('HEAD', url, false);
http.send();
- console.log(http.status)
return http.status != 404;
}
if ("serviceWorker" in navigator) {
diff --git a/src/scripts/service-worker.js b/src/scripts/service-worker.js
index 22d8452..6e8f8db 100644
--- a/src/scripts/service-worker.js
+++ b/src/scripts/service-worker.js
@@ -1,27 +1,28 @@
const staticQuran = "quran-all";
const assets = [
- "/",
- "/index.html",
- "/src/index.html",
- "/src/sura.html",
- "/src/attribution.html",
- "/src/styles/style.css",
- "/src/styles/css/fontawesome.css",
- "/src/styles/css/brands.css",
- "/src/styles/css/solid.css",
- "/src/styles/webfonts/fa-brands-400.ttf",
- "/src/styles/webfonts/fa-brands-400.woff2",
- "/src/styles/webfonts/fa-solid-900.ttf",
- "/src/styles/webfonts/fa-solid-900.woff2",
- "/src/styles/css/solid.css",
- "/src/data/en.sahih.xml",
- "/src/data/id.indonesian.xml",
- "/src/data/quran-data.xml",
- "/src/data/quran-uthmani.xml",
- "/src/scripts/main.js",
- "/src/scripts/quran.js",
- "/src/scripts/sura-list.js",
+ "../../",
+ "../../index.html",
+ "../src/index.html",
+ "../src/sura.html",
+ "../src/attribution.html",
+ "../src/styles/style.css",
+ "../src/styles/css/fontawesome.css",
+ "../src/styles/css/brands.css",
+ "../src/styles/css/solid.css",
+ "../src/styles/webfonts/fa-brands-400.ttf",
+ "../src/styles/webfonts/fa-brands-400.woff2",
+ "../src/styles/webfonts/fa-solid-900.ttf",
+ "../src/styles/webfonts/fa-solid-900.woff2",
+ "../src/styles/css/solid.css",
+ "../src/data/en.sahih.xml",
+ "../src/data/id.indonesian.xml",
+ "../src/data/quran-data.xml",
+ "../src/data/quran-uthmani.xml",
+ "main.js",
+ "quran.js",
+ "sura-list.js",
];
+
self.addEventListener("install", installEvent => {
installEvent.waitUntil(
caches.open(staticQuran).then(cache => {