From 568debd74070ecb23433a8fb413b48dcc56141eb Mon Sep 17 00:00:00 2001 From: altaf-creator <64111012+altaf-creator@users.noreply.github.com> Date: Wed, 3 May 2023 22:12:11 +0700 Subject: Initial commit --- src/scripts/sura-list.js | 67 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/scripts/sura-list.js (limited to 'src/scripts/sura-list.js') diff --git a/src/scripts/sura-list.js b/src/scripts/sura-list.js new file mode 100644 index 0000000..a799b02 --- /dev/null +++ b/src/scripts/sura-list.js @@ -0,0 +1,67 @@ +var metadata; + +function load() { + var xhttp = new XMLHttpRequest(); + + xhttp.onreadystatechange = function () { + if (this.readyState == 4 && this.status == 200) { + loadMetadataButtons(this); + } + }; + + xhttp.open("GET", "./data/quran-data.xml", true); + xhttp.send(); + + try { + process.versions['electron']; + + var windowBtns = document.getElementsByClassName('window-button-container'); + + for (var i = 0; i < windowBtns.length; i++) { + windowBtns[i].style.display = 'grid'; + } + } catch { + var windowBtns = document.getElementsByClassName('window-button-container'); + + for (var i = 0; i < windowBtns.length; i++) { + windowBtns[i].style.display = 'none'; + } + } +} + +function loadMetadataButtons(xml) { + var sura, i, xmlDoc, txt; + + xmlDoc = xml.responseXML; + txt = ""; + sura = xmlDoc.getElementsByTagName('sura'); + + for (var i = 0; i < sura.length; i++) { + var index = sura[i].getAttribute('index'); + var tname = sura[i].getAttribute('tname'); + + try { + process.versions['electron']; + + document.getElementById("sura-ul").innerHTML += ` +
  • + + + + + +
    ${index}${tname}
    +
  • `; + } catch { + document.getElementById("sura-ul").innerHTML += ` +
  • + + + + + +
    ${index}${tname}
    +
  • `; + } + } +} \ No newline at end of file -- cgit v1.2.3