Compare commits

...

2 Commits

Author SHA1 Message Date
Augusto Gunsch 90dd20b53f Fix other android issues 2022-07-23 14:25:06 +02:00
Augusto Gunsch 27c1951a3b Fix android javascript 2022-07-23 13:11:10 +02:00
3 changed files with 20 additions and 17 deletions

View File

@ -8,25 +8,25 @@
background-color: white;
}
#search-form {
z-index: 10;
#header {
z-index: 15;
background-color: #56517c;
padding: .4em;
height: 3em;
display: flex;
height: 3em;
}
#search {
width: 3em;
#search-form {
flex-basis: 100%;
}
#search-widget {
flex-basis: 100%;
height: 100%;
}
#search-bar {
width: 100%;
height: 100%;
border: 1px solid lightgray;
padding: .3em;
}

View File

@ -15,14 +15,15 @@
</head>
<body>
<div class="containter" id="main">
<div id="header">
<form class="sticky-top" id="search-form">
<div class="ui-widget" id="search-widget">
<input id="search-bar" placeholder="Search..." type="text" autocorrect="off" autocapitalize="none" autofocus>
</div>
<select id="langs">
</select>
<!--<button id="menu"></button>-->
<input type="submit" style="display: none" />
</form>
<select id="langs"></select>
</div>
<div class="container" id="ajax-content">
</div>
</div>

View File

@ -58,7 +58,7 @@ $(document).ready(() => {
appendTo: '#search-form',
source: (request, response) => {
$.ajax({
url: `/langs/${selectedLang.code}/words?like=${request.term}&limit=20&offset=0`,
url: `/langs/${selectedLang.code}/words?like=${request.term.trim()}&limit=20&offset=0`,
success: data => response(data)
})
},
@ -72,7 +72,7 @@ $(document).ready(() => {
searchForm.on('submit', e => {
e.preventDefault();
const word = e.target[0].value
const word = e.target[0].value.trim();
window.location.hash = `#${word}`;
});
@ -81,7 +81,8 @@ $(document).ready(() => {
const word = window.location.hash.replace('#', '');
if (word) {
document.title = `Inflective - ${decodeURIComponent(word)}`;
const decodedWord = decodeURIComponent(word);
document.title = `Inflective - ${decodedWord}`;
$.ajax({
url: `/langs/${selectedLang.code}/words/${word}`,
@ -94,6 +95,7 @@ $(document).ready(() => {
})
window.scrollTo(0, 0);
searchBar.val(decodedWord);
searchBar.select();
searchBar.autocomplete('close');
// Sometimes autocomplete opens after close was called