I had to modify the script, but it finally worked.
This is the script that worked for me:
// is there a game to claim ? if yes, claim it
if ($('[value="claim"]') && $('[value="claim"]')[0]) {
$('[value="claim"]')[0].click();
// have I claimed a game ? If yes, go back
} else if (!window.location.toString().includes("/bundle/download")) {
$('.nav_btn')[1].click();
// no game to claim, no game claimed, change page
} else {
$('.next_page')[0].click()
}