-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
60 lines (53 loc) · 1.46 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<link rel="shortcut icon" type="image/png" href="https://heb12.com/assets/logo.png">
<title>Heb12 Quran Reader</title>
</head>
<body>
<h1>Heb12 Quran Reader</h1>
<p>Text was acquired from https://www.ibiblio.org/xml/examples/religion/quran/quran.xml and converted to JSON.</p>
<p>Loading text...</p>
<script src="quran.js"></script>
<p>Loaded text.</p>
<select id="sura" onchange="showText()"></select>
<br>
<button onclick="previous()">Previous</button><button onclick="next()">Next</button>
<div id="content">asd</div>
</body>
<script>
var sura = document.getElementById("sura");
var content = document.getElementById("content");
var suras = text.tstmt.suracoll.sura;
window.onload = function() {
for (var i = 0; i < suras.length; i++) {
var e = document.createElement("OPTION");
e.innerText = suras[i].bktlong;
sura.appendChild(e);
}
showText();
}
function showText() {
while (content.firstChild) {
content.removeChild(content.firstChild);
}
var selected = suras[sura.selectedIndex].v;
for (var i = 0; i < selected.length; i++) {
var e = document.createElement("P");
e.id = String(i + 1);
e.innerText = e.id + ": " + selected[i];
content.appendChild(e)
}
}
function next() {
sura.selectedIndex++;
showText();
}
function previous() {
sura.selectedIndex--;
showText();
}
</script>
</html>