-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsc.js
73 lines (60 loc) · 1.75 KB
/
sc.js
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
61
62
63
64
65
66
67
68
69
70
71
72
73
var myAyat="",
keyWord="\u0625\u0628\u0631\u0627\u0647\u064A\u0645",
mySurrah="2",
lang="ar",
searchUrl="http://api.alquran.cloud/search/";
/*http://api.alquran.cloud/search/{{keyword}}/{{surah}}/{{edition or language}}*/
console.log(searchUrl+keyWord+"/"+mySurrah+"/"+lang);
$.getJSON(searchUrl+keyWord+"/"+mySurrah+"/"+lang, function(json, textStatus) {
if (json.code===200) console.log("success");
else {
console.log(json.code);
}
});
/*Passage coranique */
function Passage (type,sourat,ayat){
Passage.prototype.type=type;// wa3id,Sabr,chokr
Passage.prototype.sourat=sourat;// number of soura
Passage.prototype.ayat =ayat; // array of ayat
}
function getPassage (sourat,ayat,reciteur)
{
var str;
var myurl = "http://api.alquran.cloud/surah/"+sourat+"/"+reciteur;
$.ajax({
async:true,
url: myurl,
dataType: 'json',
})
.done(function(json) {
for (var i = ayat[0]; i <= ayat[1]; i++) {
var t=json.data;
if( t.ayahs[i]!==undefined){
var aya=t.ayahs[i].text;
var aud=t.ayahs[i].audio;
var num =t.ayahs[i].number;
str=aud;
console.log("audio"+aud);
$(".ayat").append("<span class='item'>"+aya+" ["+i+"] "+"</span>");
/*-----------AUDIO--------------------*/
$("#audio").append("<audio controls src='"+aud+"'>"+"</audio>");
console.log("<audio controls src='"+aud+"'>"+"</audio>");
}
else {
$(".ayat").append("ayat"+i+" does not exist");
}}})
.always(function(){
console.log("str = "+ str);
})
;
}
console.log("test : "+getPassage(4,[3,20],"ar.alafasy"));
function afficherReciteur(){
}
// $.getJSON(searchUrl+surrah+"/"+keyWord+"/"+lang, function(json, textStatus) {
// if (json.code==="200") console.log("success");
// else {
// console.log("error");
// }
//
// });