Skip to content

Commit

Permalink
Fix the bismillah for 1 and 9
Browse files Browse the repository at this point in the history
  • Loading branch information
meezaan committed May 8, 2021
1 parent 5f6296e commit a758f76
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion html/public/js/jquery.mediaplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jQuery( document ).ready( function( $ ) {
w.surahChanged = true;
}
});
if (w.surahChanged === true) {
if (w.surahChanged === true && w.surah !=9 && w.surah != 1) {
number = 1;
// Update UI
console.log(w.surah);
Expand Down
40 changes: 24 additions & 16 deletions html/public/js/jquery.quran.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,30 @@ jQuery( document ).ready( function( $ ) {
const sleep = (milliseconds) => {
return new Promise(resolve => setTimeout(resolve, milliseconds))
}
// First play bismillah
var bUrl = 'https://cdn.islamic.network/quran/audio/128/ar.alafasy/1.mp3';
$('#activeAyah').attr('src', bUrl)
player.pause();
if (player.paused) {
player.load();
player.oncanplaythrough = player.play();
// Sleep because the bismillah is 6 seconds
sleep(6000).then(() => {
// Now set surah to play normally
player.pause();
if (player.paused) {
//var url = 'https://cdn.islamic.network/quran/audio/128/ar.alafasy/' + ayah + '.mp3';
$("#playThisAyah" + ayah).trigger('click');
}
});
if (surah !=1 && surah !=9) {
// First play bismillah
var bUrl = 'https://cdn.islamic.network/quran/audio/128/ar.alafasy/1.mp3';
$('#activeAyah').attr('src', bUrl)
player.pause();
if (player.paused) {
player.load();
player.oncanplaythrough = player.play();
// Sleep because the bismillah is 6 seconds
sleep(6000).then(() => {
// Now set surah to play normally
player.pause();
if (player.paused) {
//var url = 'https://cdn.islamic.network/quran/audio/128/ar.alafasy/' + ayah + '.mp3';
$("#playThisAyah" + ayah).trigger('click');
}
});
}
} else {
player.pause();
if (player.paused) {
//var url = 'https://cdn.islamic.network/quran/audio/128/ar.alafasy/' + ayah + '.mp3';
$("#playThisAyah" + ayah).trigger('click');
}
}
},
monitorEditions: function(element, reference) {
Expand Down

0 comments on commit a758f76

Please sign in to comment.