forked from lafkpages/FreericeHack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterval.js
62 lines (52 loc) · 2 KB
/
interval.js
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
// _______ ____ _ ____ __
// / _____/ ___ ___ ____ / __ \(_)_______ / __ )____ / /_
// / /__ / __/ /__/ ___/ / /_/ / / ___/ _ \ / __ / __ \/ __/
// / ___/ / / / /__/ /__/ / _, _/ / /__/ __/ / /_/ / /_/ / /_
// /_/ /_/ /____/____/ /_/ |_/_/\___/\___/ /_____/\____/\__/
//
// Original by: Neil Master/Yeehawlerz101
// Remixed by: LuisAFK
// Make sure to leave your ad blocker off so that Freerice can have some sort of income :)
// How to use: Make an account, sign in, then go to the multiplacation table category (freerice.com/categories/multiplication-table)
// Then when the page loads, go to the console of your web browser and paste this code in the console and enjoy!
// https://github.com/lafkpages/FreericeHack
// Define the function
// Save it as a property of window to prevent re-defining variables
window.freeRiceHackFunc = function()
{
let problem = document.getElementsByClassName("card-title")[0].innerText; // '11 x 12'
let pr = problem.split('x').map(n => parseInt(n)); // [11, 12]
let answer = pr[0] * pr[1]; // 132
let opts = document.getElementsByClassName('card-button'); // [HTMLElement x 4]
let a = opts[0]; // HTMLElement
let b = opts[1]; // HTMLElement
let c = opts[2]; // HTMLElement
let d = opts[3]; // HTMLElement
if (parseInt(a.innerText) == answer)
{
a.click();
}
else if (parseInt(b.innerText) == answer)
{
b.click();
}
else if (parseInt(c.innerText) == answer)
{
c.click();
}
else if (parseInt(d.innerText) == answer)
{
d.click();
}
for (let i = 0; i < window.bruh.length; i++)
{
clearTimeout(window.bruh[i]);
bruh.shift();
}
bruh.push(setTimeout(window.freeRiceHackFunc, 400));
}
// Define a list to save all the timeouts
// Save it as a property of window to prevent re-defining variables
window.bruh = [];
// Start the hack with an initial timeout, it will recall itself automatically
bruh.push(setTimeout(window.freeRiceHackFunc, 400));