Skip to content

Instantly share code, notes, and snippets.

@willcosgrove
Last active January 4, 2022 23:13
Show Gist options
  • Save willcosgrove/7b9d83667dc51d9663e5fa59a7fd2a82 to your computer and use it in GitHub Desktop.
Save willcosgrove/7b9d83667dc51d9663e5fa59a7fd2a82 to your computer and use it in GitHub Desktop.
Copy the wordle as an emoji text chunk

Running the bookmarklet on a game screen like this:

CleanShot 2022-01-04 at 16 55 38@2x

Would yield this output on your clipboard:

🟨⬜⬜⬜⬜
⬜⬜🟨🟨⬜
🟨⬜🟨⬜🟨
🟩🟩🟩🟩🟩

Perfect for sharing without spoiling!

Credit to @buster for this representation

(function copyWordle() {
let output = ""
let rows = document.querySelector("game-app").shadowRoot.querySelector("game-theme-manager").querySelectorAll("game-row")
for (let row of rows) {
if (!row.getAttribute("letters")) break
for (let tile of row.shadowRoot.querySelectorAll("game-tile")) {
switch(tile.getAttribute("evaluation")) {
case "absent":
output += "⬜"
break
case "present":
output += "🟨"
break
case "correct":
output += "🟩"
break
}
}
if (row.hasAttribute("win")) break
output += "\n"
}
navigator.clipboard.writeText(output)
return output
})()
javascript:!function(){let%20e="",t=document.querySelector("game-app").shadowRoot.querySelector("game-theme-manager").querySelectorAll("game-row");for(let%20r%20of%20t){if(!r.getAttribute("letters"))break;for(let%20t%20of%20r.shadowRoot.querySelectorAll("game-tile"))switch(t.getAttribute("evaluation")){case"absent":e+="%E2%AC%9C";break;case"present":e+="%F0%9F%9F%A8";break;case"correct":e+="%F0%9F%9F%A9"}if(r.hasAttribute("win"))break;e+="\n"}navigator.clipboard.writeText(e)}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment