GreaterGood CTG AutoClicker

Automatically clicks through all the buttons on all subsites of the GreaterGood ClickToGive program every two hours.

目前為 2021-12-10 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         GreaterGood CTG AutoClicker

// @description  Automatically clicks through all the buttons on all subsites of the GreaterGood ClickToGive program every two hours.
// @description:de Klickt sich automatisch alle zwei Std. durch alle Buttons auf allen Seiten des GreaterGood-ClickToGive-Programms.

// @version      1.2
// @author       Rsge
// @copyright    2021+, Jan G. (Rsge)
// @license      Mozilla Public License 2.0
// @icon         https://http-aws.greatergood.com/img/ggc/favicon-96x96.png

// @namespace    https://github.com/Rsge/GreaterGood-CTG-AutoClicker
// @homepageURL  https://github.com/Rsge/GreaterGood-CTG-AutoClicker
// @supportURL   https://github.com/Rsge/GreaterGood-CTG-AutoClicker/issues


// @include      https://greatergood.com/clicktogive/*
// @include      https://*.greatergood.com/clicktogive/*

// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    const sites = [" Hunger", " Breast Cancer", " Animals", " Veterans", " Autism", " Alzheimer's",
        " Diabetes", " Literacy", " Rainforest", " GreaterGood"]

    // On button site, click button
    var i;
    var buttons = document.getElementsByTagName("BUTTON");
    for (i = 0; i < buttons.length; i++) {
        var buttonHTML = buttons[i].innerHTML;
        //console.log(buttonHTML);
        if (buttonHTML == "Click to Give - it's FREE!") {
            buttons[i].click();
            return;
        }
    }

    // On thanks site, choose new site if not all are already clicked
    var divs = document.getElementsByTagName("DIV");
    for (i = 0; i < divs.length; i++) {
        var divClass = divs[i].className;
        //console.log(divClass);
        if (divClass.includes("-site col-xs-3 col-sm-4 button-to-count") &&
            !divClass.includes("click-more-clickAttempted") &&
            sites.includes(divs[i].innerText)) {
            var link = divs[i].firstElementChild.href;
            //console.log(link);
            window.open(link, "_top");
            return;
        }
    }

    // Wait for 2 h, then reload page to click through again
    setTimeout(function(){location.reload(true);}, 7260000);
})();