Skip to content

Commit

Permalink
Disable surah selector until first ayah is played
Browse files Browse the repository at this point in the history
  • Loading branch information
meezaan committed May 30, 2021
1 parent 0a4d095 commit 3271364
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
7 changes: 5 additions & 2 deletions html/public/js/jquery.mediaplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,13 @@ jQuery( document ).ready( function( $ ) {
w.player.load();
w.player.oncanplaythrough = w.player.play();
}

if (w.firstPlayCompleted == false) {
console.log('yes');
if ($('.playThisAyah').hasClass('hide')) {
$('.playThisAyah').removeClass('hide');
$('.playThisAyah').removeClass('hide');
}
if ($('#surahSelector').attr('disabled') == 'disabled') {
$('#surahSelector').attr('disabled', false);
}
}
$('.playThisAyah').on('click', function() {
Expand Down
1 change: 0 additions & 1 deletion html/public/js/jquery.quran.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ jQuery( document ).ready( function( $ ) {
// 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');
}
});
Expand Down
8 changes: 4 additions & 4 deletions views/quran.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<div class="col-lg-3 col-md-3 col-sm-12 col-xs-12">
<form>
<div class="form-group">
<select id="surahSelector" name="surahSelector" title="Select Surah" class="form-control" >
<select id="surahSelector" name="surahSelector" title="Select Surah" class="form-control" disabled="disabled" >
<?php $surahChangers = []; $count=0; ?>
<?php foreach ($suwar->data as $ss) {
$count = $count + $ss->numberOfAyahs;
Expand All @@ -60,7 +60,7 @@
<form class="align-center">
<div class="form-group">
<label for="editionSelector">Show translation </label>
<select id="editionSelector" name="editionSelector" multiple="multiple" title="Select Language" class="form-control" >
<select id="editionSelector" name="editionSelector" multiple="multiple" title="Select Language" class="form-control">
<?php foreach (Generic::getEditionsByLanguage($editions['editions']->data) as $language => $edition) { ?>
<optgroup label="<?= $language; ?>">
<?php foreach ($edition as $e) { ?>
Expand All @@ -80,8 +80,8 @@
</div>
</div>
</div>
<script src="/public/js/jquery.mediaplayer.js?v=11"></script>
<script src="/public/js/jquery.quran.js?v=1"></script>
<script src="/public/js/jquery.mediaplayer.js?v=13"></script>
<script src="/public/js/jquery.quran.js?v=2"></script>
<script>
var quran = <?php echo json_encode($quran->data); ?>;
var surahChangers = <?php echo json_encode($surahChangers); ?>;
Expand Down

0 comments on commit 3271364

Please sign in to comment.