Compare commits
No commits in common. "6e7cf5a3f139ab959df58b78af5b34c1b064db46" and "f2a1c159517dfdfa189626a48dba0fe21dbd64af" have entirely different histories.
6e7cf5a3f1
...
f2a1c15951
3 changed files with 61 additions and 163 deletions
|
@ -455,40 +455,13 @@ details[open] summary {}
|
||||||
dialog {}
|
dialog {}
|
||||||
dialog::backdrop {}
|
dialog::backdrop {}
|
||||||
|
|
||||||
dialog > article {
|
dialog#modal_map > article {
|
||||||
width: 75vw !important;
|
width: 75vw !important;
|
||||||
height: 85vh !important;
|
height: 85vh !important;
|
||||||
max-width: 75vw !important;
|
max-width: 75vw !important;
|
||||||
max-height: 85vh !important;
|
max-height: 85vh !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog#modal_searchResults > article {
|
|
||||||
padding-top: 0;
|
|
||||||
padding-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
dialog#modal_searchResults > article > table > thead {
|
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
z-index: 1055;
|
|
||||||
}
|
|
||||||
|
|
||||||
dialog#modal_searchResults > article > header {
|
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
z-index: 1055;
|
|
||||||
}
|
|
||||||
dialog#modal_searchResults > article > footer {
|
|
||||||
position: sticky;
|
|
||||||
bottom: 0;
|
|
||||||
z-index: 1055;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*dialog#modal_searchResults > article > p > table > tbody {
|
|
||||||
height:100%;
|
|
||||||
overflow-y: scroll;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/* Some form fields, `details`, elements with `tabindex`, and possibly other
|
/* Some form fields, `details`, elements with `tabindex`, and possibly other
|
||||||
elements can be focussed. You should use `:focus-visible` instead of `:focus`
|
elements can be focussed. You should use `:focus-visible` instead of `:focus`
|
||||||
whenever possible. As the former is not yet widely supported, you need to do it
|
whenever possible. As the former is not yet widely supported, you need to do it
|
||||||
|
|
118
static/abaev.js
118
static/abaev.js
|
@ -1,9 +1,22 @@
|
||||||
$( document ).ready(function() {
|
$( document ).ready(function() {
|
||||||
// GLOBALS
|
function bindMapOpen() {
|
||||||
// Link elements that do not have href out of the box
|
// $('#modal_map').data('abv-entry',$(this).data('abv-entry'));
|
||||||
$('.link').on("click", function () {
|
// $('#modal_map')[0].showModal();
|
||||||
window.location=$(this)[0].dataset.href+window.location.search+window.location.hash;
|
let url = `./dict/map-info/${$(this).data('abv-entry')}`;
|
||||||
});
|
|
||||||
|
fetch(url)
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(out => {
|
||||||
|
$('#modal_map').data('map',out);
|
||||||
|
$('#modal_map')[0].showModal();
|
||||||
|
})
|
||||||
|
.catch(err => console.log(err));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Event to open map modal. We have to bind it
|
||||||
|
// when the button is shown, otherwise it will
|
||||||
|
// not work for newly loaded entries.
|
||||||
|
$('.abv-map').on("click", bindMapOpen);
|
||||||
|
|
||||||
// init Infinite Scroll
|
// init Infinite Scroll
|
||||||
$('main').infiniteScroll({
|
$('main').infiniteScroll({
|
||||||
|
@ -13,71 +26,10 @@ $( document ).ready(function() {
|
||||||
//hideNav: '.pagination',
|
//hideNav: '.pagination',
|
||||||
});
|
});
|
||||||
|
|
||||||
// SEARCH RESULTS MODAL
|
|
||||||
$('#abv-btn-searchResults').on("click", function () {
|
|
||||||
$('#modal_searchResults')[0].showModal();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Close search modal
|
|
||||||
$('.abv-close-search').on("click", function () {
|
|
||||||
$('#modal_searchResults')[0].close();
|
|
||||||
});
|
|
||||||
|
|
||||||
// MAP MODAL
|
|
||||||
// This event binding is done on page load and also whenever new entries are loaded.
|
|
||||||
bindMapOpen = function () {
|
|
||||||
let url = `./dict/map-info/${$(this).data('abv-entry')}`;
|
|
||||||
|
|
||||||
fetch(url)
|
|
||||||
.then(res => res.json())
|
|
||||||
.then(out => {
|
|
||||||
$('#modal_map').data('map',out);
|
|
||||||
$('#modal_map')[0].showModal();
|
|
||||||
})
|
|
||||||
.catch(err => console.log(err));
|
|
||||||
};
|
|
||||||
|
|
||||||
// Event to open map modal.
|
|
||||||
$('.abv-map').on("click", bindMapOpen);
|
|
||||||
|
|
||||||
$('main').on( 'append.infiniteScroll', function( event, body, path, response ) {
|
$('main').on( 'append.infiniteScroll', function( event, body, path, response ) {
|
||||||
$('.abv-map').on("click", bindMapOpen);
|
$('.abv-map').on("click", bindMapOpen);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Close map modal
|
|
||||||
$('.abv-close-map').on("click", function () {
|
|
||||||
$('#modal_map')[0].close();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Load map data when dialog opens
|
|
||||||
$('#modal_map').on("toggle", function () {
|
|
||||||
map = document.getElementById('map_display');
|
|
||||||
var layout = {
|
|
||||||
// title: {
|
|
||||||
// text: 'Canadian cities',
|
|
||||||
// font: {
|
|
||||||
// family: 'Droid Serif, serif',
|
|
||||||
// size: 16
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
geo: {
|
|
||||||
scope: 'world',
|
|
||||||
resolution: 50,
|
|
||||||
fitbounds: 'locations',
|
|
||||||
showrivers: true,
|
|
||||||
rivercolor: '#fff',
|
|
||||||
showlakes: true,
|
|
||||||
lakecolor: '#fff',
|
|
||||||
showland: true,
|
|
||||||
landcolor: '#EAEAAE',
|
|
||||||
showcountries: false,
|
|
||||||
subunitcolor: '#d3d3d3'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Plotly.newPlot(map, [$(this).data('map')], layout);
|
|
||||||
});
|
|
||||||
|
|
||||||
// HASH NAVIGATION
|
|
||||||
// If the hash is on the page, scroll a little bit above to account for top nav height
|
// If the hash is on the page, scroll a little bit above to account for top nav height
|
||||||
if ( $(decodeURI(document.location.hash)).length > 0) {
|
if ( $(decodeURI(document.location.hash)).length > 0) {
|
||||||
window.scrollBy(0,-$('header').height());
|
window.scrollBy(0,-$('header').height());
|
||||||
|
@ -97,7 +49,6 @@ $( document ).ready(function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// ENTRY LIST SIDE PANEL
|
|
||||||
// Function to scroll the entry list to the selected entry OR to the first entry displayed on the current page if there is no hash in the URL
|
// Function to scroll the entry list to the selected entry OR to the first entry displayed on the current page if there is no hash in the URL
|
||||||
function scrollView() {
|
function scrollView() {
|
||||||
var $container = $('#entrylist')
|
var $container = $('#entrylist')
|
||||||
|
@ -152,6 +103,39 @@ $( document ).ready(function() {
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Close map modal
|
||||||
|
$('.abv-close-map').on("click", function () {
|
||||||
|
$('#modal_map')[0].close();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Load map data when dialog opens
|
||||||
|
$('#modal_map').on("toggle", function () {
|
||||||
|
map = document.getElementById('map_display');
|
||||||
|
var layout = {
|
||||||
|
// title: {
|
||||||
|
// text: 'Canadian cities',
|
||||||
|
// font: {
|
||||||
|
// family: 'Droid Serif, serif',
|
||||||
|
// size: 16
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
geo: {
|
||||||
|
scope: 'world',
|
||||||
|
resolution: 50,
|
||||||
|
fitbounds: 'locations',
|
||||||
|
showrivers: true,
|
||||||
|
rivercolor: '#fff',
|
||||||
|
showlakes: true,
|
||||||
|
lakecolor: '#fff',
|
||||||
|
showland: true,
|
||||||
|
landcolor: '#EAEAAE',
|
||||||
|
showcountries: false,
|
||||||
|
subunitcolor: '#d3d3d3'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Plotly.newPlot(map, [$(this).data('map')], layout);
|
||||||
|
});
|
||||||
|
|
||||||
// Event handler to show subentries
|
// Event handler to show subentries
|
||||||
$('#show-re').on("change", function () {
|
$('#show-re').on("change", function () {
|
||||||
if($(this).prop('checked')) {
|
if($(this).prop('checked')) {
|
||||||
|
|
|
@ -55,15 +55,13 @@ declare function page:header($lang as xs:string, $href-other as xs:string) {
|
||||||
<li>{
|
<li>{
|
||||||
(element {if ($lang = 'ru') then 'mark' else 'a'}{
|
(element {if ($lang = 'ru') then 'mark' else 'a'}{
|
||||||
if ($lang != 'ru') then
|
if ($lang != 'ru') then
|
||||||
(attribute class {'link'},
|
(attribute onclick {`window.location='{$href-other}'+window.location.search;`},
|
||||||
attribute data-href {`{$href-other}`},
|
|
||||||
attribute href {'#'}) else (),
|
attribute href {'#'}) else (),
|
||||||
'ru'
|
'ru'
|
||||||
}, ' / ',
|
}, ' / ',
|
||||||
element {if ($lang = 'ru') then 'a' else 'mark'}{
|
element {if ($lang = 'ru') then 'a' else 'mark'}{
|
||||||
if ($lang = 'ru') then
|
if ($lang = 'ru') then
|
||||||
(attribute class {'link'},
|
(attribute onclick {`window.location='{$href-other}'+window.location.search;`},
|
||||||
attribute data-href {`{$href-other}`},
|
|
||||||
attribute href {'#'}) else (),
|
attribute href {'#'}) else (),
|
||||||
'en'
|
'en'
|
||||||
})
|
})
|
||||||
|
@ -115,15 +113,15 @@ declare function page:header($lang as xs:string, $href-other as xs:string) {
|
||||||
else
|
else
|
||||||
(
|
(
|
||||||
if (session:get('searchN') > 1) then
|
if (session:get('searchN') > 1) then
|
||||||
<button type="button" class="link" data-href="./search/prev">
|
<button type="button" onclick="location.href='./search/prev'">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left" viewBox="0 0 16 16">
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left" viewBox="0 0 16 16">
|
||||||
<path fill-rule="evenodd" d="M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8"/>
|
<path fill-rule="evenodd" d="M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8"/>
|
||||||
</svg>
|
</svg>
|
||||||
</button>,
|
</button>,
|
||||||
<button type="button" id="abv-btn-searchResults">{session:get('searchN')}/{array:size(session:get('searchData'))}</button>
|
<button disabled="true">{session:get('searchN')}/{array:size(session:get('searchData'))}</button>
|
||||||
,
|
,
|
||||||
if (session:get('searchN') and session:get('searchN') < array:size(session:get('searchData'))) then
|
if (session:get('searchN') and session:get('searchN') < array:size(session:get('searchData'))) then
|
||||||
<button type="button" class="link" data-href="./search/next">
|
<button type="button" onclick="location.href='./search/next'">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-right" viewBox="0 0 16 16">
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-right" viewBox="0 0 16 16">
|
||||||
<path fill-rule="evenodd" d="M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8"/>
|
<path fill-rule="evenodd" d="M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
@ -208,17 +206,7 @@ declare %rest:path("{$lang}/search/prev")
|
||||||
let $r1 := session:set('searchN', $n)
|
let $r1 := session:set('searchN', $n)
|
||||||
let $sd := session:get('searchData')
|
let $sd := session:get('searchData')
|
||||||
return page:by-id($lang, $sd($n)('entry_id'), string-join($sd($n)('path')?*,"|"))
|
return page:by-id($lang, $sd($n)('entry_id'), string-join($sd($n)('path')?*,"|"))
|
||||||
};
|
};
|
||||||
|
|
||||||
declare %rest:path("{$lang}/search/position")
|
|
||||||
%rest:query-param("p", "{$p}")
|
|
||||||
%output:method("html")
|
|
||||||
%output:html-version('5')
|
|
||||||
function page:search-position($lang,$p) {
|
|
||||||
let $r1 := session:set('searchN', $p)
|
|
||||||
let $sd := session:get('searchData')
|
|
||||||
return page:by-id($lang, $sd($p)('entry_id'), string-join($sd($p)('path')?*,"|"))
|
|
||||||
};
|
|
||||||
|
|
||||||
declare %rest:path("{$lang}/search/clear")
|
declare %rest:path("{$lang}/search/clear")
|
||||||
%output:method("html")
|
%output:method("html")
|
||||||
|
@ -553,62 +541,15 @@ declare %rest:path("{$lang}/dict")
|
||||||
<!-- Modal for map display -->
|
<!-- Modal for map display -->
|
||||||
<dialog id="modal_map">
|
<dialog id="modal_map">
|
||||||
<article>
|
<article>
|
||||||
<header>
|
<header><button class="abv-close-map" aria-label="Close" rel="prev"></button>
|
||||||
<button class="abv-close-map" aria-label="Close" rel="prev">
|
<p>Map</p>
|
||||||
</button>
|
|
||||||
<p>{if ($lang = 'ru') then 'Карта' else 'Map'}</p>
|
|
||||||
</header>
|
</header>
|
||||||
<p>
|
<p>
|
||||||
<div id="map_display" style="width:100%;height:80%;"></div>
|
<div id="map_display" style="width:100%;height:80%;"></div>
|
||||||
</p>
|
</p>
|
||||||
<footer><button class="abv-close-map">{if ($lang = 'ru') then 'Закрыть' else 'Close'}</button></footer>
|
<footer><button class="abv-close-map">Close</button></footer>
|
||||||
</article>
|
</article>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
||||||
<!-- Modal for search results -->
|
|
||||||
{if (exists(session:get('searchData'))) then
|
|
||||||
<dialog id="modal_searchResults">
|
|
||||||
<article>
|
|
||||||
<header>
|
|
||||||
<button class="abv-close-search" aria-label="Close" rel="prev"/>
|
|
||||||
<p>{if ($lang = 'ru') then 'Результаты поиска'
|
|
||||||
else 'Search results'}</p>
|
|
||||||
</header>
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<td>{if ($lang = 'ru') then '№' else 'No.'}</td>
|
|
||||||
<td>{if ($lang = 'ru') then 'Лемма' else 'Lemma'}</td>
|
|
||||||
<td>{if ($lang = 'ru') then 'Фрагмент' else 'Fragment'}</td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{
|
|
||||||
for $res in session:get('searchData')?*
|
|
||||||
count $pos
|
|
||||||
return <tr>
|
|
||||||
<td>{$pos}</td>
|
|
||||||
<td>
|
|
||||||
<a href="./search/position?p={$pos}">
|
|
||||||
{
|
|
||||||
abv-m:entry-form-by-id($res('entry_id'))
|
|
||||||
}
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{
|
|
||||||
xquery:eval($res('path')(1), {'': doc(`abaevdict_{$lang}/xml/{$res('entry_id')}.xml`)})
|
|
||||||
}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<footer>
|
|
||||||
<button class="abv-close-search">{if ($lang = 'ru') then 'Закрыть' else 'Close'}</button>
|
|
||||||
</footer>
|
|
||||||
</article>
|
|
||||||
</dialog>}
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue