您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
To whitelist YouTube channels in uBlock Origin
当前为
// ==UserScript== // @name YouTube - whitelist channels in uBlock Origin // @namespace https://github.com/gorhill/uBlock // @version 1.3 // @description To whitelist YouTube channels in uBlock Origin // @author Raymond Hill (gorhill) // @match https://*.youtube.com/* // @grant none // @license http://creativecommons.org/licenses/by-sa/4.0/ // @supportURL https://github.com/gorhill/uBlock/issues // ==/UserScript== // First page load // var exposeUserInURL = function() { 'use strict'; var link = document.querySelector('link[href*="/user/"]'); if ( link === null ) { return; } var pos = link.href.lastIndexOf('/'); if ( pos === -1 ) { return; } var arg = 'user=' + link.href.slice(pos + 1); var query = location.search; if ( query.indexOf(arg) !== -1 ) { return; } var href = location.href; if ( query === '' ) { location.replace(href + '?' + arg); return; } // https://github.com/gorhill/uBlock/issues/1071 // Remove already existing `user` parameter. pos = query.indexOf('user='); if ( pos !== -1 ) { location.search = query.replace(/user=[^&]*/, arg); return; } location.replace(href + '&' + arg); }; exposeUserInURL(); // DOM modifications // var mutationHandlerTimer = null; var mutationHandlerAsync = function() { 'use strict'; mutationHandlerTimer = null; exposeUserInURL(); }; var mutationHandler = function(mutations) { 'use strict'; if ( mutationHandlerTimer !== null ) { return; } for ( var i = 0; i < mutations.length; i++ ) { if ( mutations[i].addedNodes ) { mutationHandlerTimer = setTimeout(mutationHandlerAsync, 1); break; } } }; var observer = new MutationObserver(mutationHandler); observer.observe(document.body, { childList: true, subtree: true });