Add languages
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="icon" href="/static/favicon.png">
|
||||
<link rel="stylesheet" href="static/jquery-ui-1.13.0/jquery-ui.min.css">
|
||||
<link rel="stylesheet" href="static/jquery-ui-1.13.0/jquery-ui.theme.min.css">
|
||||
|
@@ -11,12 +11,14 @@ $(document).ready(() => {
|
||||
}
|
||||
});
|
||||
|
||||
const searchBar = $('#search-bar');
|
||||
const searchForm = $('#search-form');
|
||||
const ajaxContent = $('#ajax-content');
|
||||
|
||||
window.onhashchange = () => {
|
||||
getWord();
|
||||
};
|
||||
|
||||
const searchBar = $('#search-bar');
|
||||
|
||||
searchBar.autocomplete({
|
||||
appendTo: '#search-form',
|
||||
source: (request, response) => {
|
||||
@@ -32,7 +34,7 @@ $(document).ready(() => {
|
||||
setTimeout(() => e.currentTarget.select(), 100);
|
||||
});
|
||||
|
||||
$('#search-form').on('submit', e => {
|
||||
searchForm.on('submit', e => {
|
||||
e.preventDefault();
|
||||
|
||||
let word = e.target[0].value
|
||||
@@ -50,7 +52,7 @@ $(document).ready(() => {
|
||||
url: '/langs/pl/words/' + word,
|
||||
|
||||
success: (data) => {
|
||||
$('#ajax-content').html(generateHtml(word, data));
|
||||
ajaxContent.html(generateHtml(word, data));
|
||||
},
|
||||
|
||||
error: err => console.error(err)
|
||||
@@ -63,7 +65,7 @@ $(document).ready(() => {
|
||||
// A better fix should be made
|
||||
setTimeout(() => searchBar.autocomplete('close'), 1000);
|
||||
} else {
|
||||
$('#ajax-content').html('');
|
||||
ajaxContent.html('');
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user