Add search title to history
This commit is contained in:
parent
dcf358d340
commit
19f6a2b572
@ -3,6 +3,7 @@ import { AnimeNotifier } from "../AnimeNotifier"
|
|||||||
// Search page reference
|
// Search page reference
|
||||||
var emptySearchHTML = ""
|
var emptySearchHTML = ""
|
||||||
var searchPage: HTMLElement
|
var searchPage: HTMLElement
|
||||||
|
var searchPageTitle: HTMLElement
|
||||||
var correctResponseRendered = {
|
var correctResponseRendered = {
|
||||||
"anime": false,
|
"anime": false,
|
||||||
"character": false,
|
"character": false,
|
||||||
@ -50,7 +51,8 @@ export async function search(arn: AnimeNotifier, search: HTMLInputElement, e: Ke
|
|||||||
|
|
||||||
// Set browser URL
|
// Set browser URL
|
||||||
let url = "/search/" + term
|
let url = "/search/" + term
|
||||||
history.pushState(url, null, url)
|
document.title = "Search: " + term
|
||||||
|
history.pushState(url, document.title, url)
|
||||||
arn.app.currentPath = url
|
arn.app.currentPath = url
|
||||||
|
|
||||||
// Unmount mountables to improve visual responsiveness on key press
|
// Unmount mountables to improve visual responsiveness on key press
|
||||||
@ -83,8 +85,11 @@ export async function search(arn: AnimeNotifier, search: HTMLInputElement, e: Ke
|
|||||||
soundtrackSearchResults = document.getElementById("soundtrack-search-results")
|
soundtrackSearchResults = document.getElementById("soundtrack-search-results")
|
||||||
userSearchResults = document.getElementById("user-search-results")
|
userSearchResults = document.getElementById("user-search-results")
|
||||||
companySearchResults = document.getElementById("company-search-results")
|
companySearchResults = document.getElementById("company-search-results")
|
||||||
|
searchPageTitle = document.getElementsByTagName("h1")[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
searchPageTitle.innerText = document.title
|
||||||
|
|
||||||
if(!term || term.length < 1) {
|
if(!term || term.length < 1) {
|
||||||
await arn.innerHTML(searchPage, emptySearchHTML)
|
await arn.innerHTML(searchPage, emptySearchHTML)
|
||||||
arn.app.emit("DOMContentLoaded")
|
arn.app.emit("DOMContentLoaded")
|
||||||
|
Loading…
Reference in New Issue
Block a user