forked from abaevdict/abaev-basex
added index button
This commit is contained in:
parent
75564a010d
commit
cbc0f5662d
3 changed files with 20 additions and 4 deletions
|
@ -383,7 +383,7 @@ div.index {
|
||||||
}
|
}
|
||||||
|
|
||||||
div.index div {
|
div.index div {
|
||||||
height: 85vh;
|
height: 75vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.index div select {
|
div.index div select {
|
||||||
|
@ -391,6 +391,10 @@ div.index div select {
|
||||||
overflow: scroll;
|
overflow: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.index-submit {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
optgroup {}
|
optgroup {}
|
||||||
option {}
|
option {}
|
||||||
option:checked {}
|
option:checked {}
|
||||||
|
|
|
@ -10,6 +10,7 @@ $( document ).ready(function() {
|
||||||
let $select_entry = $('#abv-select-entry');
|
let $select_entry = $('#abv-select-entry');
|
||||||
$select_word.empty();
|
$select_word.empty();
|
||||||
$select_entry.empty();
|
$select_entry.empty();
|
||||||
|
$('#btn-index-submit').prop('hidden',true);
|
||||||
for (w of out.words) {
|
for (w of out.words) {
|
||||||
$select_word.append(new Option(w.text,w.id))
|
$select_word.append(new Option(w.text,w.id))
|
||||||
}
|
}
|
||||||
|
@ -28,6 +29,7 @@ $( document ).ready(function() {
|
||||||
.then(out => {
|
.then(out => {
|
||||||
let $select_entry = $('#abv-select-entry');
|
let $select_entry = $('#abv-select-entry');
|
||||||
$select_entry.empty();
|
$select_entry.empty();
|
||||||
|
$('#btn-index-submit').prop('hidden',true);
|
||||||
for (e of out.entries) {
|
for (e of out.entries) {
|
||||||
url_entry = `./api/entries/${e.id}`;
|
url_entry = `./api/entries/${e.id}`;
|
||||||
fetch(url_entry)
|
fetch(url_entry)
|
||||||
|
@ -55,10 +57,17 @@ $( document ).ready(function() {
|
||||||
.catch(err => console.log(err));
|
.catch(err => console.log(err));
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#abv-select-entry').on("dblclick", function() {
|
$('#abv-select-entry').on("input", function () {
|
||||||
let $selected = $(this).children('option:selected');
|
$('#btn-index-submit').removeAttr('hidden');
|
||||||
|
})
|
||||||
|
|
||||||
|
function goToEntry() {
|
||||||
|
let $selected = $('#abv-select-entry').children('option:selected');
|
||||||
let entry = $selected.attr('value');
|
let entry = $selected.attr('value');
|
||||||
let path = $selected.attr('data-abv-xpath');
|
let path = $selected.attr('data-abv-xpath');
|
||||||
window.location.replace('./dict/' + entry + `?entry=${entry}&xpath=${path}`);
|
window.location.replace('./dict/' + entry + `?entry=${entry}&xpath=${path}`);
|
||||||
});
|
}
|
||||||
|
|
||||||
|
$('#abv-select-entry').on("dblclick", goToEntry);
|
||||||
|
$('#btn-index-submit').on("click", goToEntry);
|
||||||
});
|
});
|
||||||
|
|
|
@ -698,6 +698,9 @@ return
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="index-submit">
|
||||||
|
<button id="btn-index-submit" hidden="1">Go to form</button>
|
||||||
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Add table
Reference in a new issue