itch to tw for auto inventory

'itch to tw for auto inventory' automatically hits claim on an inventory website 'itch to the tw' in the background in all languages

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         itch to tw for auto inventory
// @namespace    itchToTheTwforAutoInventory
// @version      0.1
// @license		 MIT
// @description  'itch to tw for auto inventory' automatically hits claim on an inventory website 'itch to the tw' in the background in all languages
// @author       DayXP
// @match        https://www.twitch.tv/drops/inventory*
// @run-at       document-end
// @grant        none
// ==/UserScript==

const refminutes = 5; //refresh the inventory page every x minutes. default = 5
const refseconds = 10; //try to hit claim after the refreshed page in x seconds. default = 10. choose 30-45 for slow computers, avoid go lower than 5.
let buttonText = ['claim now', 'jetzt abholen', 'reclamar ahora', 'en profiter', 'riscuoti subito', 'kiváltás most!', 'claim nu', 'hent nå', 'odbierz teraz',
                  'resgatar agora', 'solicită acum', 'vyzdvihnúť teraz', 'lunasta nyt', 'hämta nu', 'nhận ngay', 'Şimdi Al', 'vyzvednout kořist', 'Διεκδίκηση τώρα',
                  'Взимане сега', 'Получить сейчас', 'เคลมตอนนี้', '现在领取', '立即領取', '今すぐ入手', '지금 받기'];

const IdleTimer = setTimeout(function(){
    let items = document.querySelectorAll("[class*='ScCoreButton']");
    items.forEach((item) => {
        buttonText.forEach((searchText) => {
            if (item.innerText.toLowerCase().includes(searchText.toLowerCase())) {
                if (item != null) { item.click(); };
            }
        });
    });
    items = null;
    clearTimeout(IdleTimer);
}, refseconds*1000);
setInterval(function() {
    window.location.reload();
}, refminutes*60250);