Detect Google container class for search filtering

Adding a check for div.MjjYud when injecting redirect button into Google search results. This helps resolve UI issues with non-traditional search results (like video results).
pull/765/head
Kevin Payravi 2024-07-19 01:24:28 -07:00
parent e1096825c5
commit a993538e8b
1 changed files with 6 additions and 1 deletions

View File

@ -272,9 +272,14 @@ function getSearchContainer(searchEngine, searchResult) {
switch (searchEngine) {
case 'google':
const closestGoogleContainerClass = searchResult.closest('div.MjjYud');
const closestJsController = searchResult.closest('div[jscontroller]');
const closestDataDiv = searchResult.closest('div[data-hveid].g') || searchResult.closest('div[data-hveid]');
searchResultContainer = findClosestElement(searchResult, [closestJsController, closestDataDiv]);
if (closestGoogleContainerClass) {
searchResultContainer = closestGoogleContainerClass;
} else {
searchResultContainer = findClosestElement(searchResult, [closestJsController, closestDataDiv]);
}
break;
case 'bing':
searchResultContainer = searchResult.closest('li.b_algo');