revert search page title on empty query
This commit is contained in:
parent
b418760a52
commit
a5a6351cce
@ -224,10 +224,10 @@ class DisplaySearch extends Display {
|
||||
sentence: {text: query, offset: 0},
|
||||
url: window.location.href
|
||||
});
|
||||
this.setTitleText(query);
|
||||
} else {
|
||||
this.container.textContent = '';
|
||||
}
|
||||
this.setTitleText(query);
|
||||
window.parent.postMessage('popupClose', '*');
|
||||
} catch (e) {
|
||||
this.onError(e);
|
||||
@ -362,8 +362,13 @@ class DisplaySearch extends Display {
|
||||
if (text.length > 1000) {
|
||||
text = text.slice(0, 1000) + '...';
|
||||
}
|
||||
|
||||
if (text.length === 0) {
|
||||
document.title = 'Yomichan Search';
|
||||
} else {
|
||||
document.title = `${text} - Yomichan Search`;
|
||||
}
|
||||
}
|
||||
|
||||
static getSearchQueryFromLocation(url) {
|
||||
const match = /^[^?#]*\?(?:[^&#]*&)?query=([^&#]*)/.exec(url);
|
||||
|
Loading…
Reference in New Issue
Block a user