Twitch-Drops automatisch abholen (beta)

Holt Twitch-Drops automatisch im Inventar ab.

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name            Auto Claim Twitch drop (beta)
// @name:de         Twitch-Drops automatisch abholen (beta)
// @name:fr         Récupération automatique des drops Twitch (beta)
// @name:es         Reclamación automática de drops de Twitch (beta)
// @name:it         Riscossione automatica dei drop di Twitch (beta)
// @name:pt         Resgate automático de drops da Twitch (beta)
// @name:ru         Автоматическое получение дропов Twitch (beta)
// @name:ja         Twitchドロップの自動受け取り (beta)
// @name:zh         自动领取 Twitch 掉落 (beta)
// @description     Auto Claim Twitch drop in inventory
// @description:de  Holt Twitch-Drops automatisch im Inventar ab.
// @description:fr  Récupérez automatiquement les drops Twitch dans l'inventaire.
// @description:es  Reclama automáticamente los drops de Twitch en el inventario.
// @description:it  Riscatta automaticamente i drop di Twitch nell'inventario.
// @description:pt  Resgate automaticamente os drops da Twitch no inventário.
// @description:ru  Автоматически получайте дропы Twitch в инвентаре.
// @description:ja  インベントリ内のTwitchドロップを自動的に受け取ります。
// @description:zh  自动领取库存中的 Twitch 掉落。
// @version         0.0.4 beta
// @author          Wack.3gp (https://greatest.deepsurf.us/users/4792)
// @copyright       2023+, Wack.3gp
// @namespace       https://greatest.deepsurf.us/users/4792
// @license         CC BY-NC-SA-4.0; https://creativecommons.org/licenses/by-nc-sa/4.0/
// @icon            https://static.twitchcdn.net/assets/favicon-32-e29e246c157142c94346.png
//
// @include         *twitch.tv/drops/inventory*
// @run-at          document-end
// @grant           none
//
// @supportURL      https://greatest.deepsurf.us/scripts/448887/feedback
// @compatible      Chrome tested with Tampermonkey
// @contributionURL https://www.paypal.com/donate/?hosted_button_id=BYW9D395KJWZ2
// @contributionAmount €1.00
// ==/UserScript==

/* jshint esversion: 9 */

(function() {
    'use strict';

    const claimButtonSelector = '[data-test-selector="DropsCampaignInProgressRewardPresentation-claim-button"]';
    let isProcessing = false;

    const claimDrop = () => {
        if (isProcessing) return;

        const btn = document.querySelector(claimButtonSelector);
        if (btn) {
            isProcessing = true;
            btn.click();
            
            setTimeout(() => {
                location.reload();
            }, 2000);
        }
    };

    const observer = new MutationObserver(() => {
        claimDrop();
    });

    observer.observe(document.body, {
        childList: true,
        subtree: true
    });

    claimDrop();

    setInterval(function() {
        window.location.reload();
    }, 300000);
})();