-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathZyBook Automation
More file actions
97 lines (77 loc) · 2.73 KB
/
ZyBook Automation
File metadata and controls
97 lines (77 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// ==UserScript==
// @name Zybooks Automation
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Automate tasks on Zybooks page
// @author Hrod
// @match https://*.zybooks.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// All your code goes here
// CLICK ALL RADIO BUTTONS
const radioButtons = document.querySelectorAll('input[type="radio"]');
let index = 0;
function clickNextButton() {
if (index < radioButtons.length) {
radioButtons[index].click();
index++;
setTimeout(clickNextButton, 300); // adjust delay as needed
}
}
clickNextButton();
// CLICK ALL 2X SPEED BOXES
const x2Buttons = document.querySelectorAll('input[type="checkbox"]');
let index2 = 0;
function clickNextBox() {
if (index2 < x2Buttons.length) {
x2Buttons[index2].click();
index2++;
setTimeout(clickNextBox, 300); // adjust delay as needed
}
}
clickNextBox();
// CLICK ALL START BUTTONS
const startButtons = document.querySelectorAll('button[class="zb-button primary raised start-button start-graphic"]');
let index3 = 0;
function clickNextStartButton() {
if (index3 < startButtons.length) {
startButtons[index3].click();
index3++;
setTimeout(clickNextStartButton, 300); // adjust delay as needed
}
}
clickNextStartButton();
// CLICK ALL PLAY BUTTONS
function clickNextPlayButton() {
setTimeout(clickNextPlayButton, 100);
let playButtons = document.querySelectorAll('button[aria-label="Play"]');
let index4 = 0;
if (index4 < playButtons.length) {
playButtons[index4].click();
index4++;
setTimeout(clickNextPlayButton, 300); // adjust delay as needed
}
let pauseButtons = document.querySelectorAll('button[aria-label="Pause"]');
if (pauseButtons.length != 0) {
clickNextPlayButton;
}
}
clickNextPlayButton();
// CLICK ALL SHOW ANSWER BUTTONS
let index5 = 0;
function clickNextShowAnswerButton() {
setTimeout(clickNextShowAnswerButton, 100);
let showAnswerButtons = document.querySelectorAll('button[class="zb-button secondary show-answer-button"]');
if (index5 < showAnswerButtons.length) {
showAnswerButtons[index5].click();
setTimeout(function() {
showAnswerButtons[index5].click();
}, 100); // adjust delay as needed
index5++;
setTimeout(clickNextShowAnswerButton, 300); // adjust delay as needed
}
}
clickNextShowAnswerButton();
})();