Greasy Fork

Greasy Fork is available in English.

ZyBooks Auto Clicker

Automatically click through participation activities on Zybooks

当前为 2023-04-14 提交的版本,查看 最新版本

// ==UserScript==
// @name         ZyBooks Auto Clicker
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  Automatically click through participation activities on Zybooks
// @author       ZyBooks Auto Clicker
// @match        https://*.zybooks.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=mozilla.org
// @grant        none
// @license MIT
// ==/UserScript==

let adone = false;
let tdone = false;
function zy(){
    // Slideshow play
    var e = Array.from(document.getElementsByClassName("zb-button"));
    // start button
    var s = Array.from(document.getElementsByClassName("title"));
    // 2x speed button
    var c = Array.from(document.getElementsByClassName("speed-control"));

    // Show answer on text answer
    var a = Array.from(document.getElementsByClassName("show-answer-button"));
    //forfeitted answers
    var f = Array.from(document.getElementsByClassName("forfeit-answer"));
    // text answer box
    var t = Array.from(document.getElementsByClassName("ember-text-area"));

    e.forEach((i)=>{
        if (i.ariaLabel == "Play"){
            i.click();
        }
    });
    s.forEach((i)=>{
        if (i.innerHTML == "Start"){
            i.click();
        }
    });
    c.forEach((i)=>{
        if (i.children[0].children[0].value=="false"){
            i.children[0].children[0].click();
        }
    });
    if (!adone && a.length > 0){
        a.forEach((i)=>{
            i.click();
            i.click();
        });
        adone = true;
    }

    if (adone && !tdone){
        if (f.length == t.length){
            let count = 0;
            t.forEach((i)=>{
                i.value = f[count].innerHTML.trim();
                count++;
            });
            s.forEach((i)=>{
        if (i.innerHTML == "Check"){
            i.click();
        }
    });
        tdone = true;
        }
    }
}

setInterval(zy,1000);