diff options
author | Alex Yatskov <alex@foosoft.net> | 2019-12-05 18:25:37 -0800 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2019-12-05 18:25:37 -0800 |
commit | 9105cb5618cfdd14c2bc37cd22db2b360fe8cd52 (patch) | |
tree | f93cb5fddb3c276542fef605ee21e4309300fc7a /ext/bg | |
parent | f9ea6206550ceee625ea93215a6e08d45a750086 (diff) | |
parent | 63f3e94bb18182afff694481899e5961cf505fdb (diff) |
Merge branch 'master' into testing
Diffstat (limited to 'ext/bg')
-rw-r--r-- | ext/bg/js/search.js | 9 | ||||
-rw-r--r-- | ext/bg/search.html | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js index 00b7ca4b..fe48773f 100644 --- a/ext/bg/js/search.js +++ b/ext/bg/js/search.js @@ -224,6 +224,7 @@ class DisplaySearch extends Display { sentence: {text: query, offset: 0}, url: window.location.href }); + this.setTitleText(query); } else { this.container.textContent = ''; } @@ -356,6 +357,14 @@ class DisplaySearch extends Display { this.search.disabled = this.introVisible && (this.query === null || this.query.value.length === 0); } + setTitleText(text) { + // Chrome limits title to 1024 characters + if (text.length > 1000) { + text = text.slice(0, 1000) + '...'; + } + document.title = `${text} - Yomichan Search`; + } + static getSearchQueryFromLocation(url) { const match = /^[^?#]*\?(?:[^&#]*&)?query=([^&#]*)/.exec(url); return match !== null ? decodeURIComponent(match[1]) : null; diff --git a/ext/bg/search.html b/ext/bg/search.html index fef30456..58bb9ba8 100644 --- a/ext/bg/search.html +++ b/ext/bg/search.html @@ -69,7 +69,6 @@ <script src="/fg/js/api.js"></script> <script src="/fg/js/document.js"></script> <script src="/fg/js/source.js"></script> - <script src="/fg/js/util.js"></script> <script src="/mixed/js/audio.js"></script> <script src="/mixed/js/display-context.js"></script> <script src="/mixed/js/display.js"></script> |