Musarita AutoCollect Useful stones

Collect "Useful stones" automagically at Musarita's Twitch channel

Fra 10.04.2020. Se den seneste versjonen.

// ==UserScript==
// @name         Musarita AutoCollect Useful stones
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  Collect "Useful stones" automagically at Musarita's Twitch channel
// @author       Lasse Brustad
// @match        https://www.twitch.tv/musarita?no-reload=true
// @grant        none
// ==/UserScript==

(function() {

    'use strict';

    // Run an interval every x ms
    setInterval(function() {
        // Attempt to get the button
        var btn = document.querySelector('[data-test-selector="community-points-summary"] [fill-rule="evenodd"]');
        // Make sure to ignore errors by not doing anything
        try {
            // Click on the button, ignore if it's not there (it turns into an ignored error)
            btn.parentElement.parentElement.parentElement.parentElement.parentElement.click();
        } catch (e) {
            // Ignore the error, or add something if you want
        }
    }, 1e3); // This will run every 1 sec (or actually about 1000 ms)
})();