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 {
|
||||
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 {}
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -698,6 +698,9 @@ return
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="index-submit">
|
||||
<button id="btn-index-submit" hidden="1">Go to form</button>
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Reference in a new issue