Update the 'hide all shorts' option

This commit is contained in:
Lawrence Hook
2023-01-15 23:26:17 -05:00
parent 2a90fdb30f
commit 0c6cec355a
3 changed files with 34 additions and 18 deletions
+6 -9
View File
@@ -1,6 +1,7 @@
html[global_enable="true"] #masthead-ad,
html[global_enable="true"] ytd-mealbar-promo-renderer,
html[global_enable="true"] ytd-carousel-ad-renderer,
html[global_enable="true"] .ytd-display-ad-renderer,
/* Main */
@@ -9,6 +10,11 @@ html[global_enable="true"][remove_sidebar="true"] #secondary > div.circle,
html[global_enable="true"][remove_sidebar="true"] #related,
html[global_enable="true"][remove_end_of_video="true"] .html5-endscreen,
/* Hide all Shorts */
html[global_enable="true"][remove_all_shorts="true"] a[title="Shorts"],
html[global_enable="true"][remove_all_shorts="true"] *[is_short],
html[global_enable="true"][remove_all_shorts="true"] ytd-reel-shelf-renderer,
/* Left Bar Navigation */
html[global_enable="true"][remove_home_link="true"] a:not(#logo)[href="/"],
html[global_enable="true"][remove_explore_link="true"] a[href="/feed/trending"],
@@ -33,15 +39,6 @@ html[global_enable="true"][remove_all_but_one="true"] ytd-browse[page-subtype="h
html[global_enable="true"][remove_extra_rows="true"] ytd-browse[page-subtype="home"] ytd-rich-grid-renderer > #contents > ytd-rich-grid-row + ytd-rich-section-renderer,
html[global_enable="true"][remove_infinite_scroll="true"] ytd-browse[page-subtype="home"] ytd-rich-grid-renderer > #contents > ytd-continuation-item-renderer,
/* Hide Shorts Everywhere */
html[global_enable="true"][remove_all_shorts="true"] ytd-browse[page-subtype="home"] ytd-rich-grid-renderer>#contents>ytd-rich-grid-row+ytd-rich-section-renderer,
html[global_enable="true"][remove_all_shorts="true"] #container.ytd-search ytd-video-renderer[is_short="true"],
html[global_enable="true"][remove_all_shorts="true"] #container.ytd-search ytd-reel-shelf-renderer,
html[global_enable="true"][remove_all_shorts="true"] a[title="Shorts"],
html[global_enable="true"][remove_all_shorts="true"] ytd-grid-video-renderer[is_sub_short],
/* Video Player - UI*/
html[global_enable="true"][remove_entire_sidebar="true"] #secondary,
html[global_enable="true"][remove_play_next_button="true"] a.ytp-next-button,
+21 -2
View File
@@ -85,6 +85,25 @@ function runDynamicSettings() {
handleNewPage();
}
// Hide all shorts
if (cache['remove_all_shorts']) {
const shortsBadgeSelector = 'ytd-thumbnail-overlay-time-status-renderer[overlay-style="SHORTS"]';
const shortBadges = document.querySelectorAll(shortsBadgeSelector);
shortBadges?.forEach(badge => {
const sidebarVid = badge.closest('ytd-compact-video-renderer');
sidebarVid?.setAttribute('is_short', '');
const gridVideo = badge.closest('ytd-grid-video-renderer');
gridVideo?.setAttribute('is_short', '');
});
const shortsShelfSelector = '*[is-shorts]';
const shortsShelves = document.querySelectorAll(shortsShelfSelector);
shortsShelves?.forEach(shelf => {
const shelfContainer = shelf.closest('ytd-rich-section-renderer');
shelfContainer?.setAttribute('is_short', '');
});
}
// Mark the left nav bar sections
const leftSections = document.querySelectorAll('ytd-guide-section-renderer');
leftSections.forEach(section => {
@@ -104,8 +123,8 @@ function runDynamicSettings() {
const addBadgeTextToVideo = badge => {
const badgeText = badge.innerText.trim().toLowerCase();
if (badgeText) {
const video = badge.closest('ytd-grid-video-renderer');
video?.setAttribute('badge-text', badgeText);
const gridVideo = badge.closest('ytd-grid-video-renderer');
gridVideo?.setAttribute('badge-text', badgeText);
}
};
+7 -7
View File
@@ -17,18 +17,18 @@ const SECTIONS = [
id: "remove_sidebar",
defaultValue: true
},
{
name: "Hide Shorts everywhere",
tags: "Homepage",
id: "remove_all_shorts",
defaultValue: false,
},
{
name: "Hide end-of-video suggestions",
tags: "Video Player",
id: "remove_end_of_video",
defaultValue: true
},
{
name: "Hide all Shorts",
tags: "Homepage, Subscriptions, Video Player, Search",
id: "remove_all_shorts",
defaultValue: false,
},
]
},
{
@@ -58,7 +58,7 @@ const SECTIONS = [
defaultValue: true
},
{
name: "Disable infinite scrolling",
name: "Disable infinite scroll",
id: "remove_infinite_scroll",
defaultValue: true
},