#199 adding a new div on clicking on bnums

This commit is contained in:
Hamid Reza Mohammadi 2021-09-03 11:14:45 +04:30
parent 5d773f6b71
commit 937c76eabc
3 changed files with 18 additions and 6 deletions

View File

@ -313,7 +313,7 @@
<small>🖰 با دو بار کلیک روی واژه‌ها یا انتخاب متن و کلیک روی آنها می‌توانید آنها را در لغتنامهٔ دهخدا جستجو کنید.</small>
</p>
<p>
<small>🖐 <a role="button" onclick="btshmr()" class="actionlink">شماره‌گذاری ابیات</a></small>
<small>🖐 <a role="button" onclick="btshmr()" class="actionlink" id="bnum-button">حذف شماره‌ها</a></small>
@if (Model.GanjoorPage.Poem.GanjoorMetre != null)
{
<text>| <small>وزن: <a href="@Html.Raw($"/vazn/?v={Uri.EscapeUriString(Model.GanjoorPage.Poem.GanjoorMetre.Rhythm)}&amp;a={Model.GanjoorPage.PoetOrCat.Poet.Id}")">@Html.Raw(Model.GanjoorPage.Poem.GanjoorMetre.Rhythm)</a></small></text>

View File

@ -640,6 +640,11 @@ td.c2 {
margin: auto;
}
.bnumdiv {
clear: both;
background: transparent url(/image/cbk.jpg) top center repeat scroll;
}
@media(max-width: 768px) {
.b {

View File

@ -34,7 +34,15 @@ function getElements(classname, classname2, classname3, classname4, tagname, roo
function bnumClick(index) {
var msr1s = getElements("m1", "b2", "n", "l");
if (msr1s.length <= index) return;
alert(msr1s[index].innerHTML);
var divId = 'bnumpanel' + String(index);
var existingDiv = document.getElementById(divId);
if (existingDiv != null) {
existingDiv.remove();
return;
}
var divParent = msr1s[index].className == "m1" ? msr1s[index].parentElement : msr1s[index];
divParent.innerHTML = divParent.innerHTML + '<div class="bnumdiv" id="' + divId + '"><p>سلام</p></div>';
}
function coupletNumImage(bnum, color) {
@ -65,13 +73,12 @@ function btshmr_internal() {
var bnum = getElements("bnum");
if (bnum.length != 0) {
for (var i = 0; i < bnum.length; ++i) {
if (bnum[i].style.visibility == 'hidden')
bnum[i].style.visibility = 'visible';
else
bnum[i].style.visibility = 'hidden';
bnum[i].remove();
}
document.getElementById("bnum-button").innerText = "شماره‌گذاری ابیات";
return true;
}
document.getElementById("bnum-button").innerText = "حذف شماره‌ها";
var msr1s = getElements("m1", "b2", "n", "l");
if (msr1s.length == 0) return true;
var j = 0;