mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Improve search box (#1431)
This commit is contained in:
parent
07543c3199
commit
a5eebec62e
2
min/custom-navbar-search-box.min.js
vendored
2
min/custom-navbar-search-box.min.js
vendored
File diff suppressed because one or more lines are too long
2
min/custom-navbar.min.js
vendored
2
min/custom-navbar.min.js
vendored
File diff suppressed because one or more lines are too long
@ -29,7 +29,11 @@ const loadSettings = () => {
|
||||
addSettingsListener('customNavbarBlurOpacity', value => {
|
||||
document.documentElement.style.setProperty('--navbar-blur-opacity', value)
|
||||
})
|
||||
if (!document.URL.startsWith('https://space.bilibili.com')) {
|
||||
const fixedNotSupported = [
|
||||
// 'https://search.bilibili.com/all',
|
||||
'https://space.bilibili.com',
|
||||
]
|
||||
if (!fixedNotSupported.some(url => document.URL.startsWith(url))) {
|
||||
addSettingsListener('customNavbarGlobalFixed', value => {
|
||||
document.body.classList.toggle('fixed-navbar', value)
|
||||
}, true)
|
||||
|
||||
@ -141,6 +141,9 @@ export class SearchBox extends NavbarComponent {
|
||||
const form = await SpinQuery.select('#custom-navbar-search') as HTMLFormElement
|
||||
const keywordInput = form.querySelector("input[name='keyword']") as HTMLInputElement
|
||||
migrateOldHistory()
|
||||
if (document.URL.startsWith('https://search.bilibili.com/all')) {
|
||||
keywordInput.value = window.location.search.match(/keyword=([^&]+)/)?.[1] || ''
|
||||
}
|
||||
form.addEventListener('submit', e => {
|
||||
if (keywordInput.value === '') {
|
||||
if (!settings.hideTopSearch) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user