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; height: 2ex;
} }
a.abv-map:hover { a.link:hover {
cursor: pointer; cursor: pointer;
} }

View file

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

View file

@ -30,6 +30,8 @@ declare function page:head($title as xs:string, $script as node()* := ()) {
<head> <head>
<script src="/static/jquery-3.7.1.min.js"> <script src="/static/jquery-3.7.1.min.js">
</script> </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"/> <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'}{ (element {if ($lang = 'ru') then 'mark' else 'a'}{
if ($lang != 'ru') then if ($lang != 'ru') then
(attribute class {'link'}, (attribute class {'link'},
attribute data-href {`{$href-other}`}, attribute data-href {`{$href-other}`}) 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 class {'link'},
attribute data-href {`{$href-other}`}, attribute data-href {`{$href-other}`}) else (),
attribute href {'#'}) else (),
'en' 'en'
}) })
} }
@ -702,7 +702,7 @@ return
</div> </div>
</div> </div>
<div class="index-submit"> <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> </div>
</main> </main>
</body> </body>