Improve state management
This commit is contained in:
parent
4e504997da
commit
ea389f4b1c
|
@ -43,11 +43,14 @@ $(document).ready(() => {
|
||||||
function getWord() {
|
function getWord() {
|
||||||
let word = window.location.hash.replace('#', '');
|
let word = window.location.hash.replace('#', '');
|
||||||
|
|
||||||
|
if (word) {
|
||||||
|
document.title = `Inflective - ${decodeURIComponent(word)}`;
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/langs/pl/words/' + word,
|
url: '/langs/pl/words/' + word,
|
||||||
|
|
||||||
success: (data) => {
|
success: (data) => {
|
||||||
$('#ajax-content').html(generateHtml(word, data))
|
$('#ajax-content').html(generateHtml(word, data));
|
||||||
},
|
},
|
||||||
|
|
||||||
error: err => console.error(err)
|
error: err => console.error(err)
|
||||||
|
@ -59,6 +62,9 @@ $(document).ready(() => {
|
||||||
// Sometimes autocomplete opens after close was called
|
// Sometimes autocomplete opens after close was called
|
||||||
// A better fix should be made
|
// A better fix should be made
|
||||||
setTimeout(() => searchBar.autocomplete('close'), 1000);
|
setTimeout(() => searchBar.autocomplete('close'), 1000);
|
||||||
|
} else {
|
||||||
|
$('#ajax-content').html('');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCells(forms, tags) {
|
function getCells(forms, tags) {
|
||||||
|
|
Loading…
Reference in New Issue