mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-12-07 01:51:27 +01:00
feat(YouTube - Hide layout components): Add video description "Hide Featured content" and "Hide Subscribe button" (#6253)
This commit is contained in:
committed by
GitHub
parent
d23fa5e3b7
commit
da4cf94091
@@ -7,15 +7,15 @@ import app.revanced.extension.youtube.shared.PlayerType;
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
final class DescriptionComponentsFilter extends Filter {
|
final class DescriptionComponentsFilter extends Filter {
|
||||||
|
|
||||||
|
private static final String INFOCARDS_SECTION_PATH = "infocards_section.e";
|
||||||
|
|
||||||
private final StringTrieSearch exceptions = new StringTrieSearch();
|
private final StringTrieSearch exceptions = new StringTrieSearch();
|
||||||
|
|
||||||
private final ByteArrayFilterGroupList macroMarkersCarouselGroupList = new ByteArrayFilterGroupList();
|
|
||||||
|
|
||||||
private final StringFilterGroup macroMarkersCarousel;
|
private final StringFilterGroup macroMarkersCarousel;
|
||||||
|
private final ByteArrayFilterGroupList macroMarkersCarouselGroupList = new ByteArrayFilterGroupList();
|
||||||
private final StringFilterGroup horizontalShelf;
|
private final StringFilterGroup horizontalShelf;
|
||||||
private final ByteArrayFilterGroup cellVideoAttribute;
|
private final ByteArrayFilterGroup cellVideoAttribute;
|
||||||
|
private final StringFilterGroup infoCardsSection;
|
||||||
|
private final StringFilterGroup subscribeButton;
|
||||||
private final StringFilterGroup aiGeneratedVideoSummarySection;
|
private final StringFilterGroup aiGeneratedVideoSummarySection;
|
||||||
private final StringFilterGroup hypePoints;
|
private final StringFilterGroup hypePoints;
|
||||||
|
|
||||||
@@ -44,9 +44,10 @@ final class DescriptionComponentsFilter extends Filter {
|
|||||||
"video_attributes_section"
|
"video_attributes_section"
|
||||||
);
|
);
|
||||||
|
|
||||||
final StringFilterGroup infoCardsSection = new StringFilterGroup(
|
final StringFilterGroup featuredSection = new StringFilterGroup(
|
||||||
Settings.HIDE_INFO_CARDS_SECTION,
|
Settings.HIDE_FEATURED_SECTION,
|
||||||
"infocards_section"
|
// "media_lockup", "structured_description_video_lockup"
|
||||||
|
"compact_infocard"
|
||||||
);
|
);
|
||||||
|
|
||||||
final StringFilterGroup podcastSection = new StringFilterGroup(
|
final StringFilterGroup podcastSection = new StringFilterGroup(
|
||||||
@@ -69,6 +70,16 @@ final class DescriptionComponentsFilter extends Filter {
|
|||||||
"hype_points_factoid"
|
"hype_points_factoid"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
infoCardsSection = new StringFilterGroup(
|
||||||
|
Settings.HIDE_INFO_CARDS_SECTION,
|
||||||
|
INFOCARDS_SECTION_PATH
|
||||||
|
);
|
||||||
|
|
||||||
|
subscribeButton = new StringFilterGroup(
|
||||||
|
Settings.HIDE_DESCRIPTION_SUBSCRIBE_BUTTON,
|
||||||
|
"subscribe_button"
|
||||||
|
);
|
||||||
|
|
||||||
macroMarkersCarousel = new StringFilterGroup(
|
macroMarkersCarousel = new StringFilterGroup(
|
||||||
null,
|
null,
|
||||||
"macro_markers_carousel.e"
|
"macro_markers_carousel.e"
|
||||||
@@ -99,12 +110,14 @@ final class DescriptionComponentsFilter extends Filter {
|
|||||||
aiGeneratedVideoSummarySection,
|
aiGeneratedVideoSummarySection,
|
||||||
askSection,
|
askSection,
|
||||||
attributesSection,
|
attributesSection,
|
||||||
infoCardsSection,
|
featuredSection,
|
||||||
horizontalShelf,
|
horizontalShelf,
|
||||||
howThisWasMadeSection,
|
howThisWasMadeSection,
|
||||||
hypePoints,
|
hypePoints,
|
||||||
|
infoCardsSection,
|
||||||
macroMarkersCarousel,
|
macroMarkersCarousel,
|
||||||
podcastSection,
|
podcastSection,
|
||||||
|
subscribeButton,
|
||||||
transcriptSection
|
transcriptSection
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -118,6 +131,10 @@ final class DescriptionComponentsFilter extends Filter {
|
|||||||
return PlayerType.getCurrent().isMaximizedOrFullscreen();
|
return PlayerType.getCurrent().isMaximizedOrFullscreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (matchedGroup == subscribeButton) {
|
||||||
|
return path.startsWith(INFOCARDS_SECTION_PATH);
|
||||||
|
}
|
||||||
|
|
||||||
if (exceptions.matches(path)) return false;
|
if (exceptions.matches(path)) return false;
|
||||||
|
|
||||||
if (matchedGroup == macroMarkersCarousel) {
|
if (matchedGroup == macroMarkersCarousel) {
|
||||||
|
|||||||
@@ -210,11 +210,13 @@ public class Settings extends BaseSettings {
|
|||||||
public static final BooleanSetting HIDE_ASK_SECTION = new BooleanSetting("revanced_hide_ask_section", FALSE);
|
public static final BooleanSetting HIDE_ASK_SECTION = new BooleanSetting("revanced_hide_ask_section", FALSE);
|
||||||
public static final BooleanSetting HIDE_ATTRIBUTES_SECTION = new BooleanSetting("revanced_hide_attributes_section", FALSE);
|
public static final BooleanSetting HIDE_ATTRIBUTES_SECTION = new BooleanSetting("revanced_hide_attributes_section", FALSE);
|
||||||
public static final BooleanSetting HIDE_CHAPTERS_SECTION = new BooleanSetting("revanced_hide_chapters_section", TRUE);
|
public static final BooleanSetting HIDE_CHAPTERS_SECTION = new BooleanSetting("revanced_hide_chapters_section", TRUE);
|
||||||
|
public static final BooleanSetting HIDE_FEATURED_SECTION = new BooleanSetting("revanced_hide_featured_section", TRUE);
|
||||||
public static final BooleanSetting HIDE_HOW_THIS_WAS_MADE_SECTION = new BooleanSetting("revanced_hide_how_this_was_made_section", FALSE);
|
public static final BooleanSetting HIDE_HOW_THIS_WAS_MADE_SECTION = new BooleanSetting("revanced_hide_how_this_was_made_section", FALSE);
|
||||||
public static final BooleanSetting HIDE_HYPE_POINTS = new BooleanSetting("revanced_hide_hype_points", FALSE);
|
public static final BooleanSetting HIDE_HYPE_POINTS = new BooleanSetting("revanced_hide_hype_points", FALSE);
|
||||||
public static final BooleanSetting HIDE_INFO_CARDS_SECTION = new BooleanSetting("revanced_hide_info_cards_section", TRUE);
|
public static final BooleanSetting HIDE_INFO_CARDS_SECTION = new BooleanSetting("revanced_hide_info_cards_section", TRUE);
|
||||||
public static final BooleanSetting HIDE_KEY_CONCEPTS_SECTION = new BooleanSetting("revanced_hide_key_concepts_section", FALSE);
|
public static final BooleanSetting HIDE_KEY_CONCEPTS_SECTION = new BooleanSetting("revanced_hide_key_concepts_section", FALSE);
|
||||||
public static final BooleanSetting HIDE_PODCAST_SECTION = new BooleanSetting("revanced_hide_podcast_section", TRUE);
|
public static final BooleanSetting HIDE_PODCAST_SECTION = new BooleanSetting("revanced_hide_podcast_section", TRUE);
|
||||||
|
public static final BooleanSetting HIDE_DESCRIPTION_SUBSCRIBE_BUTTON = new BooleanSetting("revanced_hide_description_subscribe_button", TRUE);
|
||||||
public static final BooleanSetting HIDE_TRANSCRIPT_SECTION = new BooleanSetting("revanced_hide_transcript_section", TRUE);
|
public static final BooleanSetting HIDE_TRANSCRIPT_SECTION = new BooleanSetting("revanced_hide_transcript_section", TRUE);
|
||||||
|
|
||||||
// Action buttons
|
// Action buttons
|
||||||
|
|||||||
@@ -145,11 +145,13 @@ val hideLayoutComponentsPatch = bytecodePatch(
|
|||||||
SwitchPreference("revanced_hide_ask_section"),
|
SwitchPreference("revanced_hide_ask_section"),
|
||||||
SwitchPreference("revanced_hide_attributes_section"),
|
SwitchPreference("revanced_hide_attributes_section"),
|
||||||
SwitchPreference("revanced_hide_chapters_section"),
|
SwitchPreference("revanced_hide_chapters_section"),
|
||||||
|
SwitchPreference("revanced_hide_featured_section"),
|
||||||
SwitchPreference("revanced_hide_info_cards_section"),
|
SwitchPreference("revanced_hide_info_cards_section"),
|
||||||
SwitchPreference("revanced_hide_how_this_was_made_section"),
|
SwitchPreference("revanced_hide_how_this_was_made_section"),
|
||||||
SwitchPreference("revanced_hide_hype_points"),
|
SwitchPreference("revanced_hide_hype_points"),
|
||||||
SwitchPreference("revanced_hide_key_concepts_section"),
|
SwitchPreference("revanced_hide_key_concepts_section"),
|
||||||
SwitchPreference("revanced_hide_podcast_section"),
|
SwitchPreference("revanced_hide_podcast_section"),
|
||||||
|
SwitchPreference("revanced_hide_description_subscribe_button"),
|
||||||
SwitchPreference("revanced_hide_transcript_section"),
|
SwitchPreference("revanced_hide_transcript_section"),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -346,12 +346,18 @@ If a Doodle is currently showing in your region and this hide setting is on, the
|
|||||||
<string name="revanced_hide_podcast_section_title">Hide \'Explore the podcast\'</string>
|
<string name="revanced_hide_podcast_section_title">Hide \'Explore the podcast\'</string>
|
||||||
<string name="revanced_hide_podcast_section_summary_on">Explore the podcast section is hidden</string>
|
<string name="revanced_hide_podcast_section_summary_on">Explore the podcast section is hidden</string>
|
||||||
<string name="revanced_hide_podcast_section_summary_off">Explore the podcast section is shown</string>
|
<string name="revanced_hide_podcast_section_summary_off">Explore the podcast section is shown</string>
|
||||||
|
<string name="revanced_hide_featured_section_title">Hide Featured content</string>
|
||||||
|
<string name="revanced_hide_featured_section_summary_on">Featured content section is hidden</string>
|
||||||
|
<string name="revanced_hide_featured_section_summary_off">Featured content section is shown</string>
|
||||||
<string name="revanced_hide_info_cards_section_title">Hide Info cards</string>
|
<string name="revanced_hide_info_cards_section_title">Hide Info cards</string>
|
||||||
<string name="revanced_hide_info_cards_section_summary_on">Info cards section is hidden</string>
|
<string name="revanced_hide_info_cards_section_summary_on">Info cards section is hidden</string>
|
||||||
<string name="revanced_hide_info_cards_section_summary_off">Info cards section is shown</string>
|
<string name="revanced_hide_info_cards_section_summary_off">Info cards section is shown</string>
|
||||||
<string name="revanced_hide_key_concepts_section_title">Hide \'Key concepts\'</string>
|
<string name="revanced_hide_key_concepts_section_title">Hide \'Key concepts\'</string>
|
||||||
<string name="revanced_hide_key_concepts_section_summary_on">Key concepts section is hidden</string>
|
<string name="revanced_hide_key_concepts_section_summary_on">Key concepts section is hidden</string>
|
||||||
<string name="revanced_hide_key_concepts_section_summary_off">Key concepts section is shown</string>
|
<string name="revanced_hide_key_concepts_section_summary_off">Key concepts section is shown</string>
|
||||||
|
<string name="revanced_hide_description_subscribe_button_title">Hide Subscribe button</string>
|
||||||
|
<string name="revanced_hide_description_subscribe_button_summary_on">Subscribe button is hidden</string>
|
||||||
|
<string name="revanced_hide_description_subscribe_button_summary_off">Subscribe button is shown</string>
|
||||||
<string name="revanced_hide_transcript_section_title">Hide Transcript</string>
|
<string name="revanced_hide_transcript_section_title">Hide Transcript</string>
|
||||||
<string name="revanced_hide_transcript_section_summary_on">Transcript section is hidden</string>
|
<string name="revanced_hide_transcript_section_summary_on">Transcript section is hidden</string>
|
||||||
<string name="revanced_hide_transcript_section_summary_off">Transcript section is shown</string>
|
<string name="revanced_hide_transcript_section_summary_off">Transcript section is shown</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user