Lewdle - Word Reveal Hack

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Lewdle - Word Reveal Hack
// @namespace    q1k
// @version      1.1.1
// @description  This script adds an element to the bottom of the page with the daily word. Simply hover & click it and the daily word is revealed. Always "guess" the word on the first try and impress your friends.
// @author       q1k
// @match        *://www.lewdlegame.com/*
// @run-at       document-idle
// ==/UserScript==

function findElement(selector) {
    return new Promise(function(resolve) {
        if (document.querySelector(selector)) {
            return resolve(document.querySelector(selector));
        }
        const observer = new MutationObserver(function(mutations) {
            if (document.querySelector(selector)) {
                resolve(document.querySelector(selector));
                observer.disconnect();
            }
        });
        observer.observe(document, {
            childList: true,
            subtree: true
        });
    });
}

var mydiv = document.createElement("div");
mydiv.setAttribute("id","word-reveal");
var styles = document.createElement("style");
styles.innerHTML="body{overflow:auto;} .testAd, .versionNumMain{display:none;} .mainKeyboard{height:100%;} html,body{height:100%;} #root{display:flex;flex-direction:column;height:100%;} #word-reveal{order:3;user-select:none;text-align:center;line-height:1.5em;background:#555;color:#555;} #word-reveal:hover{color:white;} .game-id{display:none;}";

document.body.appendChild(styles);

findElement("#root .testMain").then(function(el){
    el.closest("#root").appendChild(mydiv);
});

mydiv.addEventListener('click',function(e){
    mydiv.textContent = "Today's word: " + atob(JSON.parse(localStorage.currentTarget)).toUpperCase();
});

mydiv.innerHTML = "Click to reveal today's word";