Last active
April 8, 2025 22:38
-
-
Save kelsin/2416b7f272d5bf1c114f6ab764ca7ac7 to your computer and use it in GitHub Desktop.
18xx.games go to next game
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
javascript: (() => { | |
if (!(window.location.href.match('https://18xx.games'))) { | |
window.location.href = `https://18xx.games`; | |
} | |
const playerId = document.getElementById('nav').children[1].href.match(/profile\/(\d+)/)[1]; | |
fetch("/api/game") | |
.then(response => response.json()) | |
.then(response => response.games) | |
.then(games => games.find(x => x.acting.includes(parseInt(playerId)))) | |
.then(game => { | |
if (game) { | |
window.location.href = `/game/${game.id}`; | |
} else { | |
window.location.href = `/`; | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment