Created
August 6, 2016 14:12
-
-
Save timfreund/93dde982a5d12fd639c78c2df1bcbe2f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function findForDisabling(searchTerm){ | |
$(searchTerm).each(disableDisplay); | |
} | |
function disableDisplay(index, element){ | |
element.style.display = 'none'; | |
} | |
window.setInterval(function(){ | |
var searches = ["#feed", ".watch-sidebar", "#watch-discussion", ".feed-item-container"]; | |
searches.forEach(findForDisabling); | |
}, 3000); |
I had to modify the selectors (line 10):
var searches = ["#related", "#comments"];
Added a clearInterval so it's not running continually
And added #contents - gets rid of all the "recommended for you" stuff
And got rid of the "Trending" button - another wasteland!
function findForDisabling(searchTerm){
$(searchTerm).each(disableDisplay);
}
function disableDisplay(index, element){
element.style.display = 'none';
}
var destroyRabbitHoles = window.setInterval(getRabbitHoles, 3000);
var count = 0;
function getRabbitHoles(){
var searches = [
"#feed",
".watch-sidebar",
"#watch-discussion",
".feed-item-container",
"#related",
"#comments",
"#contents"
];
searches.forEach(findForDisabling);
if(count++ > 2){
clearInterval(destroyRabbitHoles);
}
}
var trendingButton = document.querySelector("a[title=Trending]");
if( trendingButton !== null){
trendingButton.style.display = 'none';
}
Here rewritten for anybody who want to use vanilla JS for it:
function findForDisabling(searchTerm) {
document.querySelectorAll(searchTerm).forEach(disableDisplay);
}
function disableDisplay(element) {
element.style.display = 'none';
}
var destroyRabbitHoles = window.setInterval(getRabbitHoles, 3000);
var count = 0;
function getRabbitHoles() {
var searches = [
"#feed",
".watch-sidebar",
"#watch-discussion",
".feed-item-container",
"#related",
"#comments",
"#contents"
];
searches.forEach(findForDisabling);
if(count++ > 2){
clearInterval(destroyRabbitHoles);
}
}
var trendingButton = document.querySelector("a[title=Trending]");
if( trendingButton !== null){
trendingButton.style.display = 'none';
}
Thanks for sharing
BTW: Found an bug with this script.
If you have more then one youtube-account, there is a popup, that is shown to choose which account should be used.
The content of this Popup is hidden by the above script (I've disabled the display:none
in following screenshot to show:
Here is an adjustment that should work:
function checkParentClass(element) {
return element.closest('.ytd-channel-switcher-renderer') !== null;
}
function findForDisabling(searchTerm) {
document.querySelectorAll(searchTerm).forEach(disableDisplay);
}
function disableDisplay(element) {
if(element.id == "contents" && !checkParentClass(element)){
element.style.display = 'none';
}
}
var destroyRabbitHoles = window.setInterval(getRabbitHoles, 3000);
var count = 0;
function getRabbitHoles() {
var searches = [
"#feed",
".watch-sidebar",
"#watch-discussion",
".feed-item-container",
"#related",
"#comments",
"#contents"
];
searches.forEach(findForDisabling);
if(count++ > 2){
clearInterval(destroyRabbitHoles);
}
}
var trendingButton = document.querySelector("a[title=Trending]");
if( trendingButton !== null){
trendingButton.style.display = 'none';
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
function findForDisabling(searchTerm){
| $(searchTerm).each(disableDisplay);
| }
|
| function disableDisplay(index, element){
| element.style.display = 'none';
| }
|
| window.setInterval(function(){
| var searches = ["#feed", ".watch-sidebar", "#watch-discussion", ".feed-item-container"];
| searches.forEach(findForDisabling);
| }, 3000);