summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.html4
-rw-r--r--src/attribution.html8
-rw-r--r--src/index.html3
-rw-r--r--src/manifest.json12
-rw-r--r--src/scripts/main.js9
-rw-r--r--src/scripts/service-worker.js41
-rw-r--r--src/sura.html3
7 files changed, 80 insertions, 0 deletions
diff --git a/index.html b/index.html
index 7ba2b03..cf8d5c9 100644
--- a/index.html
+++ b/index.html
@@ -2,9 +2,13 @@
<head>
<title>OpenQuran - Redirecting</title>
+ <link rel="manifest" href="src/manifest.json">
</head>
<body>
+ <script src="src/scripts/main.js" defer></script>
+ <script src="src/scripts/service-worker.js" defer></script>
+
<a href="src/">Click here if page doesn't load</a>
<script>
diff --git a/src/attribution.html b/src/attribution.html
index acd936e..bfab016 100644
--- a/src/attribution.html
+++ b/src/attribution.html
@@ -10,11 +10,19 @@
<link href="styles/css/brands.css" rel="stylesheet">
<link href="styles/css/solid.css" rel="stylesheet">
<link rel="icon" href="images/favicon.png">
+ <link rel="manifest" href="manifest.json">
+ <!-- ios support -->
+ <link rel="apple-touch-icon" href="images/favicon.png">
+ <meta name="apple-mobile-web-app-status-bar" content="#f3f3f3">
+ <meta name="theme-color" content="#db4938" />
<title>OpenQuran</title>
</head>
<body onload="load() ">
<script src="scripts/window-buttons.js" defer></script>
+ <script src="scripts/main.js" defer></script>
+ <script src="scripts/service-worker.js" defer></script>
+
<script defer>
function load() {
try {
diff --git a/src/index.html b/src/index.html
index 13a590e..6830dc6 100644
--- a/src/index.html
+++ b/src/index.html
@@ -10,12 +10,15 @@
<link href="styles/css/brands.css" rel="stylesheet">
<link href="styles/css/solid.css" rel="stylesheet">
<link rel="icon" href="images/favicon.png">
+ <link rel="manifest" href="manifest.json">
<title>OpenQuran</title>
</head>
<body onload="load()">
<script src="scripts/window-buttons.js" defer></script>
<script src="scripts/sura-list.js" defer></script>
+ <script src="scripts/main.js" defer></script>
+ <script src="scripts/service-worker.js" defer></script>
<div class="navbar">
<a href="#" style="text-decoration: none;">
diff --git a/src/manifest.json b/src/manifest.json
new file mode 100644
index 0000000..8cfd7b9
--- /dev/null
+++ b/src/manifest.json
@@ -0,0 +1,12 @@
+{
+ "name": "OpenQuran",
+ "display": "standalone",
+ "theme_color": "#F3F3F3",
+ "icons": [
+ {
+ "src": "images/favicon.png",
+ "type": "image/png",
+ "sizes": "1080x1080"
+ }
+ ]
+} \ No newline at end of file
diff --git a/src/scripts/main.js b/src/scripts/main.js
new file mode 100644
index 0000000..e4efee0
--- /dev/null
+++ b/src/scripts/main.js
@@ -0,0 +1,9 @@
+if ("serviceWorker" in navigator) {
+ window.addEventListener("load", function () {
+
+ navigator.serviceWorker
+ .register("scripts/service-worker.js")
+ .then(res => console.log("service worker registered"))
+ .catch(err => console.log("service worker not registered", err))
+ })
+} \ No newline at end of file
diff --git a/src/scripts/service-worker.js b/src/scripts/service-worker.js
new file mode 100644
index 0000000..30b921b
--- /dev/null
+++ b/src/scripts/service-worker.js
@@ -0,0 +1,41 @@
+const staticQuran = "quran-all";
+const assets = [
+ "/",
+ "/index.html",
+ "/src/index.html",
+ "/src/sura.html",
+ "/src/attribution.html",
+ "/src/styles/style.css",
+ "/src/styles/css/all.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",
+];
+
+self.addEventListener("install", installEvent => {
+ installEvent.waitUntil(
+ caches.open(staticQuran).then(cache => {
+ cache.addAll(assets)
+ console.log(assets)
+ })
+ )
+})
+
+self.addEventListener("fetch", fetchEvent => {
+ fetchEvent.respondWith(
+ caches.match(fetchEvent.request).then(res => {
+ return res || fetch(fetchEvent.request)
+ })
+ )
+}) \ No newline at end of file
diff --git a/src/sura.html b/src/sura.html
index eae5b2d..c9ddd3b 100644
--- a/src/sura.html
+++ b/src/sura.html
@@ -10,11 +10,14 @@
<link href="styles/css/brands.css" rel="stylesheet">
<link href="styles/css/solid.css" rel="stylesheet">
<link rel="icon" href="images/favicon.png">
+ <link rel="manifest" href="manifest.json">
<title>OpenQuran</title>
</head>
<body onload="quranOnLoad()">
<script src="scripts/window-buttons.js" defer></script>
+ <script src="scripts/main.js" defer></script>
+ <script src="scripts/service-worker.js" defer></script>
<div class="navbar">
<a href="./" style="text-decoration: none;" id="openquran-link">