Skip to content

Commit

Permalink
quran pwa (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
rakaadinugroho authored Jul 19, 2023
1 parent 441e268 commit 2fdf13d
Show file tree
Hide file tree
Showing 16 changed files with 3,703 additions and 173 deletions.
5 changes: 5 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/PowQuranSample.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions ceklist.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1. web
2. manifest
3. service worker
23 changes: 20 additions & 3 deletions dist/js/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
let params = new URLSearchParams(location.search);
const baseUrl = "https://api.quran.gading.dev/surah"

const registerServiceWorker = async () => {
if ('serviceWorker' in window.navigator) {
// register service worker
const registration = await window.navigator.serviceWorker.register("./sw.js")

if (registration.installing) console.log("installing service worker")
else if (registration.waiting) console.log("service worker installed")
else if (registration.active) console.log("service worker active")
} else {
console.log("service worker doesnot support")
}
}

registerServiceWorker()


if (params.get("surat") == null) {
document.location.href = "?surat=1";
Expand All @@ -19,7 +36,7 @@ if (params.get("surat") == null) {
const inputValue = e.target.querySelector("input").value;
let keyword;

fetch("https://api.quran.sutanlab.id/surah")
fetch(baseUrl)
.then((response) => response.json())
.then((response) => {
for (let i = 0; i < response.data.length; i++) {
Expand All @@ -41,7 +58,7 @@ if (params.get("surat") == null) {

const surat = params.get("surat");

fetch("https://api.quran.sutanlab.id/surah/" + surat)
fetch(`${baseUrl}/${surat}`)
.then((response) => response.json())
.then((response) => {
let ayahList = document.querySelector("#ayah-list");
Expand Down Expand Up @@ -73,7 +90,7 @@ if (params.get("surat") == null) {
ayahList.innerHTML = ayah;
});

fetch("https://api.quran.sutanlab.id/surah")
fetch(baseUrl)
.then((response) => response.json())
.then((response) => {
let surahList = document.querySelector("#surah-list");
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<meta name="description" class="web-desc" content="PowQuran adalah Al-Quran online yang bisa di akses di handphone ataupun laptop dengan mudah, mengaji dan dengarkan ayat-ayat suci dimanapun kamu berada!">
<meta name="keywords" content="al-quran, quran, islam, muslim, surah, ayat" />
<link rel="canonical" href="https://abinoval.github.io/PowQuran/">
<link rel="manifest" href="manifest.json">

<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
Expand Down
28 changes: 28 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "Quran Application",
"short_name": "Quran",
"theme_color": "#fff",
"background_color": "#fff",
"display": "standalone",
"orientation": "portrait",
"scope": "/",
"start_url": "/?surat=1",
"description": "Quran Reader Application",
"icons": [{
"src": "src/images/quran512.png",
"sizes": "512x512",
"type": "image/png"
},{
"src": "src/images/quran128.png",
"sizes": "128x128",
"type": "image/png"
},{
"src": "src/images/quran64.png",
"sizes": "64x64",
"type": "image/png"
},{
"src": "src/images/quran48.png",
"sizes": "48x48",
"type": "image/png"
}]
}
10 changes: 10 additions & 0 deletions offline-page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Offline Quran Page</title>
</head>
<body>
<b>Please try with stable connection</b>
</body>
</html>
Loading

0 comments on commit 2fdf13d

Please sign in to comment.