Skip to content

Commit

Permalink
fix(google): fix selectors for news
Browse files Browse the repository at this point in the history
fix #345
  • Loading branch information
iorate committed Jun 3, 2023
1 parent aa00276 commit 3be1694
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion src/scripts/search-engines/google-desktop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ const desktopSerpHandlers: Record<string, SerpHandler> = {
'.FxLDp:has(> .MYVUIe:only-child [data-ub-blocked="hidden"])': {
display: 'none',
},
// Hide overflowed actions in top stories
'.OSrXXb': {
whiteSpace: 'nowrap',
},
},
controlHandlers: [
{
Expand Down Expand Up @@ -183,6 +187,13 @@ const desktopSerpHandlers: Record<string, SerpHandler> = {
...regularEntryHandler,
},
// Latest, Top Story (Horizontal)
{
target: '.IJl0Z',
url: 'a',
title: '[role="heading"][aria-level="3"]',
actionTarget: '.OSrXXb',
actionStyle: desktopActionStyle,
},
{
target: '.JJZKK .kno-fb-ctx, .JJZKK .kno-fb-ctx .ZE0LJd, .JJZKK .kno-fb-ctx .S1FAPd',
level: '.JJZKK',
Expand Down Expand Up @@ -410,14 +421,30 @@ const desktopSerpHandlers: Record<string, SerpHandler> = {
}),
// News
nws: handleSerp({
globalStyle: desktopGlobalStyle,
globalStyle: {
...desktopGlobalStyle,
'[data-ub-blocked] .kno-fb-ctx, [data-ub-highlight] .kno-fb-ctx': {
backgroundColor: 'transparent !important',
},
// Hide overflowed actions
'.OSrXXb': {
whiteSpace: 'nowrap',
},
},
controlHandlers: [
{
target: '#result-stats',
},
],
entryHandlers: [
// Regular
{
target: '.SoaBEf, .JJZKK',
url: 'a',
title: '[role="heading"][aria-level="3"]',
actionTarget: '.OSrXXb',
actionStyle: desktopActionStyle,
},
{
target: '.WlydOe .ZE0LJd, .WlydOe .S1FAPd',
level: target => target.closest('.ftSUBd') || target.closest('.WlydOe'),
Expand Down

0 comments on commit 3be1694

Please sign in to comment.