Skip to content
This repository was archived by the owner on Jul 2, 2021. It is now read-only.

Commit c4178dc

Browse files
Added support for Bing Typing Test and normalized variable names.
1 parent 6bc3e07 commit c4178dc

File tree

5 files changed

+119
-47
lines changed

5 files changed

+119
-47
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ As of now, the sites that work are:
66
- [10FastFingers](https://10fastfingers.com/) (Normal tests and [custom text](https://10fastfingers.com/text-practice/new))
77
- [TypeRacer](https://play.typeracer.com/)
88
- [TypingTestNow](https://typingtestnow.com/)
9+
- [Bing Typing Test](https://www.bing.com/search?q=typing+test)
910

1011
I am planning to add support for more.
1112

@@ -30,6 +31,7 @@ If you go too fast, an alert box will appear saying that they believe you have c
3031
### If you're using `typecheat-button.min.js`
3132
On **10FastFingers**, the button appears just **below** the text field.
3233
On **TypeRacer**, the button appears **in the navbar** above the "Blog, Forum, Pit Stop, About" buttons.
33-
On **TypingTestNow**, the button appears at the **top of the page** just under the navbar.
34+
On **TypingTestNow**, the button appears at the **top of the page** just under the navbar.
35+
On **Bing Typing Test**, the button appears in the typing test item **to the right of** the "Typing test" heading.
3436

35-
**Note: On 10FastFingers, if you end up going through the entire text, the words will continue to autofill. If you continue to press space it can cause you to get incorrect words marked, despite the text being over.**
37+
**Note: On 10FastFingers, if you end up going through the entire text, the words will continue to autofill. If you continue to press space it can cause you to get incorrect words marked, despite the text being over.**

typecheat-button.js

Lines changed: 61 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,26 @@ if(url == "10fastfingers.com" || url == "www.10fastfingers.com") {
4646
} else if(url == "typingtestnow.com" || url == "www.typingtestnow.com") {
4747
console.log("~~~~~~~~~~~~~~~~~~~\n TypeCheat Active! \nSite: TypingTestNow\n~~~~~~~~~~~~~~~~~~~");
4848
site = 2;
49+
} else if(url == "www.bing.com" || url == "bing.com") {
50+
console.log("~~~~~~~~~~~~~~~~~~~\n TypeCheat Active! \nSite: Bing Test\n~~~~~~~~~~~~~~~~~~~");
51+
site = 3;
4952
}
5053

54+
// Variables
55+
let tText, tWords, cWord, tField;
56+
5157
// 10FastFingers Cheat Code
5258
function tenFastCheat() {
5359
// Generate wordlist
54-
let tText = document.getElementById("row1");
55-
let tWords = [];
60+
tText = document.getElementById("row1");
61+
tWords = [];
5662
for(let i = 0; i < tText.children.length; i++) {
5763
tWords.push(tText.children[i].innerText);
5864
}
5965
// Interval
60-
let cWord = 0;
66+
cWord = 0;
6167
// Different method for different modes
62-
let tField = null;
68+
tField = null;
6369
if(altMode == 0) {
6470
tField = document.getElementById("inputfield");
6571
} else if(altMode == 1) {
@@ -78,15 +84,15 @@ function tenFastCheat() {
7884
// TypeRacer Cheat Code
7985
function typeRacerCheat() {
8086
// Generate wordlist
81-
let textElement = document.querySelector("#gwt-uid-15 > table > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(1) > td > table > tbody > tr:nth-child(1) > td");
82-
let wordlist = textElement.innerText.split(" ");
87+
tText = document.querySelector("#gwt-uid-15 > table > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(1) > td > table > tbody > tr:nth-child(1) > td");
88+
tWords = tText.innerText.split(" ");
8389
// Interval
84-
let crWord = 0;
85-
let textField = document.querySelector("#gwt-uid-15 > table > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(2) > td > input");
86-
textField.addEventListener("keydown", function(e) {
90+
cWord = 0;
91+
tField = document.querySelector("#gwt-uid-15 > table > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(2) > td > input");
92+
tField.addEventListener("keydown", function(e) {
8793
if(e.keyCode == 32) {
88-
textField.value = wordlist[crWord];
89-
crWord++;
94+
tField.value = tWords[cWord];
95+
cWord++;
9096
}
9197
});
9298
// Change button colour to show that it has activated
@@ -96,26 +102,55 @@ function typeRacerCheat() {
96102
// TypingTestNow Cheat Code
97103
function typingTestNowCheat() {
98104
// Generate wordlist
99-
let text = document.getElementsByClassName("sample-text")[0];
100-
let words = [];
101-
for(let i = 0; i < text.children.length; i++) {
102-
for(let j = 0; j < text.children[i].children.length; j++) {
103-
words.push(text.children[i].children[j].innerText);
105+
tText = document.getElementsByClassName("sample-text")[0];
106+
tWords = [];
107+
for(let i = 0; i < tText.children.length; i++) {
108+
for(let j = 0; j < tText.children[i].children.length; j++) {
109+
words.push(tText.children[i].children[j].innerText);
104110
}
105111
}
106112
// Interval
107-
var i = 0;
108-
let field = document.getElementById("practice-input");
109-
field.addEventListener("keydown", function(e) {
113+
cWord = 0;
114+
tField = document.getElementById("practice-input");
115+
tField.addEventListener("keydown", function(e) {
110116
if(e.keyCode == 32) {
111-
field.value = words[i];
112-
i++;
117+
tField.value = tWords[cWord];
118+
cWord++;
113119
}
114120
});
115121
// Change button colour to show that it has activated
116122
document.getElementsByClassName("row")[0].children[0].style = "width: 100%; color: #0F0;";
117123
}
118124

125+
// Bing Typing Test Cheat Code
126+
function bingCheat() {
127+
// Generate wordlist
128+
tText = document.getElementById("edu_promptText");
129+
tWords = [];
130+
let workWord = "";
131+
for(let i = 0; i < tText.children.length; i++) {
132+
for(let j = 0; j < tText.children[i].children.length; j++) {
133+
if(tText.children[i].children[j].className == "space") {
134+
tWords.push(workWord);
135+
workWord = "";
136+
} else {
137+
workWord += tText.children[i].children[j].innerText;
138+
}
139+
}
140+
}
141+
// Interval
142+
cWord = 0;
143+
tField = document.getElementById("edu_inputText");
144+
tField.addEventListener("keydown", function(e) {
145+
if(e.keyCode == 32) {
146+
tField.value += tWords[cWord];
147+
cWord++;
148+
}
149+
});
150+
// Change button colour to show that it has activated
151+
document.getElementById("edu_answer").children[0].children[0].getElementsByTagName("button")[0].style = "color: #0F0;";
152+
}
153+
119154
// Cheat
120155
switch(site) {
121156
// 10FastFingers (Normal)
@@ -133,4 +168,9 @@ switch(site) {
133168
// Create cheat button
134169
document.getElementsByClassName("row")[0].innerHTML = "<button style=\"width: 100%;\" onclick=\"javascript:typingTestNowCheat();\">Start TypeCheat</button>"
135170
break;
171+
// Bing Typing Test
172+
case 3:
173+
// Create cheat button
174+
document.getElementById("edu_answer").children[0].children[0].innerHTML += "<button onclick=\"javascript:bingCheat();\">Start TypeCheat</button>";
175+
break;
136176
}

typecheat-button.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

typecheat.js

Lines changed: 52 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,28 @@ if(url == "10fastfingers.com" || url == "www.10fastfingers.com") {
2929
} else if(url == "typingtestnow.com" || url == "www.typingtestnow.com") {
3030
console.log("~~~~~~~~~~~~~~~~~~~\n TypeCheat Active! \nSite: TypingTestNow\n~~~~~~~~~~~~~~~~~~~");
3131
site = 2;
32+
} else if(url == "www.bing.com" || url == "bing.com") {
33+
console.log("~~~~~~~~~~~~~~~~~~~\n TypeCheat Active! \nSite: Bing Test\n~~~~~~~~~~~~~~~~~~~");
34+
site = 3;
3235
}
3336

37+
// Variables
38+
let tText, tWords, cWord, tField;
39+
3440
// Cheat
3541
switch(site) {
3642
// 10FastFingers (Normal)
3743
case 0:
38-
console.log("BROKEN");
3944
// Generate wordlist
40-
let tText = document.getElementById("row1");
41-
let tWords = [];
45+
tText = document.getElementById("row1");
46+
tWords = [];
4247
for(let i = 0; i < tText.children.length; i++) {
4348
tWords.push(tText.children[i].innerText);
4449
}
4550
// Interval
46-
let cWord = 0;
51+
cWord = 0;
4752
// Different method for different modes
48-
let tField = null;
53+
tField = null;
4954
if(altMode == 0) {
5055
tField = document.getElementById("inputfield");
5156
} else if(altMode == 1) {
@@ -61,36 +66,61 @@ switch(site) {
6166
// TypeRacer
6267
case 1:
6368
// Generate wordlist
64-
let textElement = document.querySelector("#gwt-uid-15 > table > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(1) > td > table > tbody > tr:nth-child(1) > td");
65-
let wordlist = textElement.innerText.split(" ");
69+
tText = document.querySelector("#gwt-uid-15 > table > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(1) > td > table > tbody > tr:nth-child(1) > td");
70+
tWords = tText.innerText.split(" ");
6671
// Interval
67-
let crWord = 0;
68-
let textField = document.querySelector("#gwt-uid-15 > table > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(2) > td > input");
69-
textField.addEventListener("keydown", function(e) {
72+
cWord = 0;
73+
tField = document.querySelector("#gwt-uid-15 > table > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(2) > td > input");
74+
tField.addEventListener("keydown", function(e) {
7075
if(e.keyCode == 32) {
71-
textField.value = wordlist[crWord];
72-
crWord++;
76+
tField.value = tWords[cWord];
77+
cWord++;
7378
}
7479
});
7580
break;
7681
// TypingTestNow
7782
case 2:
7883
// Generate wordlist
79-
let text = document.getElementsByClassName("sample-text")[0];
80-
let words = [];
81-
for(let i = 0; i < text.children.length; i++) {
82-
for(let j = 0; j < text.children[i].children.length; j++) {
83-
words.push(text.children[i].children[j].innerText);
84+
tText = document.getElementsByClassName("sample-text")[0];
85+
tWords = [];
86+
for(let i = 0; i < tText.children.length; i++) {
87+
for(let j = 0; j < tText.children[i].children.length; j++) {
88+
words.push(tText.children[i].children[j].innerText);
8489
}
8590
}
8691
// Interval
87-
let i = 0;
88-
let field = document.getElementById("practice-input");
89-
field.addEventListener("keydown", function(e) {
92+
cWord = 0;
93+
tField = document.getElementById("practice-input");
94+
tField.addEventListener("keydown", function(e) {
9095
if(e.keyCode == 32) {
91-
field.value = words[i];
92-
i++;
96+
tField.value = tWords[cWord];
97+
cWord++;
9398
}
9499
});
95100
break;
101+
// Bing Typing Test
102+
case 3:
103+
// Generate wordlist
104+
tText = document.getElementById("edu_promptText");
105+
tWords = [];
106+
let workWord = "";
107+
for(let i = 0; i < tText.children.length; i++) {
108+
for(let j = 0; j < tText.children[i].children.length; j++) {
109+
if(tText.children[i].children[j].className == "space") {
110+
tWords.push(workWord);
111+
workWord = "";
112+
} else {
113+
workWord += tText.children[i].children[j].innerText;
114+
}
115+
}
116+
}
117+
// Interval
118+
cWord = 0;
119+
tField = document.getElementById("edu_inputText");
120+
tField.addEventListener("keydown", function(e) {
121+
if(e.keyCode == 32) {
122+
tField.value += tWords[cWord];
123+
cWord++;
124+
}
125+
});
96126
}

0 commit comments

Comments
 (0)