Version 2.1. Remove more unwanted tags/classes

This commit is contained in:
L. Bradley LaBoon 2023-04-17 19:36:02 -04:00
parent f411c78711
commit 73206173d2
2 changed files with 26 additions and 11 deletions

View File

@ -6,16 +6,31 @@
if (location.href.indexOf("/shorts/") != -1)
location.href = "https://www.youtube.com/watch?v=" + location.pathname.split("/")[2];
// Hide shorts-related elements and ads
var banners = document.getElementsByClassName("ytd-statement-banner-renderer");
for (var i = 0; i < banners.length; i++)
banners[i].remove();
var shelf = document.getElementsByTagName("ytd-rich-shelf-renderer");
for (var i = 0; i < shelf.length; i++)
shelf[i].remove();
var shortsResults = document.getElementsByTagName("ytd-reel-shelf-renderer");
for (var i = 0; i < shortsResults.length; i++)
shortsResults[i].remove();
// Classes and tags to remove from the page
var removeTags = [
"ytd-rich-shelf-renderer",
"ytd-reel-shelf-renderer",
"ytd-inline-survey-renderer",
"yt-mealbar-promo-renderer",
"ytd-inline-survey-renderer"
];
var removeClasses = [
"ytd-statement-banner-renderer",
"ytd-brand-video-shelf-renderer",
"ytd-primetime-promo-renderer"
];
for (var i = 0; i < removeTags.length; i++) {
var tags = document.getElementsByTagName(removeTags[i]);
for (var j = 0; j < tags.length; j++)
tags[j].remove();
}
for (var i = 0; i < removeClasses.length; i++) {
var classes = document.getElementsByClassName(removeClasses[i]);
for (var j = 0; j < classes.length; j++)
classes[j].remove();
}
// Turn any other shorts links into regular links
var links = document.getElementsByTagName("a");

View File

@ -4,7 +4,7 @@
"name": "YouTube Shorts Disabler",
"author": "L. Bradley LaBoon",
"description": "Redirects YouTube shorts to regular videos",
"version": "2.0",
"version": "2.1",
"icons": {
"16": "ysd-16.png",