Last active
August 9, 2023 09:13
-
-
Save dclamage/37cf2d4c6cb9d6433f9e492f1c0b41ad to your computer and use it in GitHub Desktop.
Add the day number to the Wordle title.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Wordle Day Number | |
// @namespace http://tampermonkey.net/ | |
// @version 0.5 | |
// @description Add the day number to the Wordle title. | |
// @author Rangsk | |
// @match https://www.nytimes.com/games/wordle/index.html | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=nytimes.com | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const shim = function() { | |
let title = document.querySelector('h1.AppHeader-module_title__EQr6V'); | |
if (title) { | |
let epoch = new Date(2021, 5, 19, 0, 0, 0, 0); | |
let now = Date.now(); | |
let dayOffset = Math.floor((now - epoch) / (1000 * 60 * 60 * 24)); | |
title.innerHTML = 'Wordle #' + dayOffset; | |
return; | |
} | |
setTimeout(shim, 100); | |
}; | |
setTimeout(shim, 100); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment