96 lines
No EOL
4.3 KiB
Text
96 lines
No EOL
4.3 KiB
Text
module namespace dict = 'http://ossetic-studies.org/ns/abaevdict-site/dictionary';
|
|
|
|
import module namespace shared = 'http://ossetic-studies.org/ns/abaevdict-site/shared' at '../shared/shared.xq';
|
|
import module namespace abv-m = 'http://ossetic-studies.org/ns/abaevdict-mod' at '../../abv-mod.xqm';
|
|
|
|
(: Sidebar with entry list. Requires abaev.js to be loaded. :)
|
|
|
|
declare function dict:sidebar($lang as xs:string) {
|
|
(
|
|
<button id="open-leftbar">
|
|
{html:doc('../../../static/chevron-right.svg')}
|
|
</button>,
|
|
<button id="close-leftbar">
|
|
{html:doc('../../../static/chevron-left.svg')}
|
|
</button>,
|
|
<aside id="leftbar">
|
|
<fieldset>
|
|
<input type="text" id="filter-entries"
|
|
placeholder="{if ($lang = 'ru') then 'Быстрый фильтр' else 'Quick filter…'}"/>
|
|
<label>
|
|
<input id="show-re" type="checkbox" role="switch"></input>
|
|
{if ($lang = 'ru') then 'Производные' else 'Show subentries'}
|
|
</label>
|
|
</fieldset>
|
|
<nav id="entrylist"></nav> <!-- To be filled dynamically in js -->
|
|
</aside>
|
|
)
|
|
};
|
|
|
|
declare function dict:main-view($lang as xs:string,
|
|
$p as xs:integer,
|
|
$xpath as xs:string,
|
|
$entry as xs:string) {
|
|
(dict:sidebar($lang),
|
|
<main>
|
|
{for $doc at $i in $shared:sorted
|
|
where $i > ($p - 1) * $shared:items-per-page and $i <= $p * $shared:items-per-page
|
|
let $html := if ($xpath != '' and $entry = $doc/@xml:id)
|
|
then abv-m:mark-element(
|
|
doc(`abaevdict_{$lang}/xml/{$doc/@xml:id}.xml`),
|
|
$xpath) => abv-m:make-html($lang)
|
|
else
|
|
let $sd := session:get('searchData')
|
|
let $sn := session:get('searchN')
|
|
return if (exists($sd) and $sd($sn)('entry') = $doc/@xml:id)
|
|
then abv-m:make-html($sd($sn)('tei'), $lang)
|
|
else doc(`abaevdict_{$lang}/html/{$doc/@xml:id}.html`)
|
|
return <div class="abv-lex">{(
|
|
(: Block with icons to the left of entry (floating) :)
|
|
<div class="icons">
|
|
{
|
|
<a href="dict/{$doc/@xml:id}">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-link-45deg" viewBox="0 0 16 16">
|
|
<path d="M4.715 6.542 3.343 7.914a3 3 0 1 0 4.243 4.243l1.828-1.829A3 3 0 0 0 8.586 5.5L8 6.086a1 1 0 0 0-.154.199 2 2 0 0 1 .861 3.337L6.88 11.45a2 2 0 1 1-2.83-2.83l.793-.792a4 4 0 0 1-.128-1.287z"/>
|
|
<path d="M6.586 4.672A3 3 0 0 0 7.414 9.5l.775-.776a2 2 0 0 1-.896-3.346L9.12 3.55a2 2 0 1 1 2.83 2.83l-.793.792c.112.42.155.855.128 1.287l1.372-1.372a3 3 0 1 0-4.243-4.243z"/>
|
|
</svg>
|
|
</a>,
|
|
if (doc('abaevdict_index/mentioned_en.xml')/lang-index
|
|
/lang[@id != 'os' and
|
|
not(starts-with(@id,'os-'))]/word/entry[@id=string($doc/@xml:id)])
|
|
then <a class="abv-map" data-abv-entry="{$doc/@xml:id}">
|
|
<img src="/static/map.png"></img>
|
|
</a>}</div>,
|
|
$html)}</div>
|
|
}
|
|
</main>,
|
|
<footer>
|
|
<nav class="pagination">
|
|
<ul>
|
|
<li>
|
|
{if ($p > 1) then <a href="?page={$p - 1}">Previous page</a> else ()}
|
|
</li>
|
|
</ul>
|
|
<!-- <ul><li>Page {$p} of {$page:total}</li></ul> -->
|
|
<ul class="abv-nextpage">
|
|
<li>
|
|
{if ($p < $shared:total) then
|
|
<a class="pagination__next" href="?page={$p + 1}">Next page</a> else ()}
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
</footer>,
|
|
<dialog id="modal_map">
|
|
<article>
|
|
<header>
|
|
<button class="abv-close-map" aria-label="Close" rel="prev">
|
|
</button>
|
|
<p>{if ($lang = 'ru') then 'Карта' else 'Map'}</p>
|
|
</header>
|
|
<p>
|
|
<div id="map_display" style="width:100%;height:80%;"></div>
|
|
</p>
|
|
<footer><button class="abv-close-map">{if ($lang = 'ru') then 'Закрыть' else 'Close'}</button></footer>
|
|
</article>
|
|
</dialog>)
|
|
}; |