Skip to content

Commit bc5e6d4

Browse files
committed
fix hiding LIVE videos
1 parent 334c4c5 commit bc5e6d4

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/main.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const REST_SHORTS_CONTAINERS_TAG = isMobile ? [
6666
const mHidingVideoRenderer = new HidingShortsWithContainer("ytm-shorts-lockup-view-model", "ytm-rich-section-renderer");
6767

6868
/* ON DESKTOP */
69-
const dOperationsAfterHidingElement = new RearrangeVideosInGrid();
69+
const dRearrangeVideosInGrid = new RearrangeVideosInGrid();
7070
// hiding videos on Search page, videos in list mode on subscription page
7171
const dHidingVideoRenderer = new HidingShortsWithContainer("ytd-video-renderer", "ytd-shelf-renderer");
7272
// hiding videos on subscription page in list mode
@@ -377,11 +377,8 @@ function hideShorts(hide = true) {
377377
return;
378378

379379
const nodes = locationPathNameNodes();
380-
console.log(nodes.length)
381-
382380
for (let i = 0; i < nodes.length; i++) {
383381
let elements = nodes[i].querySelectorAll(combinedSelectorsToQuery);
384-
console.log(elements)
385382
elements.forEach(element => {
386383

387384
const elementTagName = element.tagName.toLowerCase();
@@ -421,7 +418,7 @@ function hideShorts(hide = true) {
421418
else if ((elementTagName.match(SHELF_TAG_REGEX)
422419
&& element.querySelector(SHELF_ITEM_TAG_SELECTOR) != null)
423420
|| element.querySelector('[href^="/shorts/"]') != null) {
424-
hideElement(hide, element, () => { dOperationsAfterHidingElement.execute(element) });
421+
hideElement(hide, element, () => { dRearrangeVideosInGrid.execute(element) });
425422
}
426423
else if (hide) {
427424
hideNonShorts(element)
@@ -446,14 +443,14 @@ function hideVideoIfOfType(types, element) {
446443
if (!types.includes(LIVE))
447444
return;
448445
// on home/subscription pages, live videos have different tree and tags
449-
const liveBadgeOverlay = element.querySelector("ytd-badge-supported-renderer>div.badge-style-type-live-now-alternate")
446+
const liveBadgeOverlay = element.querySelector("yt-thumbnail-badge-view-model>badge-shape.badge-shape-wiz--thumbnail-live,ytd-badge-supported-renderer>div.badge-style-type-live-now-alternate")
450447
if (liveBadgeOverlay === null)
451448
return;
452449
}
453450
else if (!timeOverlay.hasAttribute(TIME_OVERLAY_STATUS_STYLE_ATTRIBUTE) || !types.includes(timeOverlay.getAttribute(TIME_OVERLAY_STATUS_STYLE_ATTRIBUTE))) {
454451
return;
455452
}
456-
hideElement(true, element, () => { dOperationsAfterHidingElement.execute(element) });
453+
hideElement(true, element, () => { dRearrangeVideosInGrid.execute(element) });
457454
}
458455

459456
function hideVideoIfBelowLength(element, minLengthSeconds) {
@@ -464,7 +461,7 @@ function hideVideoIfBelowLength(element, minLengthSeconds) {
464461
+ (time.length > 1 ? Number(time[1]) * 60 : 0)
465462
+ (time.length > 2 ? Number(time[2]) * 3600 : 0)
466463
if (seconds != NaN && seconds <= minLengthSeconds) {
467-
hideElement(true, element, () => { dOperationsAfterHidingElement.execute(element) });
464+
hideElement(true, element, () => { dRearrangeVideosInGrid.execute(element) });
468465
}
469466
}
470467
}

0 commit comments

Comments
 (0)