Compare commits

..

No commits in common. "90dd20b53fee9e84094f2f77e0c568717f6c604f" and "f9f4c79ca2b5e4cd28c8020186ebc22673a63c87" have entirely different histories.

3 changed files with 17 additions and 20 deletions

View File

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

View File

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

View File

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