Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexphanna/random-mini
Simple JavaScript bookmarklet that opens a random New York Times Mini.
https://github.com/alexphanna/random-mini
Last synced: 21 days ago
JSON representation
Simple JavaScript bookmarklet that opens a random New York Times Mini.
- Host: GitHub
- URL: https://github.com/alexphanna/random-mini
- Owner: alexphanna
- Created: 2023-02-24T13:05:15.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-21T02:14:54.000Z (over 1 year ago)
- Last Synced: 2024-11-08T02:42:50.383Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Random Mini
### Bookmarklet
Install by adding the following code snippet as the URL of a bookmark.
```javascript
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);
})();
```