-
-
Save Domiii/52cf49d780ec8c9f01771973c36197af to your computer and use it in GitHub Desktop.
| /** | |
| * This script types for you automatically on www.typingclub.com: | |
| * 1. Open the website | |
| * 2. Blaze past the tutorials | |
| * 3. Go into a level | |
| * 4. Open Console | |
| * 5. Paste the script and press ENTER | |
| */ | |
| // NOTE: When delay (in ms between two strokes) is too low, the site might bug out and the result page will not be shown | |
| const minDelay = 60; | |
| const maxDelay = 60; | |
| const keyOverrides = { | |
| [String.fromCharCode(160)]: ' ' // convert hardspace to normal space | |
| }; | |
| function getTargetCharacters() { | |
| const els = Array.from(document.querySelectorAll('.token span.token_unit')); | |
| const chrs = els | |
| .map(el => { | |
| // get letter to type from each letter DOM element | |
| if (el.firstChild?.classList?.contains('_enter')) { | |
| // special case: ENTER | |
| return '\n'; | |
| } | |
| let text = el.textContent[0]; | |
| return text; | |
| }) | |
| .map(c => keyOverrides.hasOwnProperty(c) ? keyOverrides[c] : c); // convert special characters | |
| return chrs; | |
| } | |
| function recordKey(chr) { | |
| // send it straight to the internal API | |
| window.core.record_keydown_time(chr); | |
| } | |
| function sleep(ms) { | |
| return new Promise(r => setTimeout(r, ms)); | |
| } | |
| async function autoPlay(finish) { | |
| const chrs = getTargetCharacters(); | |
| for (let i = 0; i < chrs.length - (!finish); ++i) { | |
| const c = chrs[i]; | |
| recordKey(c); | |
| //console.log(c, c.charCodeAt()); | |
| await sleep(Math.random() * (maxDelay - minDelay) + minDelay); | |
| } | |
| } | |
| // ############################################################################################################ | |
| // old utilities | |
| // ############################################################################################################ | |
| // /** | |
| // * @see https://stackoverflow.com/questions/8942678/keyboardevent-in-chrome-keycode-is-0/12522752#12522752 | |
| // */ | |
| // function simulateKey(chr, el) { | |
| // _simulateKey(chr, 'keydown', el); | |
| // _simulateKey(chr, 'keypress', el); | |
| // } | |
| // function _simulateKey(chr, type, el) { | |
| // var eventObj = document.createEventObject ? | |
| // document.createEventObject() : document.createEvent("Events"); | |
| // if (eventObj.initEvent) { | |
| // eventObj.initEvent(type || "keydown", true, true); | |
| // } | |
| // let keyCode = chr.charCodeAt(0); | |
| // eventObj.key = chr[0]; | |
| // eventObj.keyCode = keyCode; | |
| // eventObj.which = keyCode; | |
| // eventObj.isTrusted = true; | |
| // el = el || document.body; | |
| // // console.log(keyCode, eventObj); | |
| // el.dispatchEvent ? el.dispatchEvent(eventObj) : el.fireEvent("onkeydown", eventObj); | |
| // } | |
| // document.addEventListener("keydown", function (e) { | |
| // console.log('down', e); | |
| // }); | |
| // document.addEventListener("keypress", function (e) { | |
| // console.log('press', e); | |
| // }); | |
| //$($('.menu-btn')[0].parentNode).prepend('<button onclick=\'simulateKeyPress("c")\'>sim</button>'); | |
| // simulateKey('a', $('input')[0]); | |
| // ############################################################################################################ | |
| // go! | |
| // ############################################################################################################ | |
| autoPlay(true); |
The script is good and it words but it can't detect enter and it cant play the minigames pls fix it if you can
The games and the key ""enter doesnt work on teh bot
i will try to fix mingigames.
can u also make one for the edclub vocabulary and spelling
If you can
About 95 Wmp :(async () => {
const minDelay = 70;
const maxDelay = 110;
const inputTarget = document.querySelector('input, textarea, [contenteditable="true"]') || document.body;
function getTargetCharacters() {
const els = Array.from(document.querySelectorAll('.token span.token_unit'));
return els.map(el => {
if (el.classList.contains('_enter')) return 'Enter';
let char = el.textContent[0];
// Convert special space (char 160) to a standard space
return char.charCodeAt(0) === 160 ? ' ' : char;
});
}
const chars = getTargetCharacters();
console.log(Starting... Found ${chars.length} characters.);
for (const char of chars) {
const key = char === 'Enter' ? 'Enter' : char;
const keyCode = key === 'Enter' ? 13 : key.charCodeAt(0);
const eventSettings = {
key: key,
keyCode: keyCode,
which: keyCode,
code: key === ' ' ? 'Space' : (key === 'Enter' ? 'Enter' : `Key${key.toUpperCase()}`),
bubbles: true,
cancelable: true,
composed: true
};
inputTarget.dispatchEvent(new KeyboardEvent('keydown', eventSettings));
inputTarget.dispatchEvent(new KeyboardEvent('keypress', eventSettings));
// Forcing the space injection
if (inputTarget.value !== undefined) {
inputTarget.value += (key === 'Enter' ? '' : key);
inputTarget.dispatchEvent(new Event('input', { bubbles: true }));
}
inputTarget.dispatchEvent(new KeyboardEvent('keyup', eventSettings));
await new Promise(r => setTimeout(r, Math.random() * (maxDelay - minDelay) + minDelay));
}
console.log("Finished!");
})();
what does the upper code do
hey if anyone could help that would be great how do i use the newer code cause when i try to put it into inspect element it wont work please help! :)
it keeps saying unexpected number / invalid token
locked aria-hidden on an element because its descendant retained focus. The focus must not be hidden from assistive technology users. Avoid using aria-hidden on a focused element or its ancestor. Consider using the inert attribute instead, which will also prevent focus. For more details, see the aria-hidden section of the WAI-ARIA specification at https://w3c.github.io/aria/#aria-hidden.
Element with focus:
Ancestor with aria-hidden:
it wont even let me say allow pasting and this is a personal laptop
?
it keeps saying unexpected number / invalid token
same I also keep on getting this notice
Anyone got an updated one?
/*
Typing Club Automator - AUTO START
Refined by: Lionsbest9
Idea Developed by: Edman
*/
(function() {
'use strict';
if (window.typingClubBot) {
console.log('Bot already running! Close it first with: window.typingClubBot.close()');
return;
}
console.log('🚀 Loading Typing Club Bot v2.0 (Developed by Blaise Adelan, Idea by Yanis)...');
const gui = document.createElement('div');
gui.id = 'typing-bot-gui';
gui.style.cssText =
position: fixed; top: 20px; right: 20px; width: 380px; /* Slightly wider */ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 15px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); z-index: 2147483647; font-family: 'Segoe UI', Arial, sans-serif; /* More common system fonts */ color: white; transition: width 0.2s ease-in-out, height 0.2s ease-in-out; overflow: hidden; /* Hide content when minimized */;gui.innerHTML = `
—
×
`;
document.body.appendChild(gui);
const speedSlider = document.getElementById('speed-slider');
const speedValue = document.getElementById('speed-value');
const accuracySlider = document.getElementById('accuracy-slider');
const accuracyValue = document.getElementById('accuracy-value');
const autoAdvance = document.getElementById('auto-advance');
const handleGames = document.getElementById('handle-games'); // New checkbox
const startBtn = document.getElementById('start-btn');
const stopBtn = document.getElementById('stop-btn');
const status = document.getElementById('status');
const levelInfo = document.getElementById('level-info');
const charsTypedEl = document.getElementById('chars-typed');
const levelsCompletedEl = document.getElementById('levels-completed');
const closeBtn = document.getElementById('bot-close');
const minimizeBtn = document.getElementById('bot-minimize'); // New minimize button
const header = document.getElementById('bot-header');
const botContent = document.getElementById('bot-content'); // Main content area
let botRunning = false;
let charsTypedCount = 0;
let levelsCompleted = 0;
let isMinimized = false;
let originalGuiHeight = gui.offsetHeight; // Store initial height
speedSlider.addEventListener('input', (e) => speedValue.textContent = e.target.value);
accuracySlider.addEventListener('input', (e) => accuracyValue.textContent = e.target.value);
// Draggable
let isDragging = false;
let currentX, currentY, initialX, initialY;
header.addEventListener('mousedown', (e) => {
if (!e.target.closest('button')) { // Don't drag if clicking buttons in header
initialX = e.clientX - gui.offsetLeft;
initialY = e.clientY - gui.offsetTop;
isDragging = true;
gui.style.cursor = 'grabbing';
}
});
document.addEventListener('mousemove', (e) => {
if (isDragging) {
e.preventDefault();
currentX = e.clientX - initialX;
currentY = e.clientY - initialY;
gui.style.left = currentX + 'px';
gui.style.top = currentY + 'px';
gui.style.right = 'auto'; // Disable right positioning once dragged
}
});
document.addEventListener('mouseup', () => {
isDragging = false;
gui.style.cursor = 'grab';
});
minimizeBtn.addEventListener('click', () => {
isMinimized = !isMinimized;
if (isMinimized) {
originalGuiHeight = gui.offsetHeight; // Save current height before minimizing
gui.style.height = header.offsetHeight + 'px';
botContent.style.display = 'none';
minimizeBtn.textContent = '☐'; // Change to square/max button
} else {
gui.style.height = originalGuiHeight + 'px'; // Restore saved height
botContent.style.display = 'block';
minimizeBtn.textContent = '—'; // Change back to minimize
}
});
// Key mapping for KeyboardEvent 'code' and 'key' properties
const KEY_MAP = {
' ': { key: ' ', code: 'Space', keyCode: 32 },
',': { key: ',', code: 'Comma', keyCode: 188 },
'.': { key: '.', code: 'Period', keyCode: 190 },
';': { key: ';', code: 'Semicolon', keyCode: 186 },
"'": { key: "'", code: 'Quote', keyCode: 222 },
'-': { key: '-', code: 'Minus', keyCode: 189 },
'/': { key: '/', code: 'Slash', keyCode: 191 },
'[': { key: '[', code: 'BracketLeft', keyCode: 219 },
']': { key: ']', code: 'BracketRight', keyCode: 221 },
'\': { key: '\', code: 'Backslash', keyCode: 220 },
'
': { key: '', code: 'Backquote', keyCode: 192 },'=': { key: '=', code: 'Equal', keyCode: 187 },
'{': { key: '{', code: 'BracketLeft', keyCode: 219, shiftKey: true },
'}': { key: '}', code: 'BracketRight', keyCode: 221, shiftKey: true },
'|': { key: '|', code: 'Backslash', keyCode: 220, shiftKey: true },
':': { key: ':', code: 'Semicolon', keyCode: 186, shiftKey: true },
'"': { key: '"', code: 'Quote', keyCode: 222, shiftKey: true },
'<': { key: '<', code: 'Comma', keyCode: 188, shiftKey: true },
'>': { key: '>', code: 'Period', keyCode: 190, shiftKey: true },
'?': { key: '?', code: 'Slash', keyCode: 191, shiftKey: true },
'
': { key: '', code: 'Backquote', keyCode: 192, shiftKey: true },'!': { key: '!', code: 'Digit1', keyCode: 49, shiftKey: true },
'@': { key: '@', code: 'Digit2', keyCode: 50, shiftKey: true },
'#': { key: '#', code: 'Digit3', keyCode: 51, shiftKey: true },
'$': { key: '$', code: 'Digit4', keyCode: 52, shiftKey: true },
'%': { key: '%', code: 'Digit5', keyCode: 53, shiftKey: true },
'^': { key: '^', code: 'Digit6', keyCode: 54, shiftKey: true },
'&': { key: '&', code: 'Digit7', keyCode: 55, shiftKey: true },
'': { key: '', code: 'Digit8', keyCode: 56, shiftKey: true },
'(': { key: '(', code: 'Digit9', keyCode: 57, shiftKey: true },
')': { key: ')', code: 'Digit0', keyCode: 48, shiftKey: true },
'': { key: '', code: 'Minus', keyCode: 189, shiftKey: true },
'+': { key: '+', code: 'Equal', keyCode: 187, shiftKey: true }
};
// Populate Key_MAP for a-z A-Z 0-9
for (let i = 0; i < 26; i++) {
const charLower = String.fromCharCode('a'.charCodeAt(0) + i);
const charUpper = String.fromCharCode('A'.charCodeAt(0) + i);
KEY_MAP[charLower] = { key: charLower, code:
Key${charUpper}, keyCode: charUpper.charCodeAt(0) };KEY_MAP[charUpper] = { key: charUpper, code:
Key${charUpper}, keyCode: charUpper.charCodeAt(0), shiftKey: true };}
for (let i = 0; i < 10; i++) {
const char = String.fromCharCode('0'.charCodeAt(0) + i);
KEY_MAP[char] = { key: char, code:
Digit${char}, keyCode: char.charCodeAt(0) };}
function typeChar(char, targetElement) {
let eventProps = KEY_MAP[char];
}
function detectLevel() {
// Look for the element that contains the text to be typed
// TypingClub uses divs with 'current-letter' or similar indicators
const currentLetterSpan = document.querySelector('span.current-letter');
let textContainer = currentLetterSpan ? currentLetterSpan.closest('div.sentence') || currentLetterSpan.closest('div.typable') : null;
}
async function findAndFocusInput() {
let inputField = null;
for (let attempt = 0; attempt < 50; attempt++) { // Increased attempts
// Prioritize the element indicated as the current target
inputField = document.querySelector('span.current-letter, div.current-letter, .user-input, input[type="text"]:focus');
}
async function processLevel() {
if (!botRunning) {
console.log("Bot stopped, ceasing level processing.");
return;
}
}
function startBot() {
botRunning = true;
charsTypedCount = 0; // Reset metrics on new start
levelsCompleted = 0;
charsTypedEl.textContent = '0';
levelsCompletedEl.textContent = '0';
startBtn.disabled = true;
stopBtn.disabled = false;
stopBtn.style.opacity = '1';
startBtn.style.background = '#4CAF50'; // Green
stopBtn.style.background = '#ff6b6b'; // Red
console.log('🤖 Bot started');
processLevel();
}
function stopBot() {
botRunning = false;
startBtn.disabled = false;
stopBtn.disabled = true;
stopBtn.style.opacity = '0.5';
startBtn.style.background = '#10ac84'; // Original green
stopBtn.style.background = '#ff6b6b'; // Red
status.textContent = '⏹ Stopped';
console.log('🤖 Bot stopped.');
}
function closeBot() {
stopBot();
gui.remove();
window.typingClubBot = null;
console.log('Bot GUI closed and removed.');
}
startBtn.addEventListener('click', startBot);
stopBtn.addEventListener('click', stopBot);
closeBtn.addEventListener('click', closeBot); // Corrected this line
window.typingClubBot = { start: startBot, stop: stopBot, close: closeBot, gui: gui }; // Expose gui for external control
// Initial detection after a short delay
setTimeout(detectLevel, 1000); // Give page a bit more time to render initially
console.log('✅ Bot loaded! Adjust settings and click "▶ Start Bot" to begin.');
})();