#256 allow locking recitation to text from the beginning in new UI

This commit is contained in:
Hamid Reza Mohammadi 2021-12-10 21:08:40 +03:30
parent e6c77d505b
commit 2a5cde856b
3 changed files with 38 additions and 11 deletions

View File

@ -17,7 +17,8 @@
<a role="button" onclick="document.getElementById('audio-@(nRecitationIndex + 1)').play()" class="actionlink">@recitaion.AudioTitle</a> @Html.Raw(Model.getAudioDesc(recitaion, nRecitationIndex == 0))
</div>
<div class="audio-partial-action-box">
<a role="button" class="w3tooltip cursor-pointer recitation-button" href="@($"/AudioClip/?a={recitaion.Id}")" onclick="wpopen(this.href); return false">دریافت <i class="recitation-icons recitation-download"></i><span class="w3tooltiptext">دریافت خوانش</span></a>
<a role="button" class="w3tooltip cursor-pointer recitation-button" href="@($"/AudioClip/?a={recitaion.Id}")" onclick="wpopen(this.href); return false"><i class="recitation-icons recitation-download"></i><span class="w3tooltiptext">دریافت خوانش</span></a>
<a role="button" class="w3tooltip cursor-pointer recitation-button" onclick="switchPlayerScrollLock()"><i class="recitation-icons recitation-scrollunlock"></i><span class="w3tooltiptext">قفل متن روی خوانش</span></a>
</div>
<script>
document.getElementById('audio-@(nRecitationIndex + 1)').addEventListener('play', () => {

View File

@ -1253,3 +1253,11 @@ ol {
.recitation-download::after {
content: 'download';
}
.recitation-scrollunlock::after {
content: 'no_encryption';
}
.recitation-scrolllock::after {
content: 'lock';
}

View File

@ -125,6 +125,33 @@ function btshmr(poemId) {
setTimeout(function () { btshmr_internal(poemId); }, 1);
}
function switchPlayerScrollLock() {
playerScrollLock = !playerScrollLock;
if (playerScrollLock) {
$('#scroll-lock').text('🔒');
}
else {
$('#scroll-lock').text('🔓');
}
if (playerScrollLock) {
const lockButtons = document.querySelectorAll('.recitation-scrollunlock');
lockButtons.forEach(function (lockButton) {
lockButton.classList.toggle('recitation-scrollunlock');
lockButton.classList.toggle('recitation-scrolllock');
});
}
else {
const lockButtons = document.querySelectorAll('.recitation-scrolllock');
lockButtons.forEach(function (lockButtons) {
lockButtons.classList.toggle('recitation-scrollunlock');
lockButtons.classList.toggle('recitation-scrolllock');
});
}
}
function hilightverse(vnum, clr, sc, forceScroll) {
var root = document;
if (typeof root == "string") root = document.getElementById(root);
@ -169,16 +196,7 @@ function hilightverse(vnum, clr, sc, forceScroll) {
btnLock.id = "InlineLockButton";
btnLock.setAttribute('role', 'button');
btnLock.className = 'inlineanchor';
btnLock.onclick = function () {
playerScrollLock = !playerScrollLock;
if (playerScrollLock) {
$('#scroll-lock').text('🔒');
}
else {
$('#scroll-lock').text('🔓');
}
};
btnLock.onclick = switchPlayerScrollLock;
element.lastChild.appendChild(btnLock);
var btnLockIcon = document.createElement("i");