From 0b4fd5f4685ed8f005719b3c273079d259f8c9b1 Mon Sep 17 00:00:00 2001 From: Oleg Belyaev Date: Sun, 23 Mar 2025 11:23:32 +0300 Subject: [PATCH] implement URL on random elements in js file rather than inline --- static/abaev.js | 5 +++++ xq/restx_dict_cached.xq | 14 ++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/static/abaev.js b/static/abaev.js index 405a589..44aa781 100644 --- a/static/abaev.js +++ b/static/abaev.js @@ -1,4 +1,9 @@ $( document ).ready(function() { + // 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; + }); + function bindMapOpen() { // $('#modal_map').data('abv-entry',$(this).data('abv-entry')); // $('#modal_map')[0].showModal(); diff --git a/xq/restx_dict_cached.xq b/xq/restx_dict_cached.xq index 25772f4..02445c1 100644 --- a/xq/restx_dict_cached.xq +++ b/xq/restx_dict_cached.xq @@ -55,13 +55,15 @@ 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 onclick {`window.location='{$href-other}'+window.location.search;`}, + (attribute class {'link'}, + attribute data-href {`{$href-other}`}, attribute href {'#'}) else (), 'ru' }, ' / ', element {if ($lang = 'ru') then 'a' else 'mark'}{ if ($lang = 'ru') then - (attribute onclick {`window.location='{$href-other}'+window.location.search;`}, + (attribute class {'link'}, + attribute data-href {`{$href-other}`}, attribute href {'#'}) else (), 'en' }) @@ -113,7 +115,7 @@ declare function page:header($lang as xs:string, $href-other as xs:string) { else ( if (session:get('searchN') > 1) then - , if (session:get('searchN') and session:get('searchN') < array:size(session:get('searchData'))) then - + + {if (session:get('searchQuery')) then + + } };