NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Twitch Recommended For You Remover
// @description Removes "Recommended For You" section on twitch.tv web site on games directory page.
// @version 1.0.0
// @author LinogeFly
// @include http://*.twitch.tv/*
// @include https://*.twitch.tv/*
// @grant none
// @run-at document-start
// @require https://code.jquery.com/jquery-1.11.2.min.js
// ==/UserScript==
var allowedUrls = [
'^https?://([a-zA-Z]+\.)?twitch.tv/directory/?$'
];
var domListener = (function () {
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
var observer = new MutationObserver(function (mutations) {
// Don't process page if its URL is not allowed
if (!isUrlAllowed(document.URL))
return;
hideRecommendedForYou();
});
function hideRecommendedForYou() {
var $recGamesThumbs = $('#directory-list .js-recommended-games .js-games:visible');
var $recGamesTitle = $('#directory-list .js-recommended-games .directory_header .title:visible');
if (!$recGamesThumbs.length)
return;
stop();
$recGamesThumbs.hide();
$recGamesTitle.hide();
start();
}
function isUrlAllowed(url) {
return allowedUrls.some(function (item) {
return (new RegExp(item)).test(decodeURIComponent(url));
});
}
function start() {
observer.observe(document.body, {
childList: true,
subtree: true
});
}
function stop() {
observer.disconnect();
}
return {
start: start
};
})();
$(document).ready(function () {
// Run only in top frame
if (window.top !== window.self) {
return;
}
domListener.start();
});