msgid "Interface language:"\r
msgstr "Langue de l'interface :"\r
\r
+msgid "Sorry to disturb you, but we need to reload the game so you can continue playing. You will not lose anything except the messages in the chat. Are you ready?"\r
+msgstr "Désolé pour le dérangement, mais nous avons besoin de recharger le jeu pour que vous poussiez continuer à jouer. Vous ne perdrez rien sauf les messages dans le chat. Êtes-vous prêt·e ?"\r
+\r
msgid "To continue playing, click here"\r
msgstr "Pour continuer à jouer, cliquez ici"\r
(function () {
"use strict";
+ var VERSION = 202004041733;
var POLLING_DELAY = 2000;
var _ = (window.libD && libD.l10n) ? libD.l10n() : function (s) {return s;};
var lastDate = 0;
var blockMove = 0;
+ var needsRestart = false;
var gameInProgress = false;
function mouseDown(ele, fun, stop) {
var pollingReady = false;
var retriedImmediately = false;
- function fatalError(e) {
+ function forceReload(msg) {
+ needsRestart = true;
myConfirm(
- _("Sorry, a problem just happened. The page must be reloaded. If the problem is not too serious, you should be able to keep playing normally. Otherwise, contact the person who is able to fix the problem. Click on “Yes” to reload the page."),
+ msg,
function () {
location.reload();
}, function () {
throw e;
}
+ function fatalError(e) {
+ if (!needsRestart) {
+ // No need to show the user that a problem just happened if a message asking to restart has already been shown.
+ forceReload(_("Sorry, a problem just happened. The page must be reloaded. If the problem is not too serious, you should be able to keep playing normally. Otherwise, contact the person who is able to fix the problem. Click on “Yes” to reload the page."));
+ }
+ throw e;
+ }
+
function jsonError(json, e) {
console.error("An error ocurred while parsing this JSON message:", json);
fatalError(e);
return;
}
+ if (data.pleaseRestart) {
+ forceReload(_("Sorry to disturb you, but we need to reload the game so you can continue playing. You will not lose anything except the messages in the chat. Are you ready?"));
+ }
+
if (data.msg) {
chatMessages.appendChild(
document.createElement("div")
}
function retryPolling() {
+ if (needsRestart) {
+ return;
+ }
+
pollingServer = false;
pollingReady = false;
}
function send(data) {
+ if (needsRestart) {
+ return;
+ }
+
if (!pollingReady && ((data.cmds && data.cmds.length) && data.cmds[0].cmd !== "joinGame")) {
sendCmds();
setTimeout(send.bind(null, data), POLLING_DELAY);
pollingServer = true;
thisRequestIsPolling = true;
+ data.version = VERSION;
}
if (!thisRequestIsPolling) {
parseAndHandleReceivedData(e.data);
};
- es.onerror = retryPolling;
+ es.onerror = function () {
+ if (needsRestart) {
+ es.close();
+ } else {
+ retryPolling();
+ }
+ };
+
return;
}