Skip to content

Instantly share code, notes, and snippets.

@vegeta897
Created July 5, 2021 04:07
Show Gist options
  • Save vegeta897/f44fddba492acde5f19c8d0384022c72 to your computer and use it in GitHub Desktop.
Save vegeta897/f44fddba492acde5f19c8d0384022c72 to your computer and use it in GitHub Desktop.
WSJ crossword bookmarklet to copy list of clues for Discord
javascript:(function(){function getBoxes(e){return""===e.innerText.trim()?e.children.length:" `"+[].slice.call(e.children).map(e=>e.innerText||"_").join(" ")+"` "}function listClues(e){return`\n**__${e.toUpperCase()}__**\n`+[].slice.call(document.getElementsByClassName("puzzle-frame")[0].contentDocument.getElementById(e+"holder").children[0].children[1].children).map(e=>"**"+e.children[0].innerText.replace("\n","** ").split("_").join("\\_")+" ("+getBoxes(e.children[1])+")").join("\n")}navigator.clipboard.writeText(`<${window.location.href.replace("www.","")}>${listClues("across")}\n${listClues("down")}`);})();
@vegeta897
Copy link
Author

vegeta897 commented Jul 5, 2021

image

Usage

  1. Create a new bookmark in your browser and paste the entire content of this gist as the link
  2. Click the bookmark while on a WSJ crossword puzzle page
  3. CTRL+V to paste into a Discord channel

Notes

  • The length of the message you're trying to paste will likely be over 2000 characters, which is the max length a message can be unless you have Nitro. You can get around this by splitting it into 2 messages
  • You can click the bookmark again after you've filled in some letters to update your message with the filled in squares

If you found this useful, you can give it a ⭐
Leave a comment here if you have any questions or anything else to say 💬
You can also add me on Discord vegeta897#7777

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