YouTubeDepopulator

Hides Youtube <li> elements, or sections on the homepage, with an <span>, or section title, that contains the text "Popular " or "Trending "

当前为 2014-09-12 提交的版本,查看 最新版本

// ==UserScript==
// @name        YouTubeDepopulator
// @namespace   YouTubeDepopulator
// @description Hides Youtube <li> elements, or sections on the homepage, with an <span>, or section title, that contains the text "Popular " or "Trending "
// @run-at         document-start
// @include        *://youtube.tld/*
// @include        *://*.youtube.tld/*
// @version     1.1
// @grant       none
// ==/UserScript==

var spanElems = document.querySelectorAll('span.branded-page-module-title-text');

for (var i = 0; i < spanElems.length; i++) {
  if (spanElems[i].innerHTML.contains('Popular ') || spanElems[i].innerHTML.contains('Trending ')) {
    var parentElem = spanElems[i].parentNode;
    while (parentElem.nodeName != 'LI' && parentElem != null){
      parentElem = parentElem.parentNode;
    }
    if(parentElem != null){
      parentElem.remove();
    }
  }
}