From cbc0f5662d03dbef8f2e166c99ee0a4aeae2047a Mon Sep 17 00:00:00 2001 From: Oleg Belyaev Date: Mon, 24 Mar 2025 20:21:12 +0300 Subject: [PATCH] added index button --- static/abaev-html.css | 6 +++++- static/abaev-index.js | 15 ++++++++++++--- xq/restx_dict_cached.xq | 3 +++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/static/abaev-html.css b/static/abaev-html.css index 21d5e62..034d3b9 100644 --- a/static/abaev-html.css +++ b/static/abaev-html.css @@ -383,7 +383,7 @@ div.index { } div.index div { - height: 85vh; + height: 75vh; } div.index div select { @@ -391,6 +391,10 @@ div.index div select { overflow: scroll; } +div.index-submit { + float: right; +} + optgroup {} option {} option:checked {} diff --git a/static/abaev-index.js b/static/abaev-index.js index 03b7e5e..229d3e4 100644 --- a/static/abaev-index.js +++ b/static/abaev-index.js @@ -10,6 +10,7 @@ $( document ).ready(function() { let $select_entry = $('#abv-select-entry'); $select_word.empty(); $select_entry.empty(); + $('#btn-index-submit').prop('hidden',true); for (w of out.words) { $select_word.append(new Option(w.text,w.id)) } @@ -28,6 +29,7 @@ $( document ).ready(function() { .then(out => { let $select_entry = $('#abv-select-entry'); $select_entry.empty(); + $('#btn-index-submit').prop('hidden',true); for (e of out.entries) { url_entry = `./api/entries/${e.id}`; fetch(url_entry) @@ -55,10 +57,17 @@ $( document ).ready(function() { .catch(err => console.log(err)); }); - $('#abv-select-entry').on("dblclick", function() { - let $selected = $(this).children('option:selected'); + $('#abv-select-entry').on("input", function () { + $('#btn-index-submit').removeAttr('hidden'); + }) + + function goToEntry() { + let $selected = $('#abv-select-entry').children('option:selected'); let entry = $selected.attr('value'); let path = $selected.attr('data-abv-xpath'); window.location.replace('./dict/' + entry + `?entry=${entry}&xpath=${path}`); - }); + } + + $('#abv-select-entry').on("dblclick", goToEntry); + $('#btn-index-submit').on("click", goToEntry); }); diff --git a/xq/restx_dict_cached.xq b/xq/restx_dict_cached.xq index 6c5de2d..4dd41bb 100644 --- a/xq/restx_dict_cached.xq +++ b/xq/restx_dict_cached.xq @@ -698,6 +698,9 @@ return +
+ +