-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwordle.js
More file actions
13 lines (13 loc) · 839 Bytes
/
wordle.js
File metadata and controls
13 lines (13 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
var keyboard = [
['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p'],
['a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l'],
['z', 'x', 'c', 'v', 'b', 'n', 'm']
];
var d = document.querySelector("body > game-app").shadowRoot.querySelector("#game > game-keyboard").shadowRoot;
for (var i = 0; i < 5; i++) {
var s = JSON.parse(window.localStorage.gameState).solution[i];
if (keyboard[0].indexOf(s) != -1) d.querySelector("#keyboard > div:nth-child(1)").children[keyboard[0].indexOf(s)].click();
if (keyboard[1].indexOf(s) != -1) d.querySelector("#keyboard > div:nth-child(2)").children[keyboard[1].indexOf(s) + 1].click();
if (keyboard[2].indexOf(s) != -1) d.querySelector("#keyboard > div:nth-child(3)").children[keyboard[2].indexOf(s) + 1].click();
}
d.querySelector("#keyboard > div:nth-child(3)").children[0].click();