Skip to content

Commit

Permalink
upgrade component mount for brave search
Browse files Browse the repository at this point in the history
  • Loading branch information
josStorer committed Mar 24, 2024
1 parent c9cb613 commit 513f468
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/content-script/site-adapters/brave/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { waitForElementToExistAndSelect } from '../../../utils'
import { config } from '../index.mjs'

export default {
init: async (hostname, userConfig) => {
const selector = userConfig.insertAtTop
? config.brave.resultsContainerQuery[0]
: config.brave.sidebarContainerQuery[0]
await waitForElementToExistAndSelect(selector, 5)
return true
},
}
4 changes: 4 additions & 0 deletions src/content-script/site-adapters/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import juejin from './juejin'
import weixin from './weixin'
import followin from './followin'
import duckduckgo from './duckduckgo'
import brave from './brave'

/**
* @typedef {object} SiteConfigAction
Expand Down Expand Up @@ -98,6 +99,9 @@ export const config = {
sidebarContainerQuery: ['.sidebar'],
appendContainerQuery: [],
resultsContainerQuery: ['#results'],
action: {
init: brave.init,
},
},
searx: {
inputQuery: ["input[name='q']"],
Expand Down

0 comments on commit 513f468

Please sign in to comment.