mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Finishing the search engine.
This commit is contained in:
parent
23c7d72675
commit
492329149f
@ -54,7 +54,7 @@
|
||||
padding: 0;
|
||||
transition: width 0.4s ease-in-out;
|
||||
|
||||
&:focus, .searching
|
||||
&:focus, &.searching
|
||||
{
|
||||
width: 12rem;
|
||||
|
||||
|
@ -43,7 +43,7 @@ export class AppComponent
|
||||
|
||||
openSearch()
|
||||
{
|
||||
let input = <HTMLInputElement>document.getElementById("search");
|
||||
let input: HTMLInputElement = <HTMLInputElement>document.getElementById("search");
|
||||
|
||||
input.value = "";
|
||||
input.focus();
|
||||
@ -53,10 +53,16 @@ export class AppComponent
|
||||
{
|
||||
let query: string = event.target.value;
|
||||
if (query != "")
|
||||
{
|
||||
event.target.classList.add("searching");
|
||||
this.router.navigate(["/search/" + query], { replaceUrl: this.router.url.startsWith("/search/") });
|
||||
}
|
||||
else
|
||||
{
|
||||
event.target.classList.remove("searching");
|
||||
this.location.back();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface Library
|
||||
|
@ -22,4 +22,11 @@ export class SearchComponent implements OnInit
|
||||
this.title.setTitle(this.items.query + " - Kyoo");
|
||||
});
|
||||
}
|
||||
|
||||
ngAfterViewInit()
|
||||
{
|
||||
let searchBar: HTMLInputElement = <HTMLInputElement>document.getElementById("search");
|
||||
searchBar.classList.add("searching");
|
||||
searchBar.value = this.items.query;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user