YouTube uBlock Whitelister (Improved)

An improved version of Zalastax's fixed version of gorhill's tool to whitelist ads for certain YouTubers

< 脚本 YouTube uBlock Whitelister (Improved) 的反馈

评价:一般 - 脚本能用,但还有一些问题

x0a
§
发布于:2017-04-12

Doesn't work, small error.

Change line 36 from
var channelId = fetchChannel();
to
var channel = fetchChannel();

§
发布于:2017-04-12
编辑于:2017-04-12

It's line 38 not 36.

36var exposeUserInURL = function() {
37 var channel = fetchChannel();

38 var newArg = channelId !== '' ? 'user=' + encodeURIComponent(channel) : '';

working code:
38 var newArg = channel !== '' ? 'user=' + encodeURIComponent(channel) : '';

x0a
§
发布于:2017-04-15
编辑于:2017-04-15

yes, you're right. also replace fetchChannel with

var fetchChannel = function() {
    var link = document.querySelector('[id="watch7-user-header"] a[href^="/user/"]');
    if (!link) {
        link = document.querySelector('[id="watch7-user-header"] a[href^="/channel/"]');
        if (!link) 
            return '';

    }
    var linkHref = link.getAttribute('href');
    var linkmatch = linkHref.match(/\/(user|channel)\/(.+)/);

    if (linkmatch && linkmatch[2])
        return linkmatch[2];
    else
        return '';
};

because otherwise you get "undefined" on non-video youtube pages instead of an empty string, which leads to constant reloading on playlist page and other youtube pages that aren't /watch?

actually this plugin needs a lot of optimizations, like pre-adding channel names to related youtube videos in the side bar and home page

发布留言

登录(不可用)以发布留言。

长期地址
遇到问题?请前往 GitHub 提 Issues。