Skip to content

Commit

Permalink
fix: display flex 空格失效
Browse files Browse the repository at this point in the history
  • Loading branch information
Leon406 committed Jun 21, 2024
1 parent 9851312 commit bc0379e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "__MSG_appName__",
"description": "__MSG_appDesc__",
"default_locale": "zh_CN",
"version": "0.6.0",
"version": "0.6.1",
"icons": {
"48": "assets/result48.png",
"128": "assets/icon_128.png"
Expand Down
9 changes: 7 additions & 2 deletions src/content_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,12 @@ function doHighlightText(textNodes) {
if (found_count) {
num_found += found_count
const parent_node = textNodes[i].parentNode
// 修复flex 空格失效
let computedValue = getComputedStyle(parent_node) || document.defaultView.getComputedStyle(parent_node);
// console.log(parent_node.textContent,computedValue.display)
if (computedValue.display === 'flex') {
parent_node.style.display = 'inline-block'
}
assert(new_children.length > 0, 'children must be non empty')
for (let j = 0; j < new_children.length; j++) {
parent_node.insertBefore(new_children[j], textNodes[i])
Expand Down Expand Up @@ -831,8 +837,7 @@ document.addEventListener('visibilitychange', function() {
// 用户打开或回到页面
if (document.visibilityState === 'visible') {
// 重新缓存
Array.from(document.querySelectorAll('wdhl'))
.filter(ele => !ele.classList.contains('wdhl_none_none'))
Array.from(document.querySelectorAll('wdhl:not(.wdhl_none_none)'))
.forEach(
ele => preFetchBing(ele.textContent)
)
Expand Down

0 comments on commit bc0379e

Please sign in to comment.