added global js and fixed buttons

This commit is contained in:
Oleg Belyaev 2025-03-24 20:44:03 +03:00
parent 8a0f8c77fe
commit a0fa864475
4 changed files with 21 additions and 7 deletions

12
static/abaev-global.js Normal file
View file

@ -0,0 +1,12 @@
$( document ).ready(function() {
// GLOBALS;
// Link elements that do not have href out of the box
$('.link').on("click", function () {
window.location=$(this)[0].dataset.href+window.location.search+window.location.hash;
});
$('#abv-search').on("submit", function () {
$('#abv-search-icon').replaceWith('<div class="loader"></div>');
});
});

View file

@ -216,7 +216,7 @@ a.abv-map img {
height: 2ex;
}
a.abv-map:hover {
a.link:hover {
cursor: pointer;
}

View file

@ -10,6 +10,8 @@ $( document ).ready(function() {
$('#abv-search-icon').replaceWith('<div class="loader"></div>');
});
// INFINITE SCROLL
// init Infinite Scroll
$('main').infiniteScroll({
path: '.pagination__next',

View file

@ -30,6 +30,8 @@ declare function page:head($title as xs:string, $script as node()* := ()) {
<head>
<script src="/static/jquery-3.7.1.min.js">
</script>
<script src="/static/abaev-global.js">
</script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.classless.min.css"/>
@ -56,15 +58,13 @@ declare function page:header($lang as xs:string, $href-other as xs:string) {
(element {if ($lang = 'ru') then 'mark' else 'a'}{
if ($lang != 'ru') then
(attribute class {'link'},
attribute data-href {`{$href-other}`},
attribute href {'#'}) else (),
attribute data-href {`{$href-other}`}) else (),
'ru'
}, ' / ',
element {if ($lang = 'ru') then 'a' else 'mark'}{
if ($lang = 'ru') then
(attribute class {'link'},
attribute data-href {`{$href-other}`},
attribute href {'#'}) else (),
attribute data-href {`{$href-other}`}) else (),
'en'
})
}
@ -669,7 +669,7 @@ return
<html>
{page:head('HEDO Index', <script src="/static/abaev-index.js"></script>)}
<body>
{page:header($lang,`../{page:invert-lang($lang)}/index`)}
{page:header($lang, `../{page:invert-lang($lang)}/index`)}
<main>
<div class="index">
<div class="langs">
@ -702,7 +702,7 @@ return
</div>
</div>
<div class="index-submit">
<button id="btn-index-submit" hidden="1">Go to form</button>
<button id="btn-index-submit" hidden="1">{if ($lang = 'ru') then 'К форме' else 'Go to form'}</button>
</div>
</main>
</body>