fix: update rules

This commit is contained in:
Gabe
2025-09-26 01:46:58 +08:00
parent 6b9a1a49bb
commit 14f74b76bb
2 changed files with 22 additions and 16 deletions

View File

@@ -161,29 +161,35 @@ export const DEFAULT_OW_RULE = {
// todo: 校验几个内置规则 // todo: 校验几个内置规则
const RULES_MAP = { const RULES_MAP = {
"www.google.com/search": { "www.google.com/search": {
selector: `h3, .IsZvec, .VwiC3b`, rootsSelector: `#rcnt`,
textStyle: OPT_STYLE_BLOCKQUOTE,
}, },
"en.wikipedia.org": { "en.wikipedia.org": {
selector: `h1, .mw-parser-output ${DEFAULT_SELECTOR}`, ignoreSelector: `.button, code, footer, form, mark, pre, .mwe-math-element, .mw-editsection`,
keepSelector: `.mwe-math-element`, textStyle: OPT_STYLE_BLOCKQUOTE,
}, },
"news.ycombinator.com": { "news.ycombinator.com": {
selector: `.title, p`, selector: `p, .titleline, .commtext`,
fixerSelector: `.toptext, .commtext`, rootsSelector: `#bigbox`,
}, keepSelector: `code, img, svg, pre, .sitebit`,
"github.com": { ignoreSelector: `button, code, footer, form, header, mark, nav, pre, .reply`,
selector: `.markdown-body ${DEFAULT_SELECTOR}, .repo-description p, .Layout-sidebar .f4, .container-lg .py-4 .f5, .container-lg .my-4 .f5, .Box-row .pr-4, .Box-row article .mt-1, [itemprop="description"], .markdown-title, bdi, .ws-pre-wrap, .status-meta, span.status-meta, .col-10.color-fg-muted, .TimelineItem-body, .pinned-item-list-item-content .color-fg-muted, .markdown-body td, .markdown-body th`, autoScan: `false`,
keepSelector: DEFAULT_KEEP_SELECTOR, textStyle: OPT_STYLE_BLOCKQUOTE,
}, },
// "github.com": {
// selector: `.markdown-body ${DEFAULT_SELECTOR}, .repo-description p, .Layout-sidebar .f4, .container-lg .py-4 .f5, .container-lg .my-4 .f5, .Box-row .pr-4, .Box-row article .mt-1, [itemprop="description"], .markdown-title, bdi, .ws-pre-wrap, .status-meta, span.status-meta, .col-10.color-fg-muted, .TimelineItem-body, .pinned-item-list-item-content .color-fg-muted, .markdown-body td, .markdown-body th`,
// keepSelector: DEFAULT_KEEP_SELECTOR,
// },
"twitter.com, https://x.com": { "twitter.com, https://x.com": {
selector: `[data-testid="tweetText"], [data-testid="birdwatch-pivot"]>div.css-1rynq56`, selector: `[data-testid='tweetText']`,
keepSelector: `img, a, .r-18u37iz, .css-175oi2r`, keepSelector: `img, svg, span:has(a), div:has(a)`,
autoScan: `false`,
textStyle: OPT_STYLE_DASHBOX,
}, },
"www.youtube.com": { "www.youtube.com": {
selector: `h1, #video-title, #content-text, #title, yt-attributed-string>span>span, #ytp-caption-window-container .ytp-caption-segment`, rootsSelector: `ytd-page-manager`,
selectStyle: `-webkit-line-clamp: unset; max-height: none; height: auto;`, transEndHook: `({ parentNode }) => {parentNode.parentElement.style.cssText += "-webkit-line-clamp: unset; max-height: none; height: auto;";}`,
parentStyle: `-webkit-line-clamp: unset; max-height: none; height: auto;`, textStyle: OPT_STYLE_DASHBOX,
keepSelector: `img, #content-text>a`,
}, },
}; };

View File

@@ -47,7 +47,7 @@ const genStyles = ({ textDiyStyle, bgColor = DEFAULT_COLOR }) => ({
[OPT_STYLE_DASHBOX]: ` [OPT_STYLE_DASHBOX]: `
border: 1px dashed ${bgColor || DEFAULT_COLOR}; border: 1px dashed ${bgColor || DEFAULT_COLOR};
background: transparent; background: transparent;
display: block; display: inline-block;
padding: 0.2em 0.5em; padding: 0.2em 0.5em;
box-sizing: border-box; box-sizing: border-box;
`, `,