divan/TajikGanjoor/Pages/Index.cshtml
2026-09-12 13:24:45 +03:30

216 lines
9.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@page
@model IndexModel
@if (!string.IsNullOrEmpty(Model.LastError))
{
@Html.Raw(Model.LastError)
return;
}
@if (Model.Poets == null)
{
<p>
Хато дар дарёфти феҳристи суханварон
</p>
return;
}
<div class="text-center">
@if (Model.IsSearchPage)
{
@if (Model.Poems == null)
{
<div class="poem">
<h2>Ёфт менашавад ҷустаем мо</h2>
<p>
Шеъре шомили ин иборат ёфт нашуд.
</p>
</div>
}
else
for (int poemIndex = 0; poemIndex < Model.Poems.Count; poemIndex++)
{
var poem = Model.Poems[poemIndex];
<div class="sitem">
<a class="sitem-poet-portrait" href="@poem.Category.Poet.FullUrl" title="@poem.Category.Poet.Nickname">
<img src="/images/poets/@(poem.Category.Poet.Id).png" alt="@poem.Category.Poet.Nickname" loading="lazy"
onerror="this.onerror=null;this.src='/images/poets/999.png';" />
</a>
<div class="sitem-body">
<h2>
<a href="@poem.FullUrl">@poem.FullTitle</a>
</h2>
<div class="sit">
@Html.Raw(poem.PlainText)
</div>
</div>
</div>
}
<div class="spacer">&nbsp;</div>
@Html.Raw(Model.PagingToolsHtml)
}
else
@if (Model.IsHomePage)
{
var popularGroup = Model.PoetGroups.SingleOrDefault(g => g.Id == 0);
var centuryGroups = Model.PoetGroups.Where(g => g.Id != 0).ToList();
<div class="tg-poet-search">
<input type="text" id="tg-findpoet" placeholder="Ҷустуҷӯи шоир" oninput="tgInlineSearch(this.value)" />
<div class="tg-poet-grid" id="tg-found-poets"></div>
</div>
<div class="tg-view-switch">
<button type="button" class="tg-view-switch-btn active" data-view="century" onclick="tgSwitchView('century')">Аз рӯи аср</button>
<button type="button" class="tg-view-switch-btn" data-view="alpha" onclick="tgSwitchView('alpha')">Аз рӯи алифбо</button>
</div>
<div id="tg-view-century">
@if (popularGroup != null)
{
<div class="tg-century-heading">Шоирони маъмул</div>
<div class="tg-poet-grid">
@foreach (var poet in popularGroup.Poets)
{
<a class="tg-poet-card" href="@poet.FullUrl" title="@poet.Name" data-poet-id="@poet.Id" data-value="@poet.Nickname">
<span class="tg-poet-portrait">
<img src="/images/poets/@(poet.Id).png" alt="@poet.Nickname" loading="lazy"
onerror="this.onerror=null;this.src='/images/poets/999.png';" />
</span>
<span class="tg-poet-name">@poet.Nickname</span>
</a>
}
</div>
}
@if (centuryGroups.Count > 0)
{
<div class="tg-century-heading">Гурӯҳбандӣ бар асоси аср</div>
<div class="tg-century-nav">
@foreach (var g in centuryGroups)
{
<a href="#tg-pg-@g.Id" class="circled-number">@(g.HalfCenturyOrder + 2)</a>
}
</div>
@foreach (var century in centuryGroups)
{
@if (century.ShowInTimeLine)
{
<div class="tg-century-heading" id="tg-pg-@century.Id">@century.Name</div>
}
<div class="tg-poet-grid">
@foreach (var poet in century.Poets)
{
<a class="tg-poet-card" href="@poet.FullUrl" title="@poet.Name" data-poet-id="@poet.Id" data-value="@poet.Nickname">
<span class="tg-poet-portrait">
<img src="/images/poets/@(poet.Id).png" alt="@poet.Nickname" loading="lazy"
onerror="this.onerror=null;this.src='/images/poets/999.png';" />
</span>
<span class="tg-poet-name">@poet.Nickname</span>
</a>
}
</div>
}
}
</div>
<div id="tg-view-alpha" style="display:none">
<div class="tg-century-heading">Аз рӯи алифбо</div>
<div class="tg-poet-grid">
@foreach (var poet in Model.AlphabeticalPoets)
{
<a class="tg-poet-card" href="@poet.FullUrl" title="@poet.Name" data-poet-id="@poet.Id" data-value="@poet.Nickname">
<span class="tg-poet-portrait">
<img src="/images/poets/@(poet.Id).png" alt="@poet.Nickname" loading="lazy"
onerror="this.onerror=null;this.src='/images/poets/999.png';" />
</span>
<span class="tg-poet-name">@poet.Nickname</span>
</a>
}
</div>
</div>
}
else
{
@if (Model.IsPoetPage)
{
<div class="tg-poet-header">
<span class="tg-poet-portrait-lg">
<img src="/images/poets/@(Model.GanjoorPage.PoetOrCat.Poet.Id).png" alt="@Model.GanjoorPage.PoetOrCat.Poet.Nickname" loading="lazy"
onerror="this.onerror=null;this.src='/images/poets/999.png';" />
</span>
</div>
<div class="tg-poet-page">
@Html.Raw(Model.GanjoorPage.HtmlText)
</div>
}
else if (Model.IsCatPage)
{
<div class="tg-cat-page">
@Html.Raw(Model.GanjoorPage.HtmlText)
</div>
}
else if (Model.IsPoemPage)
{
@Html.Raw(Model.GanjoorPage.HtmlText)
@if (Model.GanjoorPage.Poem.Recitations != null && Model.GanjoorPage.Poem.Recitations.Length > 0)
{
<div class="tg-recitations">
<div class="tg-recitations-title">Хониш</div>
@foreach (var recitation in Model.GanjoorPage.Poem.Recitations)
{
<div class="tg-recitation">
<audio id="tg-audio-@recitation.Id" controls preload="none">
<source src="@recitation.Mp3Url" />
</audio>
<div class="tg-recitation-caption">
<span class="tg-recitation-title">@recitation.AudioTitle</span>
@if (!string.IsNullOrEmpty(recitation.AudioArtist))
{
<span class="tg-recitation-artist">— @recitation.AudioArtist</span>
}
<a class="tg-recitation-download" href="@recitation.Mp3Url" download title="Боргирӣ">⬇</a>
</div>
@if (recitation.InSyncWithText)
{
<script>
tgInitRecitationSync(
document.getElementById('tg-audio-@recitation.Id'),
'@Html.Raw($"{TajikGanjoor.APIRoot.InternetUrl}/api/audio/file/{recitation.Id}.xml")',
'@Html.Raw(recitation.AudioArtist)',
@recitation.Id
);
</script>
}
</div>
}
</div>
<div id="tg-sticky-player" class="tg-sticky-player" style="display:none;">
<span id="tg-sticky-narrator" class="tg-sticky-player-narrator"></span>
<div id="tg-sticky-audio-slot" class="tg-sticky-player-audio-slot"></div>
<a role="button" id="tg-sticky-lock" class="tg-sticky-player-btn" onclick="tgSwitchScrollLock()" title="Қулфи ҳамоҳангӣ бо матн"><span id="tg-sticky-lock-icon"></span></a>
<a role="button" class="tg-sticky-player-btn" onclick="tgScrollToCurrentVerse()" title="Гузариш ба байти ҷорӣ">
<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor"><path d="M12 8a4 4 0 100 8 4 4 0 000-8m8.94 3A9 9 0 0013 3.06V1h-2v2.06A9 9 0 003.06 11H1v2h2.06A9 9 0 0011 20.94V23h2v-2.06A9 9 0 0020.94 13H23v-2zM12 19a7 7 0 110-14 7 7 0 010 14z"/></svg>
</a>
<a role="button" class="tg-sticky-player-btn" onclick="tgCloseStickyPlayer()" title="Пӯшидан">
<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>
</a>
</div>
}
}
else
{
@Html.Raw(Model.GanjoorPage.HtmlText)
}
}
</div>