-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolor_test_auto_cheater.user.js
57 lines (50 loc) · 1.54 KB
/
color_test_auto_cheater.user.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
// ==UserScript==
// @name Color Test Auto-Cheater
// @namespace
// @version 0.1
// @description This cheats at the "color test" game that seems to have gone a little bit viral. Note that you must go to wVw, not www, to get around iframe security. Use "&desiredScore=<n>" in the URL to specify score. NOTE: I AM NOT A JS EXPERT!!! This is just random hackery.
// @author Tamas Zsebe
// @match http://wvw.igame.com/eye-test*
// @grant none
// ==/UserScript==
function retrieveWinningDiv() {
var frame = document.getElementsByTagName("iframe");
if( ! frame ) {
return null;
}
var winningDiv = frame[0].contentWindow.document.getElementsByClassName('thechosenone');
if( ! winningDiv ) {
return null;
}
return winningDiv[0];
}
var cheatsLeft;
var cheatIntervalId;
function highlightWinner() {
if( cheatsLeft == 0 ) {
// Stop processing.
window.clearInterval(cheatIntervalId);
} else {
var winner = retrieveWinningDiv()
if( winner ) {
winner.click();
--cheatsLeft;
}
}
}
function extractDesiredScore() {
var re = /desiredScore=([0-9]+)/;
var result = re.exec(location.search);
if( result ) {
return result[1];
} else {
return 10;
}
}
function cheatify() {
// Extract desired score
cheatsLeft = extractDesiredScore();
// Setup a timer that hits it 10 times a second.
cheatIntervalId = window.setInterval(highlightWinner, 100);
}
setTimeout(cheatify, 2000);