Version 2.1. Remove more unwanted tags/classes
This commit is contained in:
parent
f411c78711
commit
73206173d2
@ -6,16 +6,31 @@
|
|||||||
if (location.href.indexOf("/shorts/") != -1)
|
if (location.href.indexOf("/shorts/") != -1)
|
||||||
location.href = "https://www.youtube.com/watch?v=" + location.pathname.split("/")[2];
|
location.href = "https://www.youtube.com/watch?v=" + location.pathname.split("/")[2];
|
||||||
|
|
||||||
// Hide shorts-related elements and ads
|
// Classes and tags to remove from the page
|
||||||
var banners = document.getElementsByClassName("ytd-statement-banner-renderer");
|
var removeTags = [
|
||||||
for (var i = 0; i < banners.length; i++)
|
"ytd-rich-shelf-renderer",
|
||||||
banners[i].remove();
|
"ytd-reel-shelf-renderer",
|
||||||
var shelf = document.getElementsByTagName("ytd-rich-shelf-renderer");
|
"ytd-inline-survey-renderer",
|
||||||
for (var i = 0; i < shelf.length; i++)
|
"yt-mealbar-promo-renderer",
|
||||||
shelf[i].remove();
|
"ytd-inline-survey-renderer"
|
||||||
var shortsResults = document.getElementsByTagName("ytd-reel-shelf-renderer");
|
];
|
||||||
for (var i = 0; i < shortsResults.length; i++)
|
var removeClasses = [
|
||||||
shortsResults[i].remove();
|
"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
|
// Turn any other shorts links into regular links
|
||||||
var links = document.getElementsByTagName("a");
|
var links = document.getElementsByTagName("a");
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"name": "YouTube Shorts Disabler",
|
"name": "YouTube Shorts Disabler",
|
||||||
"author": "L. Bradley LaBoon",
|
"author": "L. Bradley LaBoon",
|
||||||
"description": "Redirects YouTube shorts to regular videos",
|
"description": "Redirects YouTube shorts to regular videos",
|
||||||
"version": "2.0",
|
"version": "2.1",
|
||||||
|
|
||||||
"icons": {
|
"icons": {
|
||||||
"16": "ysd-16.png",
|
"16": "ysd-16.png",
|
||||||
|
Loading…
Reference in New Issue
Block a user