Skip to content

Commit

Permalink
Fix surah repeat
Browse files Browse the repository at this point in the history
  • Loading branch information
meezaan committed May 23, 2021
1 parent 59c352d commit 502140c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
22 changes: 14 additions & 8 deletions html/public/js/jquery.mediaplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ jQuery( document ).ready( function( $ ) {
if (w.surah !=9 && w.surah != 1) {
number = 1;
}
console.log('hello');
// Update UI
//$('.displayedSurah' + w.surah).removeClass('hide').siblings().addClass('hide');
$('#surahSelector').val(w.surah).trigger('change');
Expand All @@ -64,6 +63,7 @@ jQuery( document ).ready( function( $ ) {
w.realNumber = number;
}
}
w.highlightActive(number);
} else if (w.mode == 'ayah') {
// Don't change the number.
} else { // w.mode == 'surah'
Expand All @@ -74,14 +74,11 @@ jQuery( document ).ready( function( $ ) {
} else if (number == w.lastAyah) {
number = 1;
}
if (w.surah > 1 && number > 1) {
w.highlightActive(number);
}
}
// console.log(number);
var ayah = $('.ayahAudio' + number);
ayah.addClass('ayah-playing');
w.container.animate({
scrollTop: (ayah.offset().top - 100), scrollLeft: 0
},
777);
// console.log(number, w.surah);
$('#activeAyah').attr('src', 'https://cdn.islamic.network/quran/audio/128/ar.alafasy/' + number + '.mp3');
if (w.player.paused) {
w.player.load();
Expand Down Expand Up @@ -109,6 +106,15 @@ jQuery( document ).ready( function( $ ) {
}
});
},
highlightActive: function(number) {
var w = this;
var ayah = $('.ayahAudio' + number);
ayah.addClass('ayah-playing');
w.container.animate({
scrollTop: (ayah.offset().top - 100), scrollLeft: 0
},
777);
},
zoomIntoThisAyah: function() {
$('.zoomIntoThisAyah').on('click', function() {
number = $(this).data('number');
Expand Down
2 changes: 1 addition & 1 deletion views/ayah.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
</div>

<script src="/public/js/jquery.ayah.js?v=1"></script>
<script src="/public/js/jquery.mediaplayer.js?v=9"></script>
<script src="/public/js/jquery.mediaplayer.js?v=10"></script>
<script>
$(function() {
$('#editionSelector').multiselect({ enableFiltering: true, enableCaseInsensitiveFiltering: true, dropUp: true, maxHeight: 400 });
Expand Down
2 changes: 1 addition & 1 deletion views/quran.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
</div>
</div>
</div>
<script src="/public/js/jquery.mediaplayer.js?v=9"></script>
<script src="/public/js/jquery.mediaplayer.js?v=10"></script>
<script src="/public/js/jquery.quran.js?v=1"></script>
<script>
var quran = <?php echo json_encode($quran->data); ?>;
Expand Down
2 changes: 1 addition & 1 deletion views/surah.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
</div>
<hr />
</div>
<script src="/public/js/jquery.mediaplayer.js?v=9"></script>
<script src="/public/js/jquery.mediaplayer.js?v=10"></script>
<script src="/public/js/jquery.surah.js?v=7"></script>

<script>
Expand Down

0 comments on commit 502140c

Please sign in to comment.