@@ -24,49 +24,79 @@ if(url == "10fastfingers.com" || url == "www.10fastfingers.com") {
2424 console . log ( "Site: 10FastFingers" ) ;
2525 console . log ( "~~~~~~~~~~~~~~~~~~~" ) ;
2626 site = 0 ;
27- }
2827// ---------- WIP ----------
29- // else if(url == "www.ratatype.com"|| url == "ratatype.com") {
28+ // } else if(url == "www.ratatype.com"|| url == "ratatype.com") {
3029// console.log("~~~~~~~~~~~~~~~~~~~");
3130// console.log(" TypeCheat Active! ");
3231// console.log("Site: Ratatype");
3332// console.log("~~~~~~~~~~~~~~~~~~~");
3433// site = 1;
35- // }
34+ } else if ( url == "typingtestnow.com" || url == "www.typingtestnow.com" ) {
35+ console . log ( "~~~~~~~~~~~~~~~~~~~" ) ;
36+ console . log ( " TypeCheat Active! " ) ;
37+ console . log ( "Site: TypingTestNow" ) ;
38+ console . log ( "~~~~~~~~~~~~~~~~~~~" ) ;
39+ site = 2 ;
40+ }
3641
37- // Start cheating
38- if ( site == 0 ) {
39- // Interval
40- let cWord = 0 ;
41- // Make sure to constantly update the field
42- setInterval ( function ( ) {
43- if ( document . getElementById ( "inputfield" ) . value == "" ) {
44- document . getElementById ( "inputfield" ) . value = words [ cWord ] ;
45- cWord ++ ;
42+ // Cheat
43+ switch ( site ) {
44+ // 10FastFingers
45+ case 0 :
46+ // Interval
47+ let cWord = 0 ;
48+ // Make sure to constantly update the field
49+ setInterval ( function ( ) {
50+ if ( document . getElementById ( "inputfield" ) . value == "" ) {
51+ document . getElementById ( "inputfield" ) . value = words [ cWord ] ;
52+ cWord ++ ;
53+ }
54+ } , 10 ) ;
55+ break ;
56+ // ---------- WIP ----------
57+ // // Ratatype
58+ // case 1:
59+ // // Generate wordlist
60+ // let text = document.getElementsByClassName("mainTxt")[0];
61+ // let field = document.getElementsByClassName("divTextarea")[0].children[0];
62+ // let words = [];
63+ // for(let i = 0; i < text.children.length; i++) {
64+ // if(text.children[i].innerText != " ") {
65+ // words.push(text.children[i].innerText);
66+ // }
67+ // }
68+ // let i = 1;
69+ // field.value = words[0];
70+ // // Make sure to constantly update the field
71+ // setInterval(function() {
72+ // if(field.value.slice(-1) == " " || !field.value.includes(words[i])) {
73+ // field.value += words[i];
74+ // // Make sure that the word was actually added to the text field
75+ // if(field.value.includes(words[i])) i++;
76+ // console.log(field.value.includes(words[i]));
77+ // }
78+ // }, 10);
79+ // break;
80+ // // TypingTestNow
81+ case 2 :
82+ // Generate wordlist
83+ let text = document . getElementsByClassName ( "sample-text" ) [ 0 ] ;
84+ let words = [ ] ;
85+ for ( let i = 0 ; i < text . children . length ; i ++ ) {
86+ for ( let j = 0 ; j < text . children [ i ] . children . length ; j ++ ) {
87+ words . push ( text . children [ i ] . children [ j ] . innerText ) ;
88+ }
4689 }
47- } , 10 ) ;
48- }
49- // ---------- WIP ----------
50- // else if(site == 1) {
51- // // Generate wordlist
52- // let text = document.getElementsByClassName("mainTxt")[0];
53- // let field = document.getElementsByClassName("divTextarea")[0].children[0];
54- // let words = [];
55- // for(let i = 0; i < text.children.length; i++) {
56- // if(text.children[i].innerText != " ") {
57- // words.push(text.children[i].innerText);
58- // }
59- // }
60- // console.log(words);
61- // let i = 1;
62- // field.value = words[0];
63- // // Make sure to constantly update the field
64- // setInterval(function() {
65- // if(field.value.slice(-1) == " " || !field.value.includes(words[i])) {
66- // field.value += words[i];
67- // // Make sure that the word was actually added to the text field
68- // if(field.value.includes(words[i])) i++;
69- // console.log(field.value.includes(words[i]));
70- // }
71- // }, 10);
72- // }
90+ console . log ( words ) ;
91+ // Interval
92+ let i = 0 ;
93+ // Make sure to constantly update the field
94+ let field = document . getElementById ( "practice-input" ) ;
95+ setInterval ( function ( ) {
96+ if ( field . value == " " || field . value == "" ) {
97+ field . value = words [ i ] ;
98+ i ++ ;
99+ }
100+ } ) , 10 ;
101+ break ;
102+ }
0 commit comments