alexphanna / random-mini

Simple JavaScript bookmarklet that opens a random New York Times Mini.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Random Mini

Bookmarklet

Install by adding the following code snippet as the URL of a bookmark.

javascript: (() => {
    let today = new Date();
    let year = 2014 + Math.floor(Math.random() * (today.getFullYear() - 2013));
    let month = Math.floor(Math.random() * 12 + 1);
    if (year == 2014) month = Math.floor(Math.random() * 5 + 8);
    else if (year == today.getFullYear()) month = Math.floor(Math.random() * today.getMonth() + 1);
    let day = Math.floor(Math.random() * new Date(year, month, 0).getDate() + 1);
    if (year == 2014 && month == 8) day = Math.floor(Math.random() * 11 + 21);
    else if (year == today.getFullYear() && month == today.getMonth()) day = Math.floor(Math.random() * today.getDay() + 1);
    window.location.assign("https://www.nytimes.com/crosswords/game/mini/" + year + "/" + month + "/" + day);
  })();

About

Simple JavaScript bookmarklet that opens a random New York Times Mini.


Languages

Language:JavaScript 100.0%