Skip to content

Commit 6005ca3

Browse files
committed
fix(bookmark.ts): fix bookmark search on baidu.com
1 parent 6a25c30 commit 6005ca3

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/background/bookmark.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ message.addListener({
1414
type: 'bookmark-search',
1515
callback: search,
1616
})
17+
18+
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
19+
message.sendTab(tabId, 'load-complete')
20+
})

src/content/bookmark.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ class BookmarkSearch {
2929
}
3030
}, 100)
3131
})
32+
33+
message.addListener({
34+
type: 'load-complete',
35+
callback: (message, sender, sendResponse) => {
36+
setTimeout(() => {
37+
this.sendSearch(this.getKeyword())
38+
}, 500);
39+
sendResponse('')
40+
}
41+
})
3242
} else if (this.host.startsWith('www.google.')) {
3343
this.getKeyword = () => ($('input.gsfi')[0]['value'] as string)
3444
this.innerClass = '#res'

0 commit comments

Comments
 (0)