My Twitch Drop Claimer - inventory ()

automatically clicks the "Claim" button

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            My Twitch Drop Claimer - inventory ()
// @name:ru         My Twitch Drop Claimer - в инвентаре, не чат
// @namespace
// @version         0.2
// @description     automatically clicks the "Claim" button
// @description:ru  автоматически получает дроп
// @author          dykomenko
// @match        https://www.twitch.tv/drops/inventory
// @icon         https://www.google.com/s2/favicons?domain=twitch.tv
// @grant        none
// @namespace https://greasyfork.org/users/104360
// ==/UserScript==
/* jshint esversion: 6 */

(function() { 'use strict';
             //ty Aaz
             const ClaimButtonNames = [
                 'Claim now', //English
                 'Получить сейчас', //Русский
             ]

             const CloseChatRulesButtonName = ['chat-rules-ok-button', ];

             var ClaimButtonClass = '';
             var CloseChatRulesButtonClass = '';

             const GetClass = function (But, PressIt, ignorName) {

                 let ButtonClass = '';

                 const yNode = document.querySelectorAll('button');

                 if (yNode) {

                     let s = '';

                     for (let i = 0; i < yNode.length; i++) {

                         s = '';

                         if (!ignorName) {
                             s = yNode.item(i).textContent;
                         }

                         if (s == '' && yNode.item(i).attributes[1]) {
                             s = yNode.item(i).attributes[1].nodeValue;
                         }

                         if (s != '' && But.includes(s)) {
                             ButtonClass = '.' + yNode.item(i).classList.value.replace(/ /ig, '.');
                             if (PressIt) {
                                 yNode.item(i).click();
                                 console.log('Button "' + s + '" is pressed');
                             }
                             break;
                         }
                     }
                 }

                 return ButtonClass;

             }

             const GetClaimButton = () => {

                 if (ClaimButtonClass == '') {
                     ClaimButtonClass = GetClass(ClaimButtonNames, false, false);
                 }

                 if (ClaimButtonClass != '') {
                     const xNode = document.querySelector(ClaimButtonClass);

                     if (xNode) {
                         xNode.click();
                         console.log('Claim drop button is pressed');
                     }
                 }

                 if (CloseChatRulesButtonClass == '') {
                     CloseChatRulesButtonClass = GetClass(CloseChatRulesButtonName, true, true);
                 }

             };


             const reload = function(){
                 window.location.reload();
             };

             const vmark = function(){
                 document.querySelectorAll('h2')[2].innerHTML += " ✅";
             }

             setTimeout(vmark, 2000);
             setInterval(GetClaimButton, 29000);
             setInterval(reload, 60000);

            })();