您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Removes annoying ad in Suggested Video List.
- // ==UserScript==
- // @name Youtube Ad Remover
- // @namespace YoutubeAdRemover
- // @version 0.4
- // @description Removes annoying ad in Suggested Video List.
- // @author shellster
- // @match https://www.youtube.com/watch*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- var MutationObserver = window.MutationObserver;
- var myObserver = new MutationObserver (mutationHandler);
- var obsConfig = {
- childList: true, attributes: true,
- subtree: true, attributeFilter: ['class']
- };
- myObserver.observe (document, obsConfig);
- function mutationHandler (mutationRecords) {
- mutationRecords.forEach ( function (mutation) {
- if (mutation.type == "childList"
- && typeof mutation.addedNodes == "object"
- && mutation.addedNodes.length
- )
- {
- for (var J = 0, L = mutation.addedNodes.length; J < L; ++J) {
- checkForAD(mutation.addedNodes[J]);
- }
- }
- else if (mutation.type == "attributes") {
- checkForAD(mutation.target);
- }
- } );
- }
- function checkForAD(node) {
- //-- Only process element nodes
- if (node.nodeType === 1) {
- if(node.nodeName.toLowerCase().indexOf('promoted') != -1)
- {
- try
- {
- node.parentNode.removeChild(node);
- }
- catch(ex){}
- }
- }
- }
- function walkTheDOM(node, func) {
- func(node);
- node = node.firstChild;
- while (node) {
- walkTheDOM(node, func);
- node = node.nextSibling;
- }
- }
- walkTheDOM(document.body, checkForAD);
- })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址