Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // @namespace TWITCHLOC
- // @version 1
- // @include https://www.twitch.tv/*
- // @include https://twitch.tv/*
- // @grant none
- // @run-at document-end
- // ==/UserScript==
- function twitchRemovePill() {
- var pillsRemoved = false; // Pills already removed or not
- var pillsDisplayed = 0; // Pills currently displayed
- var timerCheck = 1000; // Checking rate of pills displayed
- var timerForceEnd = 60000; // Timer to force ClearInterval call
- var timerElapsedTime = 0; // Timer to trigger ^
- // Check if there're pills to expand
- function checkPills()
- {
- timerElapsedTime += timerCheck;
- if (timerElapsedTime >= timerForceEnd)
- {
- clearInterval(autoCheck);
- console.log("Forced to end pills check.");
- return;
- }
- var pills = document.getElementsByClassName('prime-offers__pill');
- if (pillsRemoved == false || pillsDisplayed < pills.length)
- {
- pillsRemoved = false;
- if (pills.length >= 1) removePills(pills);
- }
- }
- // Expanding pills
- function removePills(pills)
- {
- if (pillsRemoved == false)
- {
- for (var i = 0; i < pills.length; i++)
- {
- pills[i].setAttribute("style", "display: none !important;");
- }
- pillsRemoved = true;
- pillsDisplayed = pills.length;
- clearInterval(autoCheck);
- console.log("Pills ("+pillsDisplayed+") fully removed.");
- }
- }
- var autoCheck = setInterval(checkPills, timerCheck);
- }
- twitchRemovePill();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement