diff --git a/src/entry.rs b/src/entry.rs index 3288d9a..4458817 100644 --- a/src/entry.rs +++ b/src/entry.rs @@ -1,6 +1,6 @@ use std::cmp; use std::iter::IntoIterator; -use json::JsonValue::{Object, Short, Array}; +use json::JsonValue::{Object, Short}; use json::JsonValue; #[derive (Clone)] diff --git a/static/index.css b/static/index.css index 97f046d..d7f50ab 100644 --- a/static/index.css +++ b/static/index.css @@ -38,3 +38,7 @@ h1, h2, h3 { body { font-family: serif; } + +li { + margin-top: .2em; +} diff --git a/static/index.js b/static/index.js index 29234df..1f75c47 100644 --- a/static/index.js +++ b/static/index.js @@ -15,7 +15,7 @@ $(document).ready(() => { getWord(); }; - let searchBar = $('#search-bar'); + const searchBar = $('#search-bar'); searchBar.autocomplete({ appendTo: '#search-form', @@ -32,7 +32,7 @@ $(document).ready(() => { setTimeout(() => e.currentTarget.select(), 100); }); - $('#search-form').on('submit', (e) => { + $('#search-form').on('submit', e => { e.preventDefault(); let word = e.target[0].value @@ -56,6 +56,9 @@ $(document).ready(() => { window.scrollTo(0, 0); searchBar.select(); searchBar.autocomplete('close'); + // Sometimes autocomplete opens after close was called + // A better fix should be made + setTimeout(() => searchBar.autocomplete('close'), 1000); } function getCells(forms, tags) { @@ -167,6 +170,11 @@ $(document).ready(() => { html += sense.glosses[0].replace(/of\s+([\u00BF-\u1FFF\u2C00-\uD7FF\w]+)\s*$/, link); } + if('tags' in sense) { + html += ' - ' + html += sense.tags.map(tag => `${tag}`).join(', ') + } + html += ''; }) html += '';