YT Channel Query Fix

Hide videos not belonging to the channel when searching in it.

Verze ze dne 28. 11. 2020. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         YT Channel Query Fix
// @namespace    youtube.scripts
// @version      1.7
// @description  Hide videos not belonging to the channel when searching in it.
// @include      *.youtube.com/user/*search*
// @include      *.youtube.com/c*/*search*
// ==/UserScript==

(function() {
    'use strict';

    const INTERVAL = 1000;
    const this_channel = document.querySelector('#form[action]').action.replace(/.?search$/, '');
    var last_count = 0;
    setInterval(() => {
        let nodes = document.querySelectorAll("ytd-item-section-renderer");
        if(nodes.length === last_count) { return; }
        last_count = nodes.length;
        for(let e of nodes) {
            let a = e.querySelector("#metadata a");
            if(!e.hidden && a.href != this_channel) {
                e.hidden = true;
            }
        }
    }, INTERVAL);
})();