diff --git a/config.xml b/config.xml index 3141d3a..687330a 100644 --- a/config.xml +++ b/config.xml @@ -1,5 +1,5 @@ - التقوى @@ -13,7 +13,7 @@ - + diff --git a/package.json b/package.json index 57df83c..573e0e4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "com.rn0x.altaqwaa", "displayName": "التقوى", - "version": "1.0.1", + "version": "1.1.0", "description": "تطبيق إسلامي سهل الإستخدام و جامع للكثير من الميزات التي يحتاجها المسلم في يومه", "main": "index.js", "scripts": { @@ -10,7 +10,7 @@ "build": "cordova build android --release", "bundle": "cordova build android --release -- --packageTypjetifiere=bundle", "android": "cordova platform add android@latest", - "clear": "cordova platforms rm android && npm cache clean --force && cordova platform add android@latest", + "clear": "rm -rf ./node_modules && cordova platforms rm android && npm cache clean --force && npm i && cordova platform add android@latest", "keytool": "keytool -genkey -v -keystore ./debug.keystore -alias 'rn0x' -storepass '11223344' -keypass '11223344' -keyalg RSA -keysize 2048 -dname 'CN=rn0x, OU=altaqwaa, O=altaqwaa, L=makkah, ST=makkah, C=sa'" }, "author": { diff --git a/screenshots/1.jpg b/screenshots/1.jpg index fa7df3d..91f25d3 100644 Binary files a/screenshots/1.jpg and b/screenshots/1.jpg differ diff --git a/screenshots/12.jpg b/screenshots/12.jpg index c560d4d..987492b 100644 Binary files a/screenshots/12.jpg and b/screenshots/12.jpg differ diff --git a/screenshots/2.jpg b/screenshots/2.jpg index 358c9fc..edc62f1 100644 Binary files a/screenshots/2.jpg and b/screenshots/2.jpg differ diff --git a/www/css/adhkar.css b/www/css/adhkar.css index 244953c..9b9cb8b 100644 --- a/www/css/adhkar.css +++ b/www/css/adhkar.css @@ -1,7 +1,7 @@ #adhkar { background-color: var(--background_div_hover) !important; transition: 0.5s ease-in-out; - box-shadow: 5px 0px 15px 0px #00000048; + box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset; } @@ -33,7 +33,7 @@ /* width: 110px; */ background-color: var(--background_div_hover); transition: 0.5s ease-in-out; - box-shadow: 5px 0px 15px 0px #00000048; + box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset; } #adhkar_ul img { @@ -62,7 +62,6 @@ margin-left: auto; margin-bottom: 20px; /* user-select: text; */ - box-shadow: #32325d40 0px 6px 12px -2px, #0000004d 0px 3px 7px -3px; } #adhkar_random_title { @@ -137,15 +136,15 @@ border-radius: 15px; margin-right: auto; margin-left: auto; - box-shadow: #32325d40 0px 6px 12px -2px, #0000004d 0px 3px 7px -3px; } .adhkar:nth-child(1) { margin-top: 50px; } -.adhkar:hover { +/* .adhkar:hover { background-color: var(--background_div_hover); + box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset; } @@ -154,7 +153,6 @@ } .adhkar:hover .repetition { - /* background-color: var(--background_div_hover); */ color: var(--green); } @@ -164,7 +162,7 @@ .adhkar:hover .text_bottom { color: var(--green); -} +} */ .text_bottom { margin-bottom: 8px; @@ -245,6 +243,31 @@ z-index: -1; } +#adhkar_database { + + display: block; + align-items: center; + list-style: none; + padding: 0px; + +} + +#adhkar_database li { + width: 80%; + background-color: var(--background_div_hover); + padding: 5px; + border-radius: 10px; + color: var(--green); + margin-left: auto; + margin-right: auto; + font-weight: 500; + box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset; +} + +#adhkar_database span { + font-weight:900; +} + /* @media (max-width: 330px) { #adhkar_ul li { width: 85%; diff --git a/www/css/albitaqat.css b/www/css/albitaqat.css index 95dacee..2723dba 100644 --- a/www/css/albitaqat.css +++ b/www/css/albitaqat.css @@ -61,6 +61,7 @@ #albitaqat_index li:hover { background-color: var(--background_div_hover); transition: 0.5s ease-in-out; + box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset; } #albitaqat_index li:hover p{ diff --git a/www/css/allah.css b/www/css/allah.css index ab996d9..668d32e 100644 --- a/www/css/allah.css +++ b/www/css/allah.css @@ -23,7 +23,7 @@ #allah_names li:hover { background-color: var(--background_div_hover); transition: 0.5s ease-in-out; - box-shadow: rgba(0, 0, 0, 0.616) 0px 25px 20px -20px; + box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset; } #allah_names li:hover h3{ diff --git a/www/css/footer.css b/www/css/footer.css index e731bad..3346607 100644 --- a/www/css/footer.css +++ b/www/css/footer.css @@ -38,7 +38,7 @@ background-color: var(--background_div_hover); transition: 0.5s ease-in-out; - box-shadow: 5px 0px 15px 0px #00000048; + box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset; } .menu_footer_icon { diff --git a/www/css/hisnmuslim.css b/www/css/hisnmuslim.css index 51e71d8..5ab63d2 100644 --- a/www/css/hisnmuslim.css +++ b/www/css/hisnmuslim.css @@ -128,7 +128,7 @@ background-color: var(--background_div_hover); left: 0px; margin-top: -10px; - margin-left: 20px; + margin-left: 5%; border-radius: 7px; color: var(--green); diff --git a/www/css/images.css b/www/css/images.css index f0338d2..b296c48 100644 --- a/www/css/images.css +++ b/www/css/images.css @@ -29,8 +29,8 @@ width: 90%; height: 300px; object-fit: contain; - margin-top: 10px; - margin-bottom: 0px; + margin-top: 20px; + margin-bottom: 10px; } .images_download { @@ -38,6 +38,7 @@ position: absolute; left: 10px; margin-top: -23px; + margin-left: 8%; transition: 0.5s ease-in-out; } diff --git a/www/css/more.css b/www/css/more.css index d302400..319bcc8 100644 --- a/www/css/more.css +++ b/www/css/more.css @@ -1,7 +1,7 @@ #more { background-color: var(--background_div_hover) !important; transition: 0.5s ease-in-out; - box-shadow: 5px 0px 15px 0px #00000048; + box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset; } #content { @@ -30,7 +30,7 @@ #more_ul li:hover { transition: 0.5s ease-in-out; background-color: var(--background_div_hover); - box-shadow: 5px 0px 10px 0px #00000048; + box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset; } /* #more_ul li:hover .more_title { diff --git a/www/css/prayer.css b/www/css/prayer.css index 345edc4..00e9cd2 100644 --- a/www/css/prayer.css +++ b/www/css/prayer.css @@ -1,7 +1,7 @@ #prayer { background-color: var(--background_div_hover) !important; transition: 0.5s ease-in-out; - box-shadow: 5px 0px 15px 0px #00000048; + box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset; } #content { @@ -108,7 +108,7 @@ background-color: var(--background_div_hover); padding: 5px; transition: 0.5s ease-in-out; - box-shadow: 5px 15px 15px 0px #00000048; + box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset; } #prayer_ul li:hover .slah { @@ -139,7 +139,7 @@ margin-top: auto; margin-left: auto; margin-right: auto; - box-shadow: 5px 15px 15px 0px #0000001c; + box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset; transition: 0.5s ease-in-out; } diff --git a/www/css/quran.css b/www/css/quran.css index 93e028c..45095c9 100644 --- a/www/css/quran.css +++ b/www/css/quran.css @@ -1,7 +1,7 @@ #quran { background-color: var(--background_div_hover) !important; transition: 0.5s ease-in-out; - box-shadow: 5px 0px 15px 0px #00000048; + box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset; } #content { @@ -56,7 +56,7 @@ .quran_reader li:hover { transition: 0.5s ease-in-out; background-color: var(--background_div_hover); - box-shadow: 5px 0px 10px 0px #00000048; + box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset; } .quran_reader_div { @@ -144,8 +144,8 @@ width: 90%; margin-left: auto; margin-right: auto; - margin-top: 5px; - margin-bottom: 5px; + margin-top: 8px; + margin-bottom: 8px; background-color: var(--background_div); padding: 5px; border-radius: 8px; @@ -153,7 +153,7 @@ .quran_reader_surah li:hover { background-color: var(--background_div_hover); - box-shadow: 5px 0px 10px 0px #00000048; + box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset; } .quran_reader_surah h3 { diff --git a/www/css/radio.css b/www/css/radio.css index 247d906..e8d3ccc 100644 --- a/www/css/radio.css +++ b/www/css/radio.css @@ -29,6 +29,7 @@ #radio_quran li:hover { transition: 0.5s ease-in-out; background-color: var(--background_div_hover); + box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset; } #radio_quran li:hover .radio_quran_number{ transition: 0.5s ease-in-out; diff --git a/www/css/tfs.css b/www/css/tfs.css index 1e8c2b9..b8162fe 100644 --- a/www/css/tfs.css +++ b/www/css/tfs.css @@ -34,6 +34,7 @@ #tfs li:hover { transition: 0.5s ease-in-out; background-color: var(--background_div_hover); + box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset; } #tfs li:hover p{ @@ -82,7 +83,7 @@ #tfs_ayat li:hover { transition: 0.5s ease-in-out; background-color: var(--background_div_hover); - box-shadow: 0px 6px 10px 0px #00000063; + box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset; } #tfs_ayat li:hover .tfs_id{ diff --git a/www/error.html b/www/error.html new file mode 100644 index 0000000..7858271 --- /dev/null +++ b/www/error.html @@ -0,0 +1,16 @@ + + + + + + + Document + + + +

+ Error 404 +

+ + + \ No newline at end of file diff --git a/www/index.html b/www/index.html index 462d5ae..236f0a3 100644 --- a/www/index.html +++ b/www/index.html @@ -68,6 +68,14 @@ +
    + +
  • + عدد التكرارات : 0 +
  • + +
+
diff --git a/www/js/adhkar.js b/www/js/adhkar.js index f16e177..f19efec 100644 --- a/www/js/adhkar.js +++ b/www/js/adhkar.js @@ -1,124 +1,156 @@ +import error_handling from './modules/error_handling.js'; import loadJson from './modules/loadJson.js'; export default async () => { if (window.location.pathname === '/index.html') { + try { - let adhkarJson = await loadJson('/data/adhkar.json'); - let adhkar_random_text = document.getElementById('adhkar_random_text'); - let adhkar_random_description = document.getElementById('adhkar_random_description'); - let adhkar_random_reference = document.getElementById('adhkar_random_reference'); - let adhkar_random_copy = document.getElementById('adhkar_random_copy'); - let adhkar_random_bt = document.getElementById('adhkar_random_bt'); - let alert = document.getElementById('alert'); - let adhkar_random = adhkarJson[Math.floor(Math.random() * adhkarJson.length)]; - - adhkar_random_text.innerText = adhkar_random?.zekr; - adhkar_random_description.innerText = adhkar_random?.description; - adhkar_random_reference.innerText = adhkar_random?.reference; - - // random button - adhkar_random_bt.addEventListener("click", (e) => { + let adhkarJson = await loadJson('/data/adhkar.json'); + let adhkar_random_text = document.getElementById('adhkar_random_text'); + let adhkar_random_description = document.getElementById('adhkar_random_description'); + let adhkar_random_reference = document.getElementById('adhkar_random_reference'); + let adhkar_random_copy = document.getElementById('adhkar_random_copy'); + let adhkar_random_bt = document.getElementById('adhkar_random_bt'); + let alert = document.getElementById('alert'); let adhkar_random = adhkarJson[Math.floor(Math.random() * adhkarJson.length)]; + let storage = window.localStorage; + let adhkar_database = storage.getItem('adhkar_database'); + let adhkar_database_number = document.getElementById("adhkar_database_number"); + + adhkar_database_number.innerText = adhkar_database ? adhkar_database : 0; adhkar_random_text.innerText = adhkar_random?.zekr; adhkar_random_description.innerText = adhkar_random?.description; adhkar_random_reference.innerText = adhkar_random?.reference; - }); - // copy button - adhkar_random_copy.addEventListener("click", (e) => { + // random button + adhkar_random_bt.addEventListener("click", (e) => { + let adhkar_random = adhkarJson[Math.floor(Math.random() * adhkarJson.length)]; + adhkar_random_text.innerText = adhkar_random?.zekr; + adhkar_random_description.innerText = adhkar_random?.description; + adhkar_random_reference.innerText = adhkar_random?.reference; + }); - let text = `${adhkar_random_text.innerText}` - text += adhkar_random_description.innerText !== '' ? `\n\n${adhkar_random_description.innerText}` : adhkar_random_description.innerText; - text += adhkar_random_reference.innerText !== '' ? `\n\n${adhkar_random_reference.innerText}` : adhkar_random_description.innerText; - cordova.plugins.clipboard.copy(text); + // copy button + adhkar_random_copy.addEventListener("click", (e) => { - alert.style.display = "block" - setTimeout(() => { - alert.style.display = 'none' - }, 1000); + let text = `${adhkar_random_text.innerText}` + text += adhkar_random_description.innerText !== '' ? `\n\n${adhkar_random_description.innerText}` : adhkar_random_description.innerText; + text += adhkar_random_reference.innerText !== '' ? `\n\n${adhkar_random_reference.innerText}` : adhkar_random_description.innerText; + cordova.plugins.clipboard.copy(text); - }); + alert.style.display = "block" + setTimeout(() => { + alert.style.display = 'none' + }, 1000); + }); - // pages adhkar - let morning = document.getElementById('morning'); - let evening = document.getElementById('evening'); - let sleeping = document.getElementById('sleeping'); - let food = document.getElementById('food'); - let prayers = document.getElementById('prayers'); - let tasbih = document.getElementById('tasbih'); - morning.addEventListener('click', e => window.location.href = '/pages/adhkar/morning.html'); - evening.addEventListener('click', e => window.location.href = '/pages/adhkar/evening.html'); - sleeping.addEventListener('click', e => window.location.href = '/pages/adhkar/sleeping.html'); - food.addEventListener('click', e => window.location.href = '/pages/adhkar/food.html'); - prayers.addEventListener('click', e => window.location.href = '/pages/adhkar/prayer.html'); - tasbih.addEventListener('click', e => window.location.href = '/pages/adhkar/tasbih.html'); + // pages adhkar + let morning = document.getElementById('morning'); + let evening = document.getElementById('evening'); + let sleeping = document.getElementById('sleeping'); + let food = document.getElementById('food'); + let prayers = document.getElementById('prayers'); + let tasbih = document.getElementById('tasbih'); + morning.addEventListener('click', e => window.location.href = '/pages/adhkar/morning.html'); + evening.addEventListener('click', e => window.location.href = '/pages/adhkar/evening.html'); + sleeping.addEventListener('click', e => window.location.href = '/pages/adhkar/sleeping.html'); + food.addEventListener('click', e => window.location.href = '/pages/adhkar/food.html'); + prayers.addEventListener('click', e => window.location.href = '/pages/adhkar/prayer.html'); + tasbih.addEventListener('click', e => window.location.href = '/pages/adhkar/tasbih.html'); - // حدث زر الرجوع للخلف - document.addEventListener("backbutton", function (e) { + // حدث زر الرجوع للخلف - let storage = window.localStorage; - storage.removeItem('audioPlayingId'); - storage.removeItem('icon_audio'); - storage.removeItem('AdhanPlaying'); + document.addEventListener("backbutton", function (e) { - navigator.notification.confirm( - 'هل بالفعل تريد الخروج من التطبيق ؟', // message - (e) => { + let storage = window.localStorage; + storage.removeItem('audioPlayingId'); + storage.removeItem('icon_audio'); + storage.removeItem('AdhanPlaying'); - if (e === 2 || e === 0) { + navigator.notification.confirm( + 'هل بالفعل تريد الخروج من التطبيق ؟', // message + (e) => { - if (navigator.app) { - navigator.app.exitApp(); - } + if (e === 2) { - else if (navigator.device) { - navigator.device.exitApp(); - } + if (navigator.app) { + navigator.app.exitApp(); + } - else { - window.close(); - } + else if (navigator.device) { + navigator.device.exitApp(); + } - } + else { + window.close(); + } - else { - window.open("https://github.com/Alsarmad/altaqwaa_android", "_blank"); - } - }, // callback - 'خروج', // title - ['تقييم التطبيق', 'خروج'] // buttonName - ); + } + + else if (e === 1) { + window.open("https://play.google.com/store/apps/details?id=com.rn0x.altaqwaa", "_blank"); + } + }, // callback + 'خروج', // title + ['تقييم التطبيق', 'خروج'] // buttonName + ); + }, false); + } catch (error) { - }, false); + error_handling(error); + } } // حدث عدد تكرار الذكر if (document.getElementsByClassName("adhkar")[0]) { + let storage = window.localStorage; let adhkar = Array.from(document.getElementsByClassName("adhkar")); let numbers = []; for (let item of adhkar) { + let adhkarEl = document.getElementById(item.id); let numEl = document.querySelector(`[id='${item.id}'] > .copy_and_paste > .repetition > .repetition_number`).textContent numbers.push(numEl); adhkarEl.addEventListener("click", (e) => { + let adhkar_database = storage.getItem('adhkar_database'); let numberEl = document.querySelector(`[id='${item.id}'] > .copy_and_paste > .repetition > .repetition_number`) if (Number(numberEl.textContent) > 0) { - numberEl.innerText = Number(numberEl.textContent) - 1 + + numberEl.innerText = Number(numberEl.textContent) - 1; + storage.setItem("adhkar_database", Number(adhkar_database ? adhkar_database : 0) + 1); + + if (Number(numberEl.textContent) === 0) { + + let div = document.querySelector(`[id='${item.id}']`); + let copy_and_paste = document.querySelector(`[id='${item.id}'] > .copy_and_paste`); + let repetition = document.querySelector(`[id='${item.id}'] > .copy_and_paste > .repetition`); + let repetition_number = document.querySelector(`[id='${item.id}'] > .copy_and_paste > .repetition > .repetition_number`); + let text_bottom = document.querySelector(`[id='${item.id}'] > .text_bottom`); + div.style.backgroundColor = "var(--background_div_hover)"; + div.style.boxShadow = 'rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset' + copy_and_paste.style.backgroundColor = "var(--background_div_hover_2)"; + repetition.style.color = "var(--green)"; + repetition_number.style.color = "var(--white-div)"; + text_bottom.style.color = "var(--green)"; + + } } + else { if (Number(numberEl.textContent) > 0) { - numberEl.innerText = numbers[Number(item.id - 1)] + numberEl.innerText = numbers[Number(item.id - 1)]; + storage.setItem("adhkar_database", Number(adhkar_database ? adhkar_database : 0) + 1); } } }); diff --git a/www/js/albitaqat.js b/www/js/albitaqat.js index 3180919..cb0c182 100644 --- a/www/js/albitaqat.js +++ b/www/js/albitaqat.js @@ -1,158 +1,168 @@ import loadJson from './modules/loadJson.js'; import filterSpan from './modules/filterSpan.js'; +import error_handling from './modules/error_handling.js'; export default async () => { + if (window.location.pathname === '/pages/albitaqat.html') { - let albitaqatJson = await loadJson("/data/albitaqat.json"); - let quranJson = await loadJson("/data/quran.json"); - let back = document.getElementById('back'); - let more_header_title = document.getElementById('more_header_title'); - let albitaqat_part1 = document.getElementById("albitaqat_part1"); - let albitaqat_part2 = document.getElementById("albitaqat_part2"); - let albitaqat_index = document.getElementById("albitaqat_index"); - let albitaqat_data = document.getElementById("albitaqat_data"); - let albitaqat_audio = document.getElementById("albitaqat_audio"); - - back.addEventListener("click", e => { - window.location.href = "/more.html"; - }); - - for (let item of albitaqatJson) { - - let li = document.createElement("li"); - let h3 = document.createElement("h3"); - let p = document.createElement("p"); - - albitaqat_index.appendChild(li); - li.id = `albitaqat_index_li_id_${item?.id}`; - li.className = "albitaqat_index_li"; - li.appendChild(h3); - h3.innerText = item?.surah; - li.appendChild(p); - p.innerText = quranJson?.[item?.id - 1]?.descent; - } + try { - let albitaqat_index_li = document.getElementsByClassName("albitaqat_index_li"); - - for (let item of Array.from(albitaqat_index_li)) { - - let surah = document.getElementById(item.id); - - surah.addEventListener("click", e => { - - window.scrollTo(0, 0); - let id = item.id.split("albitaqat_index_li_id_")[1] - 1 - albitaqatJson = albitaqatJson?.[id] - albitaqat_part1.style.display = "none"; - albitaqat_part2.style.display = "block"; - more_header_title.innerText = `بطاقة سورة ${albitaqatJson?.surah}`; - albitaqat_audio.src = albitaqatJson?.audio; - - let ayaatiha = document.createElement("li"); - let ayaatiha_title = document.createElement("h3"); - let ayaatiha_text = document.createElement("p"); - - albitaqat_data.appendChild(ayaatiha); - ayaatiha.appendChild(ayaatiha_title); - ayaatiha_title.innerText = "أياتها"; - ayaatiha_title.className = "albitaqat_data_title"; - ayaatiha.appendChild(ayaatiha_text); - ayaatiha_text.className = "albitaqat_data_text"; - ayaatiha_text.innerHTML = filterSpan(albitaqatJson?.ayaatiha) - - let maeni_asamuha = document.createElement("li"); - let maeni_asamuha_title = document.createElement("h3"); - let maeni_asamuha_text = document.createElement("p"); - - albitaqat_data.appendChild(maeni_asamuha); - maeni_asamuha.appendChild(maeni_asamuha_title); - maeni_asamuha_title.innerText = "معني أسمها"; - maeni_asamuha_title.className = "albitaqat_data_title"; - maeni_asamuha.appendChild(maeni_asamuha_text); - maeni_asamuha_text.className = "albitaqat_data_text"; - maeni_asamuha_text.innerHTML = filterSpan(albitaqatJson?.maeni_asamuha); - - let sabab_tasmiatiha = document.createElement("li"); - let sabab_tasmiatiha_title = document.createElement("h3"); - let sabab_tasmiatiha_text = document.createElement("p"); - - albitaqat_data.appendChild(sabab_tasmiatiha); - sabab_tasmiatiha.appendChild(sabab_tasmiatiha_title); - sabab_tasmiatiha_title.innerText = "سبب تسميتها"; - sabab_tasmiatiha_title.className = "albitaqat_data_title"; - sabab_tasmiatiha.appendChild(sabab_tasmiatiha_text); - sabab_tasmiatiha_text.className = "albitaqat_data_text"; - sabab_tasmiatiha_text.innerHTML = filterSpan(albitaqatJson?.sabab_tasmiatiha); - - let asmawuha = document.createElement("li"); - let asmawuha_title = document.createElement("h3"); - let asmawuha_text = document.createElement("p"); - - albitaqat_data.appendChild(asmawuha); - asmawuha.appendChild(asmawuha_title); - asmawuha_title.innerText = "أسماؤها"; - asmawuha_title.className = "albitaqat_data_title"; - asmawuha.appendChild(asmawuha_text); - asmawuha_text.className = "albitaqat_data_text"; - asmawuha_text.innerHTML = filterSpan(albitaqatJson?.asmawuha); - - let maqsiduha_aleamu = document.createElement("li"); - let maqsiduha_aleamu_title = document.createElement("h3"); - let maqsiduha_aleamu_text = document.createElement("p"); - - albitaqat_data.appendChild(maqsiduha_aleamu); - maqsiduha_aleamu.appendChild(maqsiduha_aleamu_title); - maqsiduha_aleamu_title.innerText = "مقصدها العام"; - maqsiduha_aleamu_title.className = "albitaqat_data_title"; - maqsiduha_aleamu.appendChild(maqsiduha_aleamu_text); - maqsiduha_aleamu_text.className = "albitaqat_data_text"; - maqsiduha_aleamu_text.innerHTML = filterSpan(albitaqatJson?.maqsiduha_aleamu); - - let sabab_nuzuliha = document.createElement("li"); - let sabab_nuzuliha_title = document.createElement("h3"); - let sabab_nuzuliha_text = document.createElement("p"); - - albitaqat_data.appendChild(sabab_nuzuliha); - sabab_nuzuliha.appendChild(sabab_nuzuliha_title); - sabab_nuzuliha_title.innerText = "سبب نزولها"; - sabab_nuzuliha_title.className = "albitaqat_data_title"; - sabab_nuzuliha.appendChild(sabab_nuzuliha_text); - sabab_nuzuliha_text.className = "albitaqat_data_text"; - sabab_nuzuliha_text.innerHTML = filterSpan(albitaqatJson?.sabab_nuzuliha); - - let fadluha = document.createElement("li"); - let fadluha_title = document.createElement("h3"); - let fadluha_text = document.createElement("p"); - - albitaqat_data.appendChild(fadluha); - fadluha.appendChild(fadluha_title); - fadluha_title.innerText = "فضلها"; - fadluha_title.className = "albitaqat_data_title"; - fadluha.appendChild(fadluha_text); - fadluha_text.className = "albitaqat_data_text"; - fadluha_text.innerHTML = filterSpan(albitaqatJson?.fadluha?.join("

")); - - let munasabatiha = document.createElement("li"); - let munasabatiha_title = document.createElement("h3"); - let munasabatiha_text = document.createElement("p"); - - albitaqat_data.appendChild(munasabatiha); - munasabatiha.appendChild(munasabatiha_title); - munasabatiha_title.innerText = "مناسباتها"; - munasabatiha_title.className = "albitaqat_data_title"; - munasabatiha.appendChild(munasabatiha_text); - munasabatiha_text.className = "albitaqat_data_text"; - munasabatiha_text.innerHTML = filterSpan(albitaqatJson?.munasabatiha?.join("

")); - - back.addEventListener("click", e => { - window.location.href = "/pages/albitaqat.html"; - }); + let albitaqatJson = await loadJson("/data/albitaqat.json"); + let quranJson = await loadJson("/data/quran.json"); + let back = document.getElementById('back'); + let more_header_title = document.getElementById('more_header_title'); + let albitaqat_part1 = document.getElementById("albitaqat_part1"); + let albitaqat_part2 = document.getElementById("albitaqat_part2"); + let albitaqat_index = document.getElementById("albitaqat_index"); + let albitaqat_data = document.getElementById("albitaqat_data"); + let albitaqat_audio = document.getElementById("albitaqat_audio"); + back.addEventListener("click", e => { + window.location.href = "/more.html"; }); + for (let item of albitaqatJson) { + + let li = document.createElement("li"); + let h3 = document.createElement("h3"); + let p = document.createElement("p"); + + albitaqat_index.appendChild(li); + li.id = `albitaqat_index_li_id_${item?.id}`; + li.className = "albitaqat_index_li"; + li.appendChild(h3); + h3.innerText = item?.surah; + li.appendChild(p); + p.innerText = quranJson?.[item?.id - 1]?.descent; + } + + let albitaqat_index_li = document.getElementsByClassName("albitaqat_index_li"); + + for (let item of Array.from(albitaqat_index_li)) { + + let surah = document.getElementById(item.id); + + surah.addEventListener("click", e => { + + window.scrollTo(0, 0); + let id = item.id.split("albitaqat_index_li_id_")[1] - 1 + albitaqatJson = albitaqatJson?.[id] + albitaqat_part1.style.display = "none"; + albitaqat_part2.style.display = "block"; + more_header_title.innerText = `بطاقة سورة ${albitaqatJson?.surah}`; + albitaqat_audio.src = albitaqatJson?.audio; + + let ayaatiha = document.createElement("li"); + let ayaatiha_title = document.createElement("h3"); + let ayaatiha_text = document.createElement("p"); + + albitaqat_data.appendChild(ayaatiha); + ayaatiha.appendChild(ayaatiha_title); + ayaatiha_title.innerText = "أياتها"; + ayaatiha_title.className = "albitaqat_data_title"; + ayaatiha.appendChild(ayaatiha_text); + ayaatiha_text.className = "albitaqat_data_text"; + ayaatiha_text.innerHTML = filterSpan(albitaqatJson?.ayaatiha) + + let maeni_asamuha = document.createElement("li"); + let maeni_asamuha_title = document.createElement("h3"); + let maeni_asamuha_text = document.createElement("p"); + + albitaqat_data.appendChild(maeni_asamuha); + maeni_asamuha.appendChild(maeni_asamuha_title); + maeni_asamuha_title.innerText = "معني أسمها"; + maeni_asamuha_title.className = "albitaqat_data_title"; + maeni_asamuha.appendChild(maeni_asamuha_text); + maeni_asamuha_text.className = "albitaqat_data_text"; + maeni_asamuha_text.innerHTML = filterSpan(albitaqatJson?.maeni_asamuha); + + let sabab_tasmiatiha = document.createElement("li"); + let sabab_tasmiatiha_title = document.createElement("h3"); + let sabab_tasmiatiha_text = document.createElement("p"); + + albitaqat_data.appendChild(sabab_tasmiatiha); + sabab_tasmiatiha.appendChild(sabab_tasmiatiha_title); + sabab_tasmiatiha_title.innerText = "سبب تسميتها"; + sabab_tasmiatiha_title.className = "albitaqat_data_title"; + sabab_tasmiatiha.appendChild(sabab_tasmiatiha_text); + sabab_tasmiatiha_text.className = "albitaqat_data_text"; + sabab_tasmiatiha_text.innerHTML = filterSpan(albitaqatJson?.sabab_tasmiatiha); + + let asmawuha = document.createElement("li"); + let asmawuha_title = document.createElement("h3"); + let asmawuha_text = document.createElement("p"); + + albitaqat_data.appendChild(asmawuha); + asmawuha.appendChild(asmawuha_title); + asmawuha_title.innerText = "أسماؤها"; + asmawuha_title.className = "albitaqat_data_title"; + asmawuha.appendChild(asmawuha_text); + asmawuha_text.className = "albitaqat_data_text"; + asmawuha_text.innerHTML = filterSpan(albitaqatJson?.asmawuha); + + let maqsiduha_aleamu = document.createElement("li"); + let maqsiduha_aleamu_title = document.createElement("h3"); + let maqsiduha_aleamu_text = document.createElement("p"); + + albitaqat_data.appendChild(maqsiduha_aleamu); + maqsiduha_aleamu.appendChild(maqsiduha_aleamu_title); + maqsiduha_aleamu_title.innerText = "مقصدها العام"; + maqsiduha_aleamu_title.className = "albitaqat_data_title"; + maqsiduha_aleamu.appendChild(maqsiduha_aleamu_text); + maqsiduha_aleamu_text.className = "albitaqat_data_text"; + maqsiduha_aleamu_text.innerHTML = filterSpan(albitaqatJson?.maqsiduha_aleamu); + + let sabab_nuzuliha = document.createElement("li"); + let sabab_nuzuliha_title = document.createElement("h3"); + let sabab_nuzuliha_text = document.createElement("p"); + + albitaqat_data.appendChild(sabab_nuzuliha); + sabab_nuzuliha.appendChild(sabab_nuzuliha_title); + sabab_nuzuliha_title.innerText = "سبب نزولها"; + sabab_nuzuliha_title.className = "albitaqat_data_title"; + sabab_nuzuliha.appendChild(sabab_nuzuliha_text); + sabab_nuzuliha_text.className = "albitaqat_data_text"; + sabab_nuzuliha_text.innerHTML = filterSpan(albitaqatJson?.sabab_nuzuliha); + + let fadluha = document.createElement("li"); + let fadluha_title = document.createElement("h3"); + let fadluha_text = document.createElement("p"); + + albitaqat_data.appendChild(fadluha); + fadluha.appendChild(fadluha_title); + fadluha_title.innerText = "فضلها"; + fadluha_title.className = "albitaqat_data_title"; + fadluha.appendChild(fadluha_text); + fadluha_text.className = "albitaqat_data_text"; + fadluha_text.innerHTML = filterSpan(albitaqatJson?.fadluha?.join("

")); + + let munasabatiha = document.createElement("li"); + let munasabatiha_title = document.createElement("h3"); + let munasabatiha_text = document.createElement("p"); + + albitaqat_data.appendChild(munasabatiha); + munasabatiha.appendChild(munasabatiha_title); + munasabatiha_title.innerText = "مناسباتها"; + munasabatiha_title.className = "albitaqat_data_title"; + munasabatiha.appendChild(munasabatiha_text); + munasabatiha_text.className = "albitaqat_data_text"; + munasabatiha_text.innerHTML = filterSpan(albitaqatJson?.munasabatiha?.join("

")); + + back.addEventListener("click", e => { + window.location.href = "/pages/albitaqat.html"; + }); + + }); + + } + + } catch (error) { + + error_handling(error); } } + } \ No newline at end of file diff --git a/www/js/allah.js b/www/js/allah.js index 47b67ff..29d77bb 100644 --- a/www/js/allah.js +++ b/www/js/allah.js @@ -1,28 +1,36 @@ +import error_handling from './modules/error_handling.js'; import loadJson from './modules/loadJson.js'; export default async () => { if (window.location.pathname === '/pages/allah.html') { - let allahJson = await loadJson("/data/Names_Of_Allah.json"); - let back = document.getElementById('back'); - let allah_names = document.getElementById('allah_names'); + try { - back.addEventListener("click", e => { - window.location.href = "/more.html"; - }); + let allahJson = await loadJson("/data/Names_Of_Allah.json"); + let back = document.getElementById('back'); + let allah_names = document.getElementById('allah_names'); - for (let item of allahJson) { + back.addEventListener("click", e => { + window.location.href = "/more.html"; + }); - let li = document.createElement("li"); - let h3 = document.createElement("h3"); - let p = document.createElement("p"); + for (let item of allahJson) { - allah_names.appendChild(li); - li.appendChild(h3); - h3.innerText = item?.name; - li.appendChild(p); - p.innerText = item?.text; + let li = document.createElement("li"); + let h3 = document.createElement("h3"); + let p = document.createElement("p"); + + allah_names.appendChild(li); + li.appendChild(h3); + h3.innerText = item?.name; + li.appendChild(p); + p.innerText = item?.text; + } + + } catch (error) { + + error_handling(error); } } diff --git a/www/js/footer.js b/www/js/footer.js index dd08eb2..11e9d94 100644 --- a/www/js/footer.js +++ b/www/js/footer.js @@ -1,33 +1,42 @@ +import error_handling from './modules/error_handling.js'; import loadHtml from './modules/loadHtml.js'; export default async () => { - let footer = document.getElementById('footer'); - let fileHtml = "/footer.html"; - let load = await loadHtml(fileHtml); - footer.innerHTML = load; + try { + let footer = document.getElementById('footer'); + let fileHtml = "/footer.html"; + let load = await loadHtml(fileHtml); + footer.innerHTML = load; - // menu - let adhkar = document.getElementById('adhkar'); - let prayer = document.getElementById('prayer'); - let quran = document.getElementById('quran'); - let more = document.getElementById('more'); + // menu - adhkar.onclick = () => { - window.location.href = '/index.html' - } + let adhkar = document.getElementById('adhkar'); + let prayer = document.getElementById('prayer'); + let quran = document.getElementById('quran'); + let more = document.getElementById('more'); - prayer.onclick = () => { - window.location.href = '/prayer.html' - } + adhkar.onclick = () => { + window.location.href = '/index.html' + } - quran.onclick = () => { - window.location.href = '/quran.html' - } + prayer.onclick = () => { + window.location.href = '/prayer.html' + } + + quran.onclick = () => { + window.location.href = '/quran.html' + } + + more.onclick = () => { + window.location.href = '/more.html' + } + + } catch (error) { + + error_handling(error); - more.onclick = () => { - window.location.href = '/more.html' } } \ No newline at end of file diff --git a/www/js/hisnmuslim.js b/www/js/hisnmuslim.js index aa2fc0b..9c4d7d7 100644 --- a/www/js/hisnmuslim.js +++ b/www/js/hisnmuslim.js @@ -1,102 +1,111 @@ +import error_handling from './modules/error_handling.js'; import loadJson from './modules/loadJson.js'; export default async () => { if (window.location.pathname === '/pages/hisnmuslim.html') { - let hisnmuslimJson = await loadJson("/data/hisnmuslim.json"); - let back = document.getElementById('back'); - let more_header_title = document.getElementById('more_header_title'); - let hisnmuslim_index = document.getElementById('hisnmuslim_index'); - let Search_hisnmuslim = document.getElementById('Search_hisnmuslim'); - let hisnmuslim_tbody = document.getElementById('hisnmuslim_tbody'); - let hisnmuslim_part1 = document.getElementById('hisnmuslim_part1'); - let hisnmuslim_part2 = document.getElementById('hisnmuslim_part2'); + try { - back.addEventListener("click", e => { - window.location.href = "/more.html"; - }); + let hisnmuslimJson = await loadJson("/data/hisnmuslim.json"); + let back = document.getElementById('back'); + let more_header_title = document.getElementById('more_header_title'); + let hisnmuslim_index = document.getElementById('hisnmuslim_index'); + let Search_hisnmuslim = document.getElementById('Search_hisnmuslim'); + let hisnmuslim_tbody = document.getElementById('hisnmuslim_tbody'); + let hisnmuslim_part1 = document.getElementById('hisnmuslim_part1'); + let hisnmuslim_part2 = document.getElementById('hisnmuslim_part2'); + back.addEventListener("click", e => { + window.location.href = "/more.html"; + }); - for (let item of hisnmuslimJson) { - let tr = document.createElement("tr"); - let td_number = document.createElement("td"); - let td_category = document.createElement("td"); - let category = document.createElement("p"); - hisnmuslim_tbody.appendChild(tr); - tr.appendChild(td_number); - td_number.innerText = item?.id; - tr.appendChild(td_category); - td_category.appendChild(category); - category.innerText = item?.category; - category.className = "hisnmuslim_category"; - category.id = `hisnmuslim_category_id_${item?.id}`; + for (let item of hisnmuslimJson) { - let hisnmuslim_category = document.getElementById(`hisnmuslim_category_id_${item?.id}`); + let tr = document.createElement("tr"); + let td_number = document.createElement("td"); + let td_category = document.createElement("td"); + let category = document.createElement("p"); + hisnmuslim_tbody.appendChild(tr); + tr.appendChild(td_number); + td_number.innerText = item?.id; + tr.appendChild(td_category); + td_category.appendChild(category); + category.innerText = item?.category; + category.className = "hisnmuslim_category"; + category.id = `hisnmuslim_category_id_${item?.id}`; - hisnmuslim_category.addEventListener("click", e => { + let hisnmuslim_category = document.getElementById(`hisnmuslim_category_id_${item?.id}`); - window.scrollTo(0, 0); - let hisnmuslim_ul_category = document.getElementById("hisnmuslim_ul_category"); - hisnmuslim_part1.style.display = "none"; - hisnmuslim_part2.style.display = "block"; - more_header_title.innerText = item?.category; + hisnmuslim_category.addEventListener("click", e => { - back.addEventListener("click", e => { - window.location.href = "/pages/hisnmuslim.html"; - }); + window.scrollTo(0, 0); + let hisnmuslim_ul_category = document.getElementById("hisnmuslim_ul_category"); + hisnmuslim_part1.style.display = "none"; + hisnmuslim_part2.style.display = "block"; + more_header_title.innerText = item?.category; - for (let iterator of item?.array) { + back.addEventListener("click", e => { + window.location.href = "/pages/hisnmuslim.html"; + }); - let li = document.createElement("li"); - let hisnmuslim_ul_audio = document.createElement("audio"); - let hisnmuslim_ul_text = document.createElement("h3"); - let hisnmuslim_ul_tkrar = document.createElement("p"); + for (let iterator of item?.array) { + let li = document.createElement("li"); + let hisnmuslim_ul_audio = document.createElement("audio"); + let hisnmuslim_ul_text = document.createElement("h3"); + let hisnmuslim_ul_tkrar = document.createElement("p"); - hisnmuslim_ul_category.appendChild(li); - li.appendChild(hisnmuslim_ul_audio); - hisnmuslim_ul_audio.className = "hisnmuslim_ul_audio"; - hisnmuslim_ul_audio.src = iterator?.audio; - hisnmuslim_ul_audio.controls = true; - hisnmuslim_ul_audio.disablePictureInPicture = true; - hisnmuslim_ul_audio.controlsList = "noplaybackrate nodownload novolume"; - li.appendChild(hisnmuslim_ul_text); - hisnmuslim_ul_text.className = "hisnmuslim_ul_text"; - hisnmuslim_ul_text.innerHTML = filterSpan(iterator?.text); - li.appendChild(hisnmuslim_ul_tkrar); - hisnmuslim_ul_tkrar.className = "hisnmuslim_ul_tkrar"; - hisnmuslim_ul_tkrar.innerHTML = `التكرار : ${iterator?.count}` - } + hisnmuslim_ul_category.appendChild(li); + li.appendChild(hisnmuslim_ul_audio); + hisnmuslim_ul_audio.className = "hisnmuslim_ul_audio"; + hisnmuslim_ul_audio.src = iterator?.audio; + hisnmuslim_ul_audio.controls = true; + hisnmuslim_ul_audio.disablePictureInPicture = true; + hisnmuslim_ul_audio.controlsList = "noplaybackrate nodownload novolume"; + li.appendChild(hisnmuslim_ul_text); + hisnmuslim_ul_text.className = "hisnmuslim_ul_text"; + hisnmuslim_ul_text.innerHTML = filterSpan(iterator?.text); + li.appendChild(hisnmuslim_ul_tkrar); + hisnmuslim_ul_tkrar.className = "hisnmuslim_ul_tkrar"; + hisnmuslim_ul_tkrar.innerHTML = `التكرار : ${iterator?.count}` - }); + } - } + }); + } - // Search - Search_hisnmuslim.addEventListener("keyup", e => { + // Search - let filter = Search_hisnmuslim.value.toUpperCase(); - let tr = hisnmuslim_index.getElementsByTagName("tr"); + Search_hisnmuslim.addEventListener("keyup", e => { - for (let i = 0; i < tr.length; i++) { - let td = tr[i].getElementsByTagName("td")[1]; - if (td) { - let txtValue = td.textContent || td.innerText; - if (txtValue.toUpperCase().indexOf(filter) > -1) { - tr[i].style.display = ""; - } else { - tr[i].style.display = "none"; + let filter = Search_hisnmuslim.value.toUpperCase(); + let tr = hisnmuslim_index.getElementsByTagName("tr"); + + for (let i = 0; i < tr.length; i++) { + let td = tr[i].getElementsByTagName("td")[1]; + if (td) { + let txtValue = td.textContent || td.innerText; + if (txtValue.toUpperCase().indexOf(filter) > -1) { + tr[i].style.display = ""; + } else { + tr[i].style.display = "none"; + } } } - } - }); + }); + + } catch (error) { + + error_handling(error); + + } } } diff --git a/www/js/images.js b/www/js/images.js index aaa1166..9377e64 100644 --- a/www/js/images.js +++ b/www/js/images.js @@ -1,123 +1,132 @@ import loadJson from './modules/loadJson.js'; import Downloader from './modules/Downloader.js'; +import error_handling from './modules/error_handling.js'; export default async () => { if (window.location.pathname === '/pages/images.html') { - let back = document.getElementById('back'); - let alert_offline = document.getElementById('alert_offline'); - - - back.addEventListener("click", e => { - window.location.href = "/more.html"; - }); - - if (navigator.onLine) { - - let imagesJson = await loadJson("/data/images.json"); - let images = document.getElementById('images'); - let images_more_button = document.getElementById('images_more_button'); - let number = 1; - let from = 4; - let to = 7; - let [A1] = imagesJson.slice(-1); - let [A2] = imagesJson.slice(-2); - let [A3] = imagesJson.slice(-3); - let [A4] = imagesJson.slice(-4); - let Arr = [A1, A2, A3, A4]; - - for (let item of Arr) { - - let format = item?.split(".").slice(-1)[0]; - let li = document.createElement("li"); - let images_view = document.createElement("img"); - let images_download = document.createElement("img"); - - images.appendChild(li); - li.appendChild(images_view); - images_view.className = "images_view" - images_view.src = item; - li.appendChild(images_download); - images_download.className = "images_download" - images_download.src = "/img/download.png" - - images_download.addEventListener("click", e => { - Downloader(item, `${number++}.${format}`); - }); - } + try { + + let back = document.getElementById('back'); + let alert_offline = document.getElementById('alert_offline'); + + + back.addEventListener("click", e => { + window.location.href = "/more.html"; + }); - images_more_button.style.display = "block" + if (navigator.onLine) { + + let imagesJson = await loadJson("/data/images.json"); + let images = document.getElementById('images'); + let images_more_button = document.getElementById('images_more_button'); + let number = 1; + let from = 4; + let to = 7; + let [A1] = imagesJson.slice(-1); + let [A2] = imagesJson.slice(-2); + let [A3] = imagesJson.slice(-3); + let [A4] = imagesJson.slice(-4); + let Arr = [A1, A2, A3, A4]; + + for (let item of Arr) { + + let format = item?.split(".").slice(-1)[0]; + let li = document.createElement("li"); + let images_view = document.createElement("img"); + let images_download = document.createElement("img"); + + images.appendChild(li); + li.appendChild(images_view); + images_view.className = "images_view" + images_view.src = item; + li.appendChild(images_download); + images_download.className = "images_download" + images_download.src = "/img/download.png" + + images_download.addEventListener("click", e => { + Downloader(item, `${number++}.${format}`); + }); + } + + images_more_button.style.display = "block" - images_more_button.addEventListener('click', (e) => { + images_more_button.addEventListener('click', (e) => { - let GetArray = getFromTo(imagesJson.slice().reverse(), from, to); + let GetArray = getFromTo(imagesJson.slice().reverse(), from, to); - if (to < imagesJson?.length) { + if (to < imagesJson?.length) { - number = number++ - from += 4 - to += 4 + number = number++ + from += 4 + to += 4 - for (let item of GetArray) { + for (let item of GetArray) { - let format = item?.split(".").slice(-1)[0]; - let li = document.createElement("li"); - let images_view = document.createElement("img"); - let images_download = document.createElement("img"); + let format = item?.split(".").slice(-1)[0]; + let li = document.createElement("li"); + let images_view = document.createElement("img"); + let images_download = document.createElement("img"); - images.appendChild(li); - li.appendChild(images_view); - images_view.className = "images_view" - images_view.src = item; - li.appendChild(images_download); - images_download.className = "images_download" - images_download.src = "/img/download.png" + images.appendChild(li); + li.appendChild(images_view); + images_view.className = "images_view" + images_view.src = item; + li.appendChild(images_download); + images_download.className = "images_download" + images_download.src = "/img/download.png" - images_download.addEventListener("click", e => { - Downloader(item, `${number++}.${format}`); - }); + images_download.addEventListener("click", e => { + Downloader(item, `${number++}.${format}`); + }); + } } - } - setTimeout(() => { - if (to > imagesJson.length - 1) { - images_more_button.style.display = 'none' + setTimeout(() => { + if (to > imagesJson.length - 1) { + images_more_button.style.display = 'none' + } + }, 1000); + + }); + + setInterval(() => { + + if (navigator.onLine === false) { + alert_offline.style.display = "block" + images_more_button.style.display = "none" + images.style.display = "none" } - }, 1000); - }); + else if (navigator.onLine) { + alert_offline.style.display = "none" + images_more_button.style.display = "block" + images.style.display = "block" + } - setInterval(() => { + }, 2000); - if (navigator.onLine === false) { - alert_offline.style.display = "block" - images_more_button.style.display = "none" - images.style.display = "none" - } - else if (navigator.onLine) { - alert_offline.style.display = "none" - images_more_button.style.display = "block" - images.style.display = "block" - } + } - }, 2000); + else { + alert_offline.style.display = "block" + setInterval(() => { - } + if (navigator.onLine) { + window.location.href = '/pages/images.html'; + } - else { - alert_offline.style.display = "block" + }, 1000); + } - setInterval(() => { + } catch (error) { - if (navigator.onLine) { - window.location.href = '/pages/images.html'; - } + error_handling(error); - }, 1000); } } diff --git a/www/js/index.js b/www/js/index.js index 4769d89..41cdc2c 100644 --- a/www/js/index.js +++ b/www/js/index.js @@ -11,50 +11,56 @@ import images from './images.js'; import allah from './allah.js'; import settings from './settings.js'; import notification from './notification.js'; +import error_handling from './modules/error_handling.js'; document.documentElement.style.setProperty('--animate-duration', '1.5s'); +document.addEventListener('deviceready', async (e) => { + try { + let permissions = cordova.plugins.permissions; + // الصلاحيات -document.addEventListener('deviceready', async (e) => { + let list = [ + permissions.ACCESS_COARSE_LOCATION, + permissions.WRITE_EXTERNAL_STORAGE + ]; - let permissions = cordova.plugins.permissions; + permissions.hasPermission(list, (status) => { - // الصلاحيات + if (!status.hasPermission) { - let list = [ - permissions.ACCESS_COARSE_LOCATION, - permissions.WRITE_EXTERNAL_STORAGE - ]; + permissions.requestPermissions(list); + } - permissions.hasPermission(list, (status) => { + }); - if (!status.hasPermission) { + // ignore the system font preferences - permissions.requestPermissions(list); + if (window.MobileAccessibility) { + window.MobileAccessibility.usePreferredTextZoom(false); } - }); - // ignore the system font preferences + } catch (error) { + + error_handling(error); - if (window.MobileAccessibility) { - window.MobileAccessibility.usePreferredTextZoom(false); } -}, false); - -await footer(); -await adhkar(); -await prayer() -await quran(); -await more(); -await albitaqat(); -await hisnmuslim(); -await radio(); -await tfs(); -await images(); -await allah(); -await settings(); -await notification(); \ No newline at end of file + await footer(); + await adhkar(); + await prayer(); + await quran(); + await more(); + await albitaqat(); + await hisnmuslim(); + await radio(); + await tfs(); + await images(); + await allah(); + await settings(); + await notification(); + +}, false); \ No newline at end of file diff --git a/www/js/modules/Downloader.js b/www/js/modules/Downloader.js index d3983b2..8ed793f 100644 --- a/www/js/modules/Downloader.js +++ b/www/js/modules/Downloader.js @@ -1,24 +1,34 @@ +import error_handling from "./error_handling.js"; + export default (url, filename) => { - let Downloader = window.plugins.Downloader; - let downloadSuccessCallback = (result) => { - // result is an object - console.log(result.file); - }; - - let downloadErrorCallback = (error) => { - // error: string - alert(error) - }; - - let options = { - title: filename, // 'Downloading File', // Download Notification Title - url: url, // File Url - path: filename, // The File Name with extension - description: 'جاري تنزيل الملف ...', // Download description Notification String - visible: true, // This download is visible and shows in the notifications while in progress and after completion. - folder: "Download" // Folder to save the downloaded file, if not exist it will be created - } + try { + + let Downloader = window.plugins.Downloader; + let downloadSuccessCallback = (result) => { + // result is an object + console.log(result.file); + }; + + let downloadErrorCallback = (error) => { + // error: string + alert(error) + }; + + let options = { + title: filename, // 'Downloading File', // Download Notification Title + url: url, // File Url + path: filename, // The File Name with extension + description: 'جاري تنزيل الملف ...', // Download description Notification String + visible: true, // This download is visible and shows in the notifications while in progress and after completion. + folder: "Download" // Folder to save the downloaded file, if not exist it will be created + } - Downloader.download(options, downloadSuccessCallback, downloadErrorCallback); + Downloader.download(options, downloadSuccessCallback, downloadErrorCallback); + + } catch (error) { + + error_handling(error); + + } } \ No newline at end of file diff --git a/www/js/modules/adhanModule.js b/www/js/modules/adhanModule.js index d00b1ed..bcf6131 100644 --- a/www/js/modules/adhanModule.js +++ b/www/js/modules/adhanModule.js @@ -2,6 +2,7 @@ import moment from './moment/moment.js'; import moment_hijri from './moment/moment-hijri.js'; import { Coordinates, CalculationMethod, PrayerTimes, Madhab, Shafaq } from './adhan.js'; import momentDurationFormatSetup from './moment/moment-duration-format.js'; +import error_handling from './error_handling.js'; momentDurationFormatSetup(moment); @@ -22,45 +23,53 @@ momentDurationFormatSetup(moment); export default (options) => { - let hijri = moment_hijri(moment) - let coordinates = new Coordinates(options?.latitude, options?.longitude); - let params = options?.Calculation === 'MuslimWorldLeague' ? CalculationMethod.MuslimWorldLeague() : options?.Calculation === 'Egyptian' ? CalculationMethod.Egyptian() : options?.Calculation === 'Karachi' ? CalculationMethod.Karachi() : options?.Calculation === 'UmmAlQura' ? CalculationMethod.UmmAlQura() : options?.Calculation === 'Dubai' ? CalculationMethod.Dubai() : options?.Calculation === 'Qatar' ? CalculationMethod.Qatar() : options?.Calculation === 'Kuwait' ? CalculationMethod.Kuwait() : options?.Calculation === 'Singapore' ? CalculationMethod.Singapore() : options?.Calculation === 'Turkey' ? CalculationMethod.Turkey() : options?.Calculation === 'Tehran' ? CalculationMethod.NorthAmerica() : CalculationMethod.NorthAmerica(); - params.madhab = options?.Madhab === "Hanafi" ? Madhab.Hanafi : Madhab.Shafi; - params.shafaq = options?.Shafaq === "Ahmer" ? Shafaq.Ahmer : options?.Shafaq === "Abyad" ? Shafaq.Abyad : Shafaq.General; - params.adjustments.fajr = options?.fajr ? options?.fajr : 0; - params.adjustments.dhuhr = options?.dhuhr ? options?.dhuhr : 0; - params.adjustments.asr = options?.asr ? options?.asr : 0; - params.adjustments.maghrib = options?.maghrib ? options?.maghrib : 0; - params.adjustments.isha = options?.isha ? options?.isha : 0; - let date = new Date(); - let prayerTimes = new PrayerTimes(coordinates, date, params); - let nextPrayer = prayerTimes.nextPrayer(); - let timezone = Intl.DateTimeFormat().resolvedOptions().timeZone - let now = moment(); - let end = moment(prayerTimes.timeForPrayer(nextPrayer)); - let duration = moment.duration(end.diff(now)); - let remaining = duration.format('hh:mm:ss'); - // let remaining = `${convertTo12HourFormat(duration.hours()).hours}:${duration.minutes()}:${duration.seconds()}` - let dayNamesArabic = ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت']; - let day = date.getDay(); // 0 for Sunday, 1 for Monday, etc. - let dayNameArabic = dayNamesArabic[day]; // get the corresponding Arabic day name from the array + try { - return { - isha: moment(prayerTimes.isha).format('h:mm A'), - maghrib: moment(prayerTimes.maghrib).format('h:mm A'), - asr: moment(prayerTimes.asr).format('h:mm A'), - dhuhr: moment(prayerTimes.dhuhr).format('h:mm A'), - fajr: moment(prayerTimes.fajr).format('h:mm A'), - nextPrayer: nextPrayer, - remainingNext: remaining, - currentPrayer: prayerTimes.currentPrayer(), - timezone: timezone, - data_hijri: hijri().format('iYYYY/iM/iD'), - data_Gregorian: now.format('YYYY/M/D'), - today: dayNameArabic, - hour_minutes: now.format('h:mm'), - seconds: now.format(': ss A'), - }; + let hijri = moment_hijri(moment) + let coordinates = new Coordinates(options?.latitude, options?.longitude); + let params = options?.Calculation === 'MuslimWorldLeague' ? CalculationMethod.MuslimWorldLeague() : options?.Calculation === 'Egyptian' ? CalculationMethod.Egyptian() : options?.Calculation === 'Karachi' ? CalculationMethod.Karachi() : options?.Calculation === 'UmmAlQura' ? CalculationMethod.UmmAlQura() : options?.Calculation === 'Dubai' ? CalculationMethod.Dubai() : options?.Calculation === 'Qatar' ? CalculationMethod.Qatar() : options?.Calculation === 'Kuwait' ? CalculationMethod.Kuwait() : options?.Calculation === 'Singapore' ? CalculationMethod.Singapore() : options?.Calculation === 'Turkey' ? CalculationMethod.Turkey() : options?.Calculation === 'Tehran' ? CalculationMethod.NorthAmerica() : CalculationMethod.NorthAmerica(); + params.madhab = options?.Madhab === "Hanafi" ? Madhab.Hanafi : Madhab.Shafi; + params.shafaq = options?.Shafaq === "Ahmer" ? Shafaq.Ahmer : options?.Shafaq === "Abyad" ? Shafaq.Abyad : Shafaq.General; + params.adjustments.fajr = options?.fajr ? options?.fajr : 0; + params.adjustments.dhuhr = options?.dhuhr ? options?.dhuhr : 0; + params.adjustments.asr = options?.asr ? options?.asr : 0; + params.adjustments.maghrib = options?.maghrib ? options?.maghrib : 0; + params.adjustments.isha = options?.isha ? options?.isha : 0; + let date = new Date(); + let prayerTimes = new PrayerTimes(coordinates, date, params); + let nextPrayer = prayerTimes.nextPrayer(); + let timezone = Intl.DateTimeFormat().resolvedOptions().timeZone + let now = moment(); + let end = moment(prayerTimes.timeForPrayer(nextPrayer)); + let duration = moment.duration(end.diff(now)); + let remaining = duration.format('hh:mm:ss'); + // let remaining = `${convertTo12HourFormat(duration.hours()).hours}:${duration.minutes()}:${duration.seconds()}` + let dayNamesArabic = ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت']; + let day = date.getDay(); // 0 for Sunday, 1 for Monday, etc. + let dayNameArabic = dayNamesArabic[day]; // get the corresponding Arabic day name from the array + + return { + isha: moment(prayerTimes.isha).format('h:mm A'), + maghrib: moment(prayerTimes.maghrib).format('h:mm A'), + asr: moment(prayerTimes.asr).format('h:mm A'), + dhuhr: moment(prayerTimes.dhuhr).format('h:mm A'), + fajr: moment(prayerTimes.fajr).format('h:mm A'), + nextPrayer: nextPrayer, + remainingNext: remaining, + currentPrayer: prayerTimes.currentPrayer(), + timezone: timezone, + data_hijri: hijri().format('iYYYY/iM/iD'), + data_Gregorian: now.format('YYYY/M/D'), + today: dayNameArabic, + hour_minutes: now.format('h:mm'), + seconds: now.format(': ss A'), + }; + + } catch (error) { + + error_handling(error); + + } } diff --git a/www/js/modules/error_handling.js b/www/js/modules/error_handling.js new file mode 100644 index 0000000..7a70696 --- /dev/null +++ b/www/js/modules/error_handling.js @@ -0,0 +1,52 @@ +export default (error) => { + + let arr = [ + "application does not have sufficient geolocation permissions.", + "Illegal Access" + ] + + if (arr.every(e => error?.message !== e)) { + + navigator.notification.confirm( + `message: ${error?.message}\ncode: ${error?.code ? error?.code : "null"}\npath: ${window.location.pathname}`, + (e) => { + + if (e === 2) { + + if (navigator.app) { + navigator.app.exitApp(); + } + + else if (navigator.device) { + navigator.device.exitApp(); + } + + else { + window.close(); + } + + } + + else if (e === 1) { + + let repoUrl = 'https://github.com/Alsarmad/altaqwaa_android' + let message = `message: ${error?.message}\n`; + message += `code: ${error?.code ? error?.code : "null"}\n`; + message += `path: ${window.location.pathname}\n`; + message += `platform: ${device.platform}\n`; + message += `version: ${device.version}\n`; + message += `model: ${device.model}`; + + let url = new URL(`${repoUrl}/issues/new`); + url.searchParams.set("title", error?.message); + url.searchParams.set("body", message); + url.searchParams.set("labels", "bug"); + window.open(url, "_blank"); + } + }, + "عذراً هناك خطأ غير متوقع", + ["الدعم", "خروج"] + ); + + } +} \ No newline at end of file diff --git a/www/js/more.js b/www/js/more.js index 25fc681..986ed0c 100644 --- a/www/js/more.js +++ b/www/js/more.js @@ -1,56 +1,66 @@ +import error_handling from "./modules/error_handling.js"; + export default async () => { if (window.location.pathname === '/more.html') { - let more_albitaqat = document.getElementById("more_albitaqat"); - let more_hisnmuslim = document.getElementById("more_hisnmuslim"); - let more_tfs = document.getElementById("more_tfs"); - let more_radio = document.getElementById("more_radio"); - let more_allah = document.getElementById("more_allah"); - let more_images = document.getElementById("more_images"); - let more_settings = document.getElementById("more_settings"); - let more_info = document.getElementById("more_info"); + try { + + let more_albitaqat = document.getElementById("more_albitaqat"); + let more_hisnmuslim = document.getElementById("more_hisnmuslim"); + let more_tfs = document.getElementById("more_tfs"); + let more_radio = document.getElementById("more_radio"); + let more_allah = document.getElementById("more_allah"); + let more_images = document.getElementById("more_images"); + let more_settings = document.getElementById("more_settings"); + let more_info = document.getElementById("more_info"); + + + more_albitaqat.addEventListener("click", e => { + + window.location.href = "/pages/albitaqat.html" + }); + more_hisnmuslim.addEventListener("click", e => { - more_albitaqat.addEventListener("click", e => { + window.location.href = "/pages/hisnmuslim.html" + }); - window.location.href = "/pages/albitaqat.html" - }); + more_tfs.addEventListener("click", e => { - more_hisnmuslim.addEventListener("click", e => { + window.location.href = "/pages/tfs.html" + }); - window.location.href = "/pages/hisnmuslim.html" - }); + more_radio.addEventListener("click", e => { - more_tfs.addEventListener("click", e => { + window.location.href = "/pages/radio.html" + }); - window.location.href = "/pages/tfs.html" - }); + more_allah.addEventListener("click", e => { - more_radio.addEventListener("click", e => { + window.location.href = "/pages/allah.html" + }); - window.location.href = "/pages/radio.html" - }); + more_images.addEventListener("click", e => { - more_allah.addEventListener("click", e => { + window.location.href = "/pages/images.html" + }); - window.location.href = "/pages/allah.html" - }); + more_settings.addEventListener("click", e => { - more_images.addEventListener("click", e => { + window.location.href = "/pages/settings.html" + }); - window.location.href = "/pages/images.html" - }); + more_info.addEventListener("click", e => { - more_settings.addEventListener("click", e => { + window.location.href = "/pages/info.html" + }); - window.location.href = "/pages/settings.html" - }); + } catch (error) { - more_info.addEventListener("click", e => { + error_handling(error); - window.location.href = "/pages/info.html" - }); + } } } \ No newline at end of file diff --git a/www/js/notification.js b/www/js/notification.js index 2d8862e..2acdb46 100644 --- a/www/js/notification.js +++ b/www/js/notification.js @@ -1,92 +1,101 @@ import adhanModule from './modules/adhanModule.js'; +import error_handling from './modules/error_handling.js'; import getGPS from './modules/getGPS.js'; import moment from './modules/moment/moment.js'; export default async () => { - // LocalStorage - - let storage = window.localStorage; - let Calculation = storage.getItem('Calculation'); - let Madhab = storage.getItem('Madhab'); - let Shafaq = storage.getItem('Shafaq'); - let Setfajr = storage.getItem('fajr'); - let Setdhuhr = storage.getItem('dhuhr'); - let Setasr = storage.getItem('asr'); - let Setmaghrib = storage.getItem('maghrib'); - let Setisha = storage.getItem('isha'); - let Getlatitude = storage.getItem('latitude'); - let Getlongitude = storage.getItem('longitude'); - let notification = storage.getItem('notification'); - - if (Getlongitude === null || Getlatitude === null) { - - let GPS = await getGPS(); - Getlatitude = GPS.latitude; - Getlongitude = GPS.longitude; - storage.setItem("latitude", Getlatitude); - storage.setItem("longitude", Getlongitude); + try { - } + // LocalStorage - while (notification ? bool(notification) : true) { - - - let timenow = moment().format('h:mm A'); - let adhan = adhanModule({ - Calculation: Calculation ? Calculation : "UmmAlQura", - latitude: Number(Getlatitude), - longitude: Number(Getlongitude), - Madhab: Madhab ? Madhab : "Shafi", - Shafaq: Shafaq ? Shafaq : "General", - fajr: Setfajr ? Number(Setfajr) : 0, - dhuhr: Setdhuhr ? Number(Setdhuhr) : 0, - asr: Setasr ? Number(Setasr) : 0, - maghrib: Setmaghrib ? Number(Setmaghrib) : 0, - isha: Setisha ? Number(Setisha) : 0, - }); - // let slah = adhan.nextPrayer === "fajr" ? "الفجر" : adhan.nextPrayer === "dhuhr" ? "الظهر" : adhan.nextPrayer === "asr" ? "العصر" : adhan.nextPrayer === "maghrib" ? "المغرب" : adhan.nextPrayer === "isha" ? "العشاء" : "لايوجد"; - let fileAdhan = adhan.nextPrayer === "fajr" ? "/mp3/002.mp3" : "/mp3/001.mp3" + let storage = window.localStorage; + let Calculation = storage.getItem('Calculation'); + let Madhab = storage.getItem('Madhab'); + let Shafaq = storage.getItem('Shafaq'); + let Setfajr = storage.getItem('fajr'); + let Setdhuhr = storage.getItem('dhuhr'); + let Setasr = storage.getItem('asr'); + let Setmaghrib = storage.getItem('maghrib'); + let Setisha = storage.getItem('isha'); + let Getlatitude = storage.getItem('latitude'); + let Getlongitude = storage.getItem('longitude'); + let notification = storage.getItem('notification'); - switch (timenow) { - case adhan?.fajr: + if (Getlongitude === null || Getlatitude === null) { - await notification_adhan("الفجر", fileAdhan, storage); + let GPS = await getGPS(); + Getlatitude = GPS.latitude; + Getlongitude = GPS.longitude; + storage.setItem("latitude", Getlatitude); + storage.setItem("longitude", Getlongitude); - break; + } - case adhan?.dhuhr: + while (notification ? bool(notification) : true) { - await notification_adhan("الظهر", fileAdhan, storage); - break; + let timenow = moment().format('h:mm A'); + let adhan = adhanModule({ + Calculation: Calculation ? Calculation : "UmmAlQura", + latitude: Number(Getlatitude), + longitude: Number(Getlongitude), + Madhab: Madhab ? Madhab : "Shafi", + Shafaq: Shafaq ? Shafaq : "General", + fajr: Setfajr ? Number(Setfajr) : 0, + dhuhr: Setdhuhr ? Number(Setdhuhr) : 0, + asr: Setasr ? Number(Setasr) : 0, + maghrib: Setmaghrib ? Number(Setmaghrib) : 0, + isha: Setisha ? Number(Setisha) : 0, + }); + // let slah = adhan.nextPrayer === "fajr" ? "الفجر" : adhan.nextPrayer === "dhuhr" ? "الظهر" : adhan.nextPrayer === "asr" ? "العصر" : adhan.nextPrayer === "maghrib" ? "المغرب" : adhan.nextPrayer === "isha" ? "العشاء" : "لايوجد"; + let fileAdhan = adhan.nextPrayer === "fajr" ? "/mp3/002.mp3" : "/mp3/001.mp3" - case adhan?.asr: + switch (timenow) { + case adhan?.fajr: - await notification_adhan("العصر", fileAdhan, storage); + await notification_adhan("الفجر", fileAdhan, storage); - break; + break; - case adhan?.maghrib: + case adhan?.dhuhr: - await notification_adhan("المغرب", fileAdhan, storage); + await notification_adhan("الظهر", fileAdhan, storage); - break; + break; - case adhan?.isha: + case adhan?.asr: - await notification_adhan("العشاء", fileAdhan, storage); + await notification_adhan("العصر", fileAdhan, storage); - break; + break; - default: - break; - } + case adhan?.maghrib: + + await notification_adhan("المغرب", fileAdhan, storage); + + break; + + case adhan?.isha: + + await notification_adhan("العشاء", fileAdhan, storage); - // sleep - await new Promise(r => setTimeout(r, 6000)); + break; - }; + default: + break; + } + + // sleep + await new Promise(r => setTimeout(r, 6000)); + + }; + + } catch (error) { + + error_handling(error); + + } } diff --git a/www/js/prayer.js b/www/js/prayer.js index 9b61253..595ff20 100644 --- a/www/js/prayer.js +++ b/www/js/prayer.js @@ -1,95 +1,44 @@ import adhanModule from './modules/adhanModule.js'; import getGPS from './modules/getGPS.js'; +import error_handling from './modules/error_handling.js'; export default async () => { if (window.location.pathname === '/prayer.html') { + try { - let statusPERM = await permission_status(); - let prayer_time = document.getElementById('prayer_time'); - let alertElm = document.getElementById('alert'); + let statusPERM = await permission_status(); + let prayer_time = document.getElementById('prayer_time'); + let alertElm = document.getElementById('alert'); - // LocalStorage + // LocalStorage - let storage = window.localStorage; - let Calculation = storage.getItem('Calculation'); - let Madhab = storage.getItem('Madhab'); - let Shafaq = storage.getItem('Shafaq'); - let Setfajr = storage.getItem('fajr'); - let Setdhuhr = storage.getItem('dhuhr'); - let Setasr = storage.getItem('asr'); - let Setmaghrib = storage.getItem('maghrib'); - let Setisha = storage.getItem('isha'); - let Getlatitude = storage.getItem('latitude'); - let Getlongitude = storage.getItem('longitude'); + let storage = window.localStorage; + let Calculation = storage.getItem('Calculation'); + let Madhab = storage.getItem('Madhab'); + let Shafaq = storage.getItem('Shafaq'); + let Setfajr = storage.getItem('fajr'); + let Setdhuhr = storage.getItem('dhuhr'); + let Setasr = storage.getItem('asr'); + let Setmaghrib = storage.getItem('maghrib'); + let Setisha = storage.getItem('isha'); + let Getlatitude = storage.getItem('latitude'); + let Getlongitude = storage.getItem('longitude'); - if (statusPERM || Getlongitude && Getlatitude) { + if (statusPERM || Getlongitude && Getlatitude) { - prayer_time.style.display = "block"; + prayer_time.style.display = "block"; - if (Getlongitude === null || Getlatitude === null) { + if (Getlongitude === null || Getlatitude === null) { - let GPS = await getGPS(); - Getlatitude = GPS.latitude; - Getlongitude = GPS.longitude; - storage.setItem("latitude", Getlatitude); - storage.setItem("longitude", Getlongitude); + let GPS = await getGPS(); + Getlatitude = GPS.latitude; + Getlongitude = GPS.longitude; + storage.setItem("latitude", Getlatitude); + storage.setItem("longitude", Getlongitude); - } - - let adhan = adhanModule({ - Calculation: Calculation ? Calculation : "UmmAlQura", - latitude: Number(Getlatitude), - longitude: Number(Getlongitude), - Madhab: Madhab ? Madhab : "Shafi", - Shafaq: Shafaq ? Shafaq : "General", - fajr: Setfajr ? Number(Setfajr) : 0, - dhuhr: Setdhuhr ? Number(Setdhuhr) : 0, - asr: Setasr ? Number(Setasr) : 0, - maghrib: Setmaghrib ? Number(Setmaghrib) : 0, - isha: Setisha ? Number(Setisha) : 0, - }); - let data_hijri = document.getElementById('data_hijri'); - let data_Gregorian = document.getElementById('data_Gregorian'); - let datoday = document.getElementById('datoday'); - let country = document.getElementById('country'); - let hour_minutes = document.getElementById('hour_minutes'); - let seconds = document.getElementById('seconds'); - let time_fajr = document.getElementById('time_fajr'); - let time_dhuhr = document.getElementById('time_dhuhr'); - let time_asr = document.getElementById('time_asr'); - let time_maghrib = document.getElementById('time_maghrib'); - let time_isha = document.getElementById('time_isha'); - let fajr_li = document.getElementById('fajr_li'); - let dhuhr_li = document.getElementById('dhuhr_li'); - let asr_li = document.getElementById('asr_li'); - let maghrib_li = document.getElementById('maghrib_li'); - let isha_li = document.getElementById('isha_li'); - let remaining_ = document.getElementById('remaining'); - let remaining_time = document.getElementById('remaining_time'); - let remaining_name = document.getElementById('remaining_name'); - let fajr = document.getElementById('fajr'); - let dhuhr = document.getElementById('dhuhr'); - let asr = document.getElementById('asr'); - let maghrib = document.getElementById('maghrib'); - let isha = document.getElementById('isha'); - - data_hijri.innerText = adhan.data_hijri; - data_Gregorian.innerText = adhan.data_Gregorian; - datoday.innerText = adhan.today; - hour_minutes.innerText = adhan.hour_minutes; - seconds.innerText = adhan.seconds; - country.innerHTML = `المنطقة الزمنية: ${adhan.timezone}` - remaining_time.innerText = adhan.remainingNext; - time_fajr.innerText = adhan.fajr; - time_dhuhr.innerText = adhan.dhuhr; - time_asr.innerText = adhan.asr; - time_maghrib.innerText = adhan.maghrib; - time_isha.innerText = adhan.isha; - - - setInterval(() => { + } let adhan = adhanModule({ Calculation: Calculation ? Calculation : "UmmAlQura", @@ -103,13 +52,37 @@ export default async () => { maghrib: Setmaghrib ? Number(Setmaghrib) : 0, isha: Setisha ? Number(Setisha) : 0, }); + let data_hijri = document.getElementById('data_hijri'); + let data_Gregorian = document.getElementById('data_Gregorian'); + let datoday = document.getElementById('datoday'); + let country = document.getElementById('country'); + let hour_minutes = document.getElementById('hour_minutes'); + let seconds = document.getElementById('seconds'); + let time_fajr = document.getElementById('time_fajr'); + let time_dhuhr = document.getElementById('time_dhuhr'); + let time_asr = document.getElementById('time_asr'); + let time_maghrib = document.getElementById('time_maghrib'); + let time_isha = document.getElementById('time_isha'); + let fajr_li = document.getElementById('fajr_li'); + let dhuhr_li = document.getElementById('dhuhr_li'); + let asr_li = document.getElementById('asr_li'); + let maghrib_li = document.getElementById('maghrib_li'); + let isha_li = document.getElementById('isha_li'); + let remaining_ = document.getElementById('remaining'); + let remaining_time = document.getElementById('remaining_time'); + let remaining_name = document.getElementById('remaining_name'); + let fajr = document.getElementById('fajr'); + let dhuhr = document.getElementById('dhuhr'); + let asr = document.getElementById('asr'); + let maghrib = document.getElementById('maghrib'); + let isha = document.getElementById('isha'); + data_hijri.innerText = adhan.data_hijri; data_Gregorian.innerText = adhan.data_Gregorian; datoday.innerText = adhan.today; hour_minutes.innerText = adhan.hour_minutes; seconds.innerText = adhan.seconds; country.innerHTML = `المنطقة الزمنية: ${adhan.timezone}` - remaining_time.innerText = adhan.remainingNext; time_fajr.innerText = adhan.fajr; time_dhuhr.innerText = adhan.dhuhr; @@ -117,142 +90,207 @@ export default async () => { time_maghrib.innerText = adhan.maghrib; time_isha.innerText = adhan.isha; - switch (adhan.nextPrayer) { - case "fajr": - remaining_name.innerText = "الفجر"; - remaining_.style.display = 'block' - remaining_time.style.display = 'block' - fajr_li.style.background = 'var(--background_div_hover)' - dhuhr_li.style.background = null - asr_li.style.background = null - maghrib_li.style.background = null - isha_li.style.background = null - fajr.style.color = 'var(--white-div)' - dhuhr.style.color = null - asr.style.color = null - maghrib.style.color = null - isha.style.color = null - break; - - case "dhuhr": - remaining_name.innerText = "الظهر"; - remaining_.style.display = 'block' - remaining_time.style.display = 'block' - fajr_li.style.background = null - dhuhr_li.style.background = 'var(--background_div_hover)' - asr_li.style.background = null - maghrib_li.style.background = null - isha_li.style.background = null - fajr.style.color = null - dhuhr.style.color = 'var(--white-div)' - asr.style.color = null - maghrib.style.color = null - isha.style.color = null - break; - - case "asr": - remaining_name.innerText = "العصر"; - remaining_.style.display = 'block' - remaining_time.style.display = 'block' - fajr_li.style.background = null - dhuhr_li.style.background = null - asr_li.style.background = 'var(--background_div_hover)' - maghrib_li.style.background = null - isha_li.style.background = null - fajr.style.color = null - dhuhr.style.color = null - asr.style.color = 'var(--white-div)' - maghrib.style.color = null - isha.style.color = null - break; - - case "maghrib": - remaining_name.innerText = "المغرب"; - remaining_.style.display = 'block' - remaining_time.style.display = 'block' - fajr_li.style.background = null - dhuhr_li.style.background = null - asr_li.style.background = null - maghrib_li.style.background = 'var(--background_div_hover)' - isha_li.style.background = null - fajr.style.color = null - dhuhr.style.color = null - asr.style.color = null - maghrib.style.color = 'var(--white-div)' - isha.style.color = null - break; - - case "isha": - remaining_name.innerText = "العشاء"; - remaining_.style.display = 'block' - remaining_time.style.display = 'block' - fajr_li.style.background = null - dhuhr_li.style.background = null - asr_li.style.background = null - maghrib_li.style.background = null - isha_li.style.background = 'var(--background_div_hover)' - fajr.style.color = null - dhuhr.style.color = null - asr.style.color = null - maghrib.style.color = null - isha.style.color = 'var(--white-div)' - break; - - default: - remaining_name.innerText = "لايوجد"; - remaining_.style.display = 'none' - remaining_time.style.display = 'none' - fajr_li.style.background = null - dhuhr_li.style.background = null - asr_li.style.background = null - maghrib_li.style.background = null - isha_li.style.background = null - fajr.style.color = null - dhuhr.style.color = null - asr.style.color = null - maghrib.style.color = null - isha.style.color = null - break; - } - - - }, 1000); - setInterval(() => { + setInterval(() => { + + let adhan = adhanModule({ + Calculation: Calculation ? Calculation : "UmmAlQura", + latitude: Number(Getlatitude), + longitude: Number(Getlongitude), + Madhab: Madhab ? Madhab : "Shafi", + Shafaq: Shafaq ? Shafaq : "General", + fajr: Setfajr ? Number(Setfajr) : 0, + dhuhr: Setdhuhr ? Number(Setdhuhr) : 0, + asr: Setasr ? Number(Setasr) : 0, + maghrib: Setmaghrib ? Number(Setmaghrib) : 0, + isha: Setisha ? Number(Setisha) : 0, + }); + data_hijri.innerText = adhan.data_hijri; + data_Gregorian.innerText = adhan.data_Gregorian; + datoday.innerText = adhan.today; + hour_minutes.innerText = adhan.hour_minutes; + seconds.innerText = adhan.seconds; + country.innerHTML = `المنطقة الزمنية: ${adhan.timezone}` + + remaining_time.innerText = adhan.remainingNext; + time_fajr.innerText = adhan.fajr; + time_dhuhr.innerText = adhan.dhuhr; + time_asr.innerText = adhan.asr; + time_maghrib.innerText = adhan.maghrib; + time_isha.innerText = adhan.isha; + + switch (adhan.nextPrayer) { + case "fajr": + remaining_name.innerText = "الفجر"; + remaining_.style.display = 'block' + remaining_time.style.display = 'block' + fajr_li.style.background = 'var(--background_div_hover)' + fajr_li.style.boxShadow = 'rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset' + dhuhr_li.style.background = null + dhuhr_li.style.boxShadow = null + asr_li.style.background = null + asr_li.style.boxShadow = null + maghrib_li.style.background = null + maghrib_li.style.boxShadow = null + isha_li.style.background = null + isha_li.style.boxShadow = null + fajr.style.color = 'var(--white-div)' + dhuhr.style.color = null + asr.style.color = null + maghrib.style.color = null + isha.style.color = null + break; + + case "dhuhr": + remaining_name.innerText = "الظهر"; + remaining_.style.display = 'block' + remaining_time.style.display = 'block' + fajr_li.style.background = null + fajr_li.style.boxShadow = null + dhuhr_li.style.background = 'var(--background_div_hover)' + dhuhr_li.style.boxShadow = 'rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset' + asr_li.style.background = null + asr_li.style.boxShadow = null + maghrib_li.style.background = null + maghrib_li.style.boxShadow = null + isha_li.style.background = null + isha_li.style.boxShadow = null + fajr.style.color = null + dhuhr.style.color = 'var(--white-div)' + asr.style.color = null + maghrib.style.color = null + isha.style.color = null + break; + + case "asr": + remaining_name.innerText = "العصر"; + remaining_.style.display = 'block' + remaining_time.style.display = 'block' + fajr_li.style.background = null + fajr_li.style.boxShadow = null + dhuhr_li.style.background = null + dhuhr_li.style.boxShadow = null + asr_li.style.background = 'var(--background_div_hover)' + asr_li.style.boxShadow = 'rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset' + maghrib_li.style.background = null + maghrib_li.style.boxShadow = null + isha_li.style.background = null + isha_li.style.boxShadow = null + fajr.style.color = null + dhuhr.style.color = null + asr.style.color = 'var(--white-div)' + maghrib.style.color = null + isha.style.color = null + break; + + case "maghrib": + remaining_name.innerText = "المغرب"; + remaining_.style.display = 'block' + remaining_time.style.display = 'block' + fajr_li.style.background = null + fajr_li.style.boxShadow = null + dhuhr_li.style.background = null + dhuhr_li.style.boxShadow = null + asr_li.style.background = null + asr_li.style.boxShadow = null + maghrib_li.style.background = 'var(--background_div_hover)' + maghrib_li.style.boxShadow = 'rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset' + isha_li.style.background = null + isha_li.style.boxShadow = null + fajr.style.color = null + dhuhr.style.color = null + asr.style.color = null + maghrib.style.color = 'var(--white-div)' + isha.style.color = null + break; + + case "isha": + remaining_name.innerText = "العشاء"; + remaining_.style.display = 'block' + remaining_time.style.display = 'block' + fajr_li.style.background = null + fajr_li.style.boxShadow = null + dhuhr_li.style.background = null + dhuhr_li.style.boxShadow = null + asr_li.style.background = null + asr_li.style.boxShadow = null + maghrib_li.style.background = null + maghrib_li.style.boxShadow = null + isha_li.style.background = 'var(--background_div_hover)' + isha_li.style.boxShadow = 'rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset' + fajr.style.color = null + dhuhr.style.color = null + asr.style.color = null + maghrib.style.color = null + isha.style.color = 'var(--white-div)' + break; + + default: + remaining_name.innerText = "لايوجد"; + remaining_.style.display = 'none' + remaining_time.style.display = 'none' + fajr_li.style.background = null + fajr_li.style.boxShadow = null + dhuhr_li.style.background = null + dhuhr_li.style.boxShadow = null + asr_li.style.background = null + asr_li.style.boxShadow = null + maghrib_li.style.background = null + maghrib_li.style.boxShadow = null + isha_li.style.background = null + isha_li.style.boxShadow = null + fajr.style.color = null + dhuhr.style.color = null + asr.style.color = null + maghrib.style.color = null + isha.style.color = null + break; + } + + + }, 1000); + + setInterval(() => { + + let Getlatitude = storage.getItem('latitude'); + let Getlongitude = storage.getItem('longitude'); + + if (statusPERM || Getlongitude && Getlatitude) { + prayer_time.style.display = "block"; + alertElm.style.display = "none"; + } + + else { + prayer_time.style.display = "none"; + alertElm.style.display = "block"; + } + + }, 2000); - let Getlatitude = storage.getItem('latitude'); - let Getlongitude = storage.getItem('longitude'); - - if (statusPERM || Getlongitude && Getlatitude) { - prayer_time.style.display = "block"; - alertElm.style.display = "none"; - } + } - else { - prayer_time.style.display = "none"; - alertElm.style.display = "block"; - } + else { - }, 2000); + prayer_time.style.display = "none"; + alertElm.style.display = "block"; - } + setInterval(() => { - else { + let Getlatitude = storage.getItem('latitude'); + let Getlongitude = storage.getItem('longitude'); - prayer_time.style.display = "none"; - alertElm.style.display = "block"; + if (statusPERM || Getlongitude && Getlatitude) { - setInterval(() => { + window.location = '/prayer.html'; + } - let Getlatitude = storage.getItem('latitude'); - let Getlongitude = storage.getItem('longitude'); + }, 2000); - if (statusPERM || Getlongitude && Getlatitude) { + } - window.location = '/prayer.html'; - } + } catch (error) { - }, 2000); + error_handling(error); } diff --git a/www/js/quran.js b/www/js/quran.js index 4572675..37fed4f 100644 --- a/www/js/quran.js +++ b/www/js/quran.js @@ -1,168 +1,176 @@ import Downloader from './modules/Downloader.js'; import loadJson from './modules/loadJson.js'; +import error_handling from './modules/error_handling.js'; export default async () => { - if (window.location.pathname === '/quran.html') { + if (window.location.pathname === '/quran.html') { - let mp3quran = await loadJson('/data/mp3quran.json'); - let quran_reader = document.getElementById("quran_reader"); + try { - for (let item of mp3quran) { + let mp3quran = await loadJson('/data/mp3quran.json'); + let quran_reader = document.getElementById("quran_reader"); - let li = document.createElement("li"); - let quran_reader_title = document.createElement("p"); - let quran_reader_div = document.createElement("div"); - let h3 = document.createElement("h3"); - let p = document.createElement("p"); + for (let item of mp3quran) { - quran_reader.appendChild(li); - li.className = 'quran_reader_li'; - li.id = `reader_id_${item?.id}`; - li.appendChild(quran_reader_title); - quran_reader_title.innerText = "القارئ"; - quran_reader_title.className = "quran_reader_title"; - li.appendChild(quran_reader_div); - quran_reader_div.className = "quran_reader_div"; - quran_reader_div.appendChild(h3); - h3.innerText = item?.name; - quran_reader_div.appendChild(p); - p.innerText = item?.rewaya; + let li = document.createElement("li"); + let quran_reader_title = document.createElement("p"); + let quran_reader_div = document.createElement("div"); + let h3 = document.createElement("h3"); + let p = document.createElement("p"); - } + quran_reader.appendChild(li); + li.className = 'quran_reader_li'; + li.id = `reader_id_${item?.id}`; + li.appendChild(quran_reader_title); + quran_reader_title.innerText = "القارئ"; + quran_reader_title.className = "quran_reader_title"; + li.appendChild(quran_reader_div); + quran_reader_div.className = "quran_reader_div"; + quran_reader_div.appendChild(h3); + h3.innerText = item?.name; + quran_reader_div.appendChild(p); + p.innerText = item?.rewaya; - let quran_reader_li = document.getElementsByClassName("quran_reader_li"); + } - for (let item of Array.from(quran_reader_li)) { + let quran_reader_li = document.getElementsByClassName("quran_reader_li"); - let li = document.getElementById(item.id); - li.addEventListener("click", e => { + for (let item of Array.from(quran_reader_li)) { - window.scrollTo(0, 0); - let Eid = Number(item?.id?.split("reader_id_")[1]); - mp3quran = mp3quran?.[Eid - 1]; - let quran_mp3_h3 = document.getElementById("quran_mp3_h3"); - let quran_reader = document.getElementById("quran_reader"); - let quran_reader_surah_header = document.getElementById("quran_reader_surah_header"); - let quran_reader_surah_header_back = document.getElementById("quran_reader_surah_header_back"); - let quran_reader_surah_header_title = document.getElementById("quran_reader_surah_header_title"); + let li = document.getElementById(item.id); + li.addEventListener("click", e => { - quran_mp3_h3.style.display = "none"; - quran_reader.style.display = "none"; - quran_reader_surah_header.style.display = "flex"; - quran_reader_surah_header_title.innerText = mp3quran?.name; + window.scrollTo(0, 0); + let Eid = Number(item?.id?.split("reader_id_")[1]); + mp3quran = mp3quran?.[Eid - 1]; + let quran_mp3_h3 = document.getElementById("quran_mp3_h3"); + let quran_reader = document.getElementById("quran_reader"); + let quran_reader_surah_header = document.getElementById("quran_reader_surah_header"); + let quran_reader_surah_header_back = document.getElementById("quran_reader_surah_header_back"); + let quran_reader_surah_header_title = document.getElementById("quran_reader_surah_header_title"); - // return Quran Page + quran_mp3_h3.style.display = "none"; + quran_reader.style.display = "none"; + quran_reader_surah_header.style.display = "flex"; + quran_reader_surah_header_title.innerText = mp3quran?.name; - quran_reader_surah_header_back.addEventListener("click", e => { - window.location.href = "/quran.html"; - }); + // return Quran Page + + quran_reader_surah_header_back.addEventListener("click", e => { + window.location.href = "/quran.html"; + }); + + // SURAH - // SURAH + let quran_reader_surah = document.getElementById("quran_reader_surah"); + quran_reader_surah.style.display = "block"; - let quran_reader_surah = document.getElementById("quran_reader_surah"); - quran_reader_surah.style.display = "block"; + let audioPlaying = false; - let audioPlaying = false; + for (let iterator of mp3quran?.audio) { - for (let iterator of mp3quran?.audio) { + let li = document.createElement("li"); + let h3 = document.createElement("h3"); + let quran_reader_surah_img = document.createElement("div"); + let play = document.createElement("img"); + let download = document.createElement("img"); - let li = document.createElement("li"); - let h3 = document.createElement("h3"); - let quran_reader_surah_img = document.createElement("div"); - let play = document.createElement("img"); - let download = document.createElement("img"); + quran_reader_surah.appendChild(li); + li.appendChild(h3); + h3.innerHTML = `${iterator?.id} ${iterator?.name}`; + li.appendChild(quran_reader_surah_img); + quran_reader_surah_img.appendChild(play); + play.id = `quran_reader_surah_img_play_${iterator?.id}`; + play.src = "/img/play.png"; + play.className = "quran_reader_surah_img_play"; + quran_reader_surah_img.appendChild(download); + download.id = `quran_reader_surah_img_download_${iterator?.id}`; + download.src = "/img/download.png"; + download.className = "quran_reader_surah_img_download"; - quran_reader_surah.appendChild(li); - li.appendChild(h3); - h3.innerHTML = `${iterator?.id} ${iterator?.name}`; - li.appendChild(quran_reader_surah_img); - quran_reader_surah_img.appendChild(play); - play.id = `quran_reader_surah_img_play_${iterator?.id}`; - play.src = "/img/play.png"; - play.className = "quran_reader_surah_img_play"; - quran_reader_surah_img.appendChild(download); - download.id = `quran_reader_surah_img_download_${iterator?.id}`; - download.src = "/img/download.png"; - download.className = "quran_reader_surah_img_download"; + // icon play - // icon play + let quran_reader_surah_img_play = document.getElementById(`quran_reader_surah_img_play_${iterator?.id}`); + let audioStart = true; + let audio = new Audio(iterator?.link); + quran_reader_surah_img.appendChild(audio); + audio.id = `quran_reader_audio_id_${iterator?.id}`; + audio.preload = 'none'; + audio.autoplay = false; - let quran_reader_surah_img_play = document.getElementById(`quran_reader_surah_img_play_${iterator?.id}`); - let audioStart = true; - let audio = new Audio(iterator?.link); - quran_reader_surah_img.appendChild(audio); - audio.id = `quran_reader_audio_id_${iterator?.id}`; - audio.preload = 'none'; - audio.autoplay = false; + quran_reader_surah_img_play.addEventListener("click", async e => { - quran_reader_surah_img_play.addEventListener("click", async e => { + e.preventDefault(); - e.preventDefault(); + let storage = window.localStorage; + let audioPlayingId = storage.getItem('audioPlayingId'); + let icon_audio = storage.getItem('icon_audio'); - let storage = window.localStorage; - let audioPlayingId = storage.getItem('audioPlayingId'); - let icon_audio = storage.getItem('icon_audio'); + if (icon_audio && icon_audio !== `quran_reader_surah_img_play_${iterator?.id}`) { - if (icon_audio && icon_audio !== `quran_reader_surah_img_play_${iterator?.id}`) { + let oldPlaying = document.getElementById(audioPlayingId); + let oldIconPlay = document.getElementById(icon_audio); - let oldPlaying = document.getElementById(audioPlayingId); - let oldIconPlay = document.getElementById(icon_audio); + oldPlaying.pause(); + oldIconPlay.src = "/img/play.png"; + audioPlaying = false; + audioStart = true; - oldPlaying.pause(); - oldIconPlay.src = "/img/play.png"; - audioPlaying = false; - audioStart = true; + } - } + if (audioStart && audioPlaying === false) { - if (audioStart && audioPlaying === false) { + audioPlaying = true; + audioStart = false; - audioPlaying = true; - audioStart = false; + storage.setItem('audioPlayingId', `quran_reader_audio_id_${iterator?.id}`); + storage.setItem('icon_audio', `quran_reader_surah_img_play_${iterator?.id}`); - storage.setItem('audioPlayingId', `quran_reader_audio_id_${iterator?.id}`); - storage.setItem('icon_audio', `quran_reader_surah_img_play_${iterator?.id}`); + if (audio.buffered.length === 0) { - if (audio.buffered.length === 0) { + quran_reader_surah_img_play.src = "/img/loading.svg"; + } - quran_reader_surah_img_play.src = "/img/loading.svg"; + await audio.play(); + quran_reader_surah_img_play.src = "/img/stop.png"; } - await audio.play(); - quran_reader_surah_img_play.src = "/img/stop.png"; - } + else { - else { + audioPlaying = false; + audioStart = true; + audio.pause(); + quran_reader_surah_img_play.src = "/img/play.png"; + } - audioPlaying = false; - audioStart = true; - audio.pause(); - quran_reader_surah_img_play.src = "/img/play.png"; - } + }); + // icon download - }); + let quran_reader_surah_img_download = document.getElementById(`quran_reader_surah_img_download_${iterator?.id}`); - // icon download + quran_reader_surah_img_download.addEventListener("click", async e => { - let quran_reader_surah_img_download = document.getElementById(`quran_reader_surah_img_download_${iterator?.id}`); + Downloader(iterator?.link, `${iterator?.name} - ${mp3quran?.name}.mp3`); - quran_reader_surah_img_download.addEventListener("click", async e => { + // let link = document.createElement('a'); + // link.href = iterator?.link; + // link.download = `${iterator?.name}-${item?.name}.mp3`; + // link.hidden = true + // link.click(); - Downloader(iterator?.link, `${iterator?.name} - ${mp3quran?.name}.mp3`); + }); + } - // let link = document.createElement('a'); - // link.href = iterator?.link; - // link.download = `${iterator?.name}-${item?.name}.mp3`; - // link.hidden = true - // link.click(); + }); - }); - } + } + + } catch (error) { - }); + error_handling(error); } diff --git a/www/js/radio.js b/www/js/radio.js index 037d5a3..26bc23d 100644 --- a/www/js/radio.js +++ b/www/js/radio.js @@ -1,71 +1,80 @@ import loadJson from './modules/loadJson.js'; +import error_handling from './modules/error_handling.js'; export default async () => { if (window.location.pathname === '/pages/radio.html') { - let radioJson = await loadJson("/data/radio.json"); - let back = document.getElementById('back'); - let radio_quran = document.getElementById('radio_quran'); - let audioPlaying = false; + try { - back.addEventListener("click", e => { - window.location.href = "/more.html"; - }); + let radioJson = await loadJson("/data/radio.json"); + let back = document.getElementById('back'); + let radio_quran = document.getElementById('radio_quran'); + let audioPlaying = false; - for (let item of radioJson) { + back.addEventListener("click", e => { + window.location.href = "/more.html"; + }); + + for (let item of radioJson) { - let li = document.createElement("li"); - let radio_quran_number = document.createElement("p"); - let radio_quran_title = document.createElement("h3"); - let radio_quran_play = document.createElement("img"); - let audioStart = true; - let audio = new Audio(item?.link); - audio.id = `radio_quran_audio_id_${item?.id}`; - audio.preload = 'none'; - audio.autoplay = false; + let li = document.createElement("li"); + let radio_quran_number = document.createElement("p"); + let radio_quran_title = document.createElement("h3"); + let radio_quran_play = document.createElement("img"); + let audioStart = true; + let audio = new Audio(item?.link); + audio.id = `radio_quran_audio_id_${item?.id}`; + audio.preload = 'none'; + audio.autoplay = false; - radio_quran.appendChild(li); - li.appendChild(radio_quran_number); - radio_quran_number.className = "radio_quran_number"; - radio_quran_number.innerText = item?.id; - li.appendChild(radio_quran_title); - radio_quran_title.className = "radio_quran_title"; - radio_quran_title.innerText = item?.name; - li.appendChild(radio_quran_play); - radio_quran_play.className = "radio_quran_play"; - radio_quran_play.id = `radio_quran_play_id_${item?.id}`; - radio_quran_play.src = "/img/play.png"; + radio_quran.appendChild(li); + li.appendChild(radio_quran_number); + radio_quran_number.className = "radio_quran_number"; + radio_quran_number.innerText = item?.id; + li.appendChild(radio_quran_title); + radio_quran_title.className = "radio_quran_title"; + radio_quran_title.innerText = item?.name; + li.appendChild(radio_quran_play); + radio_quran_play.className = "radio_quran_play"; + radio_quran_play.id = `radio_quran_play_id_${item?.id}`; + radio_quran_play.src = "/img/play.png"; - let radio_play = document.getElementById(`radio_quran_play_id_${item?.id}`); + let radio_play = document.getElementById(`radio_quran_play_id_${item?.id}`); - radio_play.addEventListener("click", async e => { + radio_play.addEventListener("click", async e => { - e.preventDefault(); + e.preventDefault(); - if (audioStart && audioPlaying === false) { + if (audioStart && audioPlaying === false) { - audioPlaying = true; - audioStart = false; + audioPlaying = true; + audioStart = false; - if (audio.buffered.length === 0) { + if (audio.buffered.length === 0) { - radio_play.src = "/img/loading.svg"; + radio_play.src = "/img/loading.svg"; + } + + await audio.play(); + radio_play.src = "/img/stop.png"; } - await audio.play(); - radio_play.src = "/img/stop.png"; - } + else { - else { + audioPlaying && audioStart === false ? audioPlaying = false : false; + audioStart = true; + audio.pause(); + radio_play.src = "/img/play.png"; + } - audioPlaying && audioStart === false ? audioPlaying = false : false; - audioStart = true; - audio.pause(); - radio_play.src = "/img/play.png"; - } + }); - }); + } + + } catch (error) { + + error_handling(error); } diff --git a/www/js/settings.js b/www/js/settings.js index 6d76c23..edb944f 100644 --- a/www/js/settings.js +++ b/www/js/settings.js @@ -1,131 +1,140 @@ import getGPS from './modules/getGPS.js'; +import error_handling from './modules/error_handling.js'; export default async () => { if (window.location.pathname === '/pages/settings.html') { - let storage = window.localStorage; - let Calculation = storage.getItem('Calculation'); - let Shafaq = storage.getItem('Shafaq'); - let Madhab = storage.getItem('Madhab'); - let latitude = storage.getItem('latitude'); - let longitude = storage.getItem('longitude'); - let notification = storage.getItem('notification'); - let Setfajr = storage.getItem('fajr'); - let Setdhuhr = storage.getItem('dhuhr'); - let Setasr = storage.getItem('asr'); - let Setmaghrib = storage.getItem('maghrib'); - let Setisha = storage.getItem('isha'); - let back = document.getElementById('back'); - let alert_el = document.getElementById('alert'); - let text_alert = document.getElementById('text_alert'); - let settings_save = document.getElementById('settings_save'); - let refresh_location = document.getElementById("refresh_location"); - let Calculation_settings = document.getElementById('Calculation_settings'); - let selected_Calculation = document.getElementById(Calculation ? Calculation : "UmmAlQura"); - let selected_Shafaq = document.getElementById(Shafaq ? Shafaq : "General"); - let selected_Madhab = document.getElementById(Madhab ? Madhab : "Shafi"); - let notifications_adhan = document.getElementById("notifications_adhan"); - let Shafaq_settings = document.getElementById("Shafaq_settings"); - let madhab_settings = document.getElementById("madhab_settings"); - let settings_fajr = document.getElementById("settings_fajr"); - let settings_dhuhr = document.getElementById("settings_dhuhr"); - let settings_asr = document.getElementById("settings_asr"); - let settings_maghrib = document.getElementById("settings_maghrib"); - let settings_isha = document.getElementById("settings_isha"); - let settings_longitude = document.getElementById("settings_longitude"); - let settings_latitude = document.getElementById("settings_latitude"); - let statusPERM = await permission_status(); - - // default value ( checked or selected or input ) - - selected_Calculation.selected = "selected"; - selected_Shafaq.selected = "selected"; - selected_Madhab.selected = "selected"; - notifications_adhan.checked = notification ? bool(notification) : true; - settings_fajr.value = Setfajr ? Number(Setfajr) : 0; - settings_dhuhr.value = Setfajr ? Number(Setdhuhr) : 0; - settings_asr.value = Setfajr ? Number(Setasr) : 0; - settings_maghrib.value = Setfajr ? Number(Setmaghrib) : 0; - settings_isha.value = Setfajr ? Number(Setisha) : 0; - settings_longitude.value = longitude ? longitude : null; - settings_latitude.value = latitude ? latitude : null; - - back.addEventListener("click", e => { - window.location.href = "/more.html"; - }); - - refresh_location.addEventListener('click', async (e) => { + try { + + let storage = window.localStorage; + let Calculation = storage.getItem('Calculation'); + let Shafaq = storage.getItem('Shafaq'); + let Madhab = storage.getItem('Madhab'); + let latitude = storage.getItem('latitude'); + let longitude = storage.getItem('longitude'); + let notification = storage.getItem('notification'); + let Setfajr = storage.getItem('fajr'); + let Setdhuhr = storage.getItem('dhuhr'); + let Setasr = storage.getItem('asr'); + let Setmaghrib = storage.getItem('maghrib'); + let Setisha = storage.getItem('isha'); + let back = document.getElementById('back'); + let alert_el = document.getElementById('alert'); + let text_alert = document.getElementById('text_alert'); + let settings_save = document.getElementById('settings_save'); + let refresh_location = document.getElementById("refresh_location"); + let Calculation_settings = document.getElementById('Calculation_settings'); + let selected_Calculation = document.getElementById(Calculation ? Calculation : "UmmAlQura"); + let selected_Shafaq = document.getElementById(Shafaq ? Shafaq : "General"); + let selected_Madhab = document.getElementById(Madhab ? Madhab : "Shafi"); + let notifications_adhan = document.getElementById("notifications_adhan"); + let Shafaq_settings = document.getElementById("Shafaq_settings"); + let madhab_settings = document.getElementById("madhab_settings"); + let settings_fajr = document.getElementById("settings_fajr"); + let settings_dhuhr = document.getElementById("settings_dhuhr"); + let settings_asr = document.getElementById("settings_asr"); + let settings_maghrib = document.getElementById("settings_maghrib"); + let settings_isha = document.getElementById("settings_isha"); + let settings_longitude = document.getElementById("settings_longitude"); + let settings_latitude = document.getElementById("settings_latitude"); + let statusPERM = await permission_status(); + + // default value ( checked or selected or input ) + + selected_Calculation.selected = "selected"; + selected_Shafaq.selected = "selected"; + selected_Madhab.selected = "selected"; + notifications_adhan.checked = notification ? bool(notification) : true; + settings_fajr.value = Setfajr ? Number(Setfajr) : 0; + settings_dhuhr.value = Setfajr ? Number(Setdhuhr) : 0; + settings_asr.value = Setfajr ? Number(Setasr) : 0; + settings_maghrib.value = Setfajr ? Number(Setmaghrib) : 0; + settings_isha.value = Setfajr ? Number(Setisha) : 0; + settings_longitude.value = longitude ? longitude : null; + settings_latitude.value = latitude ? latitude : null; + + back.addEventListener("click", e => { + window.location.href = "/more.html"; + }); + + refresh_location.addEventListener('click', async (e) => { + + if (statusPERM) { + + let GPS = await getGPS(); + let latitude = GPS.latitude; + let longitude = GPS.longitude; + + storage.setItem("latitude", latitude); + storage.setItem("longitude", longitude); + alert_el.style.display = "block" + + setTimeout(() => { + alert_el.style.display = 'none'; + window.location.href = "/pages/settings.html"; + }, 1000); + + } + + else { + + text_alert.innerText = "الرجاء السماح بالوصول الى الموقع الجغرافي او قم بإدخال الإحداثيات بشكل يدوي"; + alert_el.style.display = 'block'; + + setTimeout(() => { + alert_el.style.display = 'none'; + window.location.href = "/pages/settings.html"; + }, 3000); + + } + + }); + + + settings_save.addEventListener("click", async e => { + + storage.setItem("Calculation", Calculation_settings.value); + storage.setItem("Shafaq", Shafaq_settings.value); + storage.setItem("Madhab", madhab_settings.value); + storage.setItem("notification", notifications_adhan.checked); + storage.setItem("latitude", settings_latitude.value); + storage.setItem("longitude", settings_longitude.value); + + if (settings_fajr.value.length !== 0) { + storage.setItem("fajr", settings_fajr.value); + } + + if (settings_dhuhr.value.length !== 0) { + storage.setItem("dhuhr", settings_dhuhr.value); + } + + if (settings_asr.value.length !== 0) { + storage.setItem("asr", settings_asr.value); + } + + if (settings_maghrib.value.length !== 0) { + storage.setItem("maghrib", settings_maghrib.value); + } + + if (settings_isha.value.length !== 0) { + storage.setItem("isha", settings_isha.value); + } - if (statusPERM) { - let GPS = await getGPS(); - let latitude = GPS.latitude; - let longitude = GPS.longitude; - - storage.setItem("latitude", latitude); - storage.setItem("longitude", longitude); alert_el.style.display = "block" setTimeout(() => { alert_el.style.display = 'none'; window.location.href = "/pages/settings.html"; }, 1000); + }); - } - - else { - - text_alert.innerText = "الرجاء السماح بالوصول الى الموقع الجغرافي او قم بإدخال الإحداثيات بشكل يدوي"; - alert_el.style.display = 'block'; - - setTimeout(() => { - alert_el.style.display = 'none'; - window.location.href = "/pages/settings.html"; - }, 3000); - - } - - }); - - - settings_save.addEventListener("click", async e => { - - storage.setItem("Calculation", Calculation_settings.value); - storage.setItem("Shafaq", Shafaq_settings.value); - storage.setItem("Madhab", madhab_settings.value); - storage.setItem("notification", notifications_adhan.checked); - storage.setItem("latitude", settings_latitude.value); - storage.setItem("longitude", settings_longitude.value); - - if (settings_fajr.value.length !== 0) { - storage.setItem("fajr", settings_fajr.value); - } - - if (settings_dhuhr.value.length !== 0) { - storage.setItem("dhuhr", settings_dhuhr.value); - } + } catch (error) { - if (settings_asr.value.length !== 0) { - storage.setItem("asr", settings_asr.value); - } + error_handling(error); - if (settings_maghrib.value.length !== 0) { - storage.setItem("maghrib", settings_maghrib.value); - } - - if (settings_isha.value.length !== 0) { - storage.setItem("isha", settings_isha.value); - } - - - alert_el.style.display = "block" - - setTimeout(() => { - alert_el.style.display = 'none'; - window.location.href = "/pages/settings.html"; - }, 1000); - }); + } } } diff --git a/www/js/tfs.js b/www/js/tfs.js index 8ee0cd6..3ee8b65 100644 --- a/www/js/tfs.js +++ b/www/js/tfs.js @@ -1,71 +1,79 @@ import loadJson from './modules/loadJson.js'; +import error_handling from './modules/error_handling.js'; export default async () => { if (window.location.pathname === '/pages/tfs.html') { - let tfsJson = await loadJson("/data/tafseerMouaser.json"); - let quranJson = await loadJson("/data/quran.json"); - let back = document.getElementById('back'); - let more_header_title = document.getElementById('more_header_title'); - let tfs = document.getElementById('tfs'); - let tfs_ayat = document.getElementById('tfs_ayat'); - let tfs_part1 = document.getElementById('tfs_part1'); - let tfs_part2 = document.getElementById('tfs_part2'); - - back.addEventListener("click", e => { - window.location.href = "/more.html"; - }); - - for (let index = 1; index <= 114; index++) { - - let element = tfsJson.filter(e => Number(e?.sura_no) === index); - let li = document.createElement("li"); - let h3 = document.createElement("h3"); - let p = document.createElement("p"); - - tfs.appendChild(li); - li.appendChild(p); - p.innerText = element?.[0]?.sura_no; - li.appendChild(h3); - h3.innerText = element?.[0]?.sura_name_ar; - - li.addEventListener("click", e => { - - window.scrollTo(0, 0); - more_header_title.innerText = `تفسير سورة ${element?.[0]?.sura_name_ar}`; - tfs_part1.style.display = "none"; - tfs_part2.style.display = "block"; - - for (let item of element) { - - let ayah_id = Number(item?.aya_no); - let quran = quranJson?.[index - 1]?.array_verses?.[0]?.[ayah_id - 1]; - let li = document.createElement("li"); - let tfs_id = document.createElement("p"); - let ayaat = document.createElement("h3"); - let tafseer = document.createElement("p"); - - tfs_ayat.appendChild(li); - li.appendChild(tfs_id); - tfs_id.className = "tfs_id"; - tfs_id.innerText = item?.aya_no; - li.appendChild(ayaat); - ayaat.className = "ayaat"; - ayaat.innerText = quran?.ar; - li.appendChild(tafseer); - tafseer.className = "tafseer"; - tafseer.innerText = item?.aya_tafseer; - } - - back.addEventListener("click", e => { - window.location.href = "/pages/tfs.html"; - }); + try { + + let tfsJson = await loadJson("/data/tafseerMouaser.json"); + let quranJson = await loadJson("/data/quran.json"); + let back = document.getElementById('back'); + let more_header_title = document.getElementById('more_header_title'); + let tfs = document.getElementById('tfs'); + let tfs_ayat = document.getElementById('tfs_ayat'); + let tfs_part1 = document.getElementById('tfs_part1'); + let tfs_part2 = document.getElementById('tfs_part2'); + back.addEventListener("click", e => { + window.location.href = "/more.html"; }); - } + for (let index = 1; index <= 114; index++) { + + let element = tfsJson.filter(e => Number(e?.sura_no) === index); + let li = document.createElement("li"); + let h3 = document.createElement("h3"); + let p = document.createElement("p"); + + tfs.appendChild(li); + li.appendChild(p); + p.innerText = element?.[0]?.sura_no; + li.appendChild(h3); + h3.innerText = element?.[0]?.sura_name_ar; + + li.addEventListener("click", e => { + + window.scrollTo(0, 0); + more_header_title.innerText = `تفسير سورة ${element?.[0]?.sura_name_ar}`; + tfs_part1.style.display = "none"; + tfs_part2.style.display = "block"; + + for (let item of element) { + + let ayah_id = Number(item?.aya_no); + let quran = quranJson?.[index - 1]?.array_verses?.[0]?.[ayah_id - 1]; + let li = document.createElement("li"); + let tfs_id = document.createElement("p"); + let ayaat = document.createElement("h3"); + let tafseer = document.createElement("p"); + + tfs_ayat.appendChild(li); + li.appendChild(tfs_id); + tfs_id.className = "tfs_id"; + tfs_id.innerText = item?.aya_no; + li.appendChild(ayaat); + ayaat.className = "ayaat"; + ayaat.innerText = quran?.ar; + li.appendChild(tafseer); + tafseer.className = "tafseer"; + tafseer.innerText = item?.aya_tafseer; + } + + back.addEventListener("click", e => { + window.location.href = "/pages/tfs.html"; + }); + + }); + } + + } catch (error) { + + error_handling(error); + + } } } \ No newline at end of file diff --git a/www/pages/info.html b/www/pages/info.html index 49c27a2..be837e5 100644 --- a/www/pages/info.html +++ b/www/pages/info.html @@ -39,7 +39,7 @@

تطبيق التقوى

-

الإصدار: v1.0.1

+

الإصدار: v1.1.0

www.altaqwaa.org