Skip to content

Instantly share code, notes, and snippets.

@JaseHadd
Last active November 7, 2025 05:04
Show Gist options
  • Save JaseHadd/b94c3720bd14b6bb4d613b3fda841fe2 to your computer and use it in GitHub Desktop.
Save JaseHadd/b94c3720bd14b6bb4d613b3fda841fe2 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Load NYT Midi from The Word Finder page
// @namespace https://github.com/JaseHadd
// @copyright Copyright (c) 2025 Jase Haddleton
// @license MIT; https://opensource.org/license/mit
// @version 1.0.0
// @description Lets you use the NYT Midi list on TheWordFinder to go to the puzzle's page on NYTGames
// @author Jase Haddleton
// @updateURL https://gist.github.com/JaseHadd/b94c3720bd14b6bb4d613b3fda841fe2/raw/wordfinder-add-nyt-midi-button.user.js
// @downloadURL https://gist.github.com/JaseHadd/b94c3720bd14b6bb4d613b3fda841fe2/raw/wordfinder-add-nyt-midi-button.user.js
// @match https://www.thewordfinder.com/crossword-solver/todays-nyt-midi-answers-and-hints*
// @match https://www.thewordfinder.com/crossword-solver/nyt-midi-answers-and-hints/*
// @icon https://www.nytimes.com/games-assets/v2/assets/icons/daily.svg
// @grant none
// ==/UserScript==
(function() {
'use strict';
const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
const datePattern = /(\w+) (\d+), (\d+)/;
const datePicker = document.querySelector('mpl-twf-interior-layout mpl-twf-date-picker-button');
function getDate(dateString) {
const [_, month, day, year] = datePattern.exec(dateString.trim());
return new Date(parseInt(year), months.indexOf(month), parseInt(day));
}
function getLink()
{
const line = document.querySelector('mpl-twf-interior-layout p');
var link = line.querySelector('a[data-nytlink]');
if (!link) {
link = document.createElement('a');
link.rel = 'external noreferrer';
link.target = '_blank';
link.textContent = 'Play on NYTimes';
link.dataset.nytlink='';
line.append('\u00A0|\u00A0');
line.append(link);
}
return link;
}
function setLink(date) {
const [mm, dd, yy] = [date.getMonth() + 1, date.getDate(), date.getFullYear()]
.map(String)
.map(s => s.padStart(2, '0'))
.map(s => s.slice(-2));
const link = getLink();
link.href = `https://www.nytimes.com/crosswords/game/paid/midi-${mm}-${dd}-${yy}`;
}
const observer = new MutationObserver((mutations, _) => {
if (mutations.length !== 1) return;
if (mutations[0].type !== 'characterData') return;
setLink(getDate(mutations[0].target.data));
});
setLink(getDate(datePicker.textContent));
observer.observe(datePicker, { subtree: true, characterData: true });
})();
@JaseHadd
Copy link
Author

JaseHadd commented Nov 7, 2025

This script will give you a 'Play on NYTimes' link leading directly to the puzzle's page on NYTimes on any page for a Midi puzzle on TheWordFinder.

To install it, just click the 'raw' button and TamperMonkey should prompt you to install it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment