Wordle - Word Reveal Hack

This script adds an element to the bottom of the page with the daily word. Simply hover it and the daily word is revealed. Click to show and alert. Always "guess" the word in the first try and impress your friends.

Ekde 2022/02/11. Vidu La ĝisdata versio.

// ==UserScript==
// @name         Wordle - Word Reveal Hack
// @namespace    q1k
// @version      1.2
// @description  This script adds an element to the bottom of the page with the daily word. Simply hover it and the daily word is revealed. Click to show and alert. Always "guess" the word in the first try and impress your friends.
// @author       q1k
// @include      *://www.powerlanguage.co.uk/wordle/*
// @include      *://www.nytimes.com/games/wordle/index.html*
// @run-at       document-idle
// ==/UserScript==

var mydiv = document.createElement("div");
mydiv.setAttribute("id","word-reveal");
var styles = document.createElement("style");
styles.innerHTML="#word-reveal{user-select:none;text-align:center;line-height:1.5em;background:#555;color:#555;} #word-reveal:hover{color:white;} .game-id{display:none;}";

var game = document.querySelector("game-app").shadowRoot.querySelector("#game");
game.appendChild(styles);
game.appendChild(mydiv);
if(location.domain=='powerlanguage.co.uk'){
mydiv.addEventListener('click',(e)=>{
    alert("\nToday's word: \n\n" + JSON.parse(localStorage.gameState).solution.toUpperCase() );
});
mydiv.innerHTML = "Today's word: " + JSON.parse(localStorage.gameState).solution.toUpperCase();
} else {
mydiv.addEventListener('click',(e)=>{
    alert("\nToday's word: \n\n" + JSON.parse(localStorage['nyt-wordle-state']).solution.toUpperCase() );
});
mydiv.innerHTML = "Today's word: " + JSON.parse(localStorage['nyt-wordle-state']).solution.toUpperCase();
}