Merge branch 'develop' into timer
authorLaurent Mazet <mazet@softndesign.org>
Sun, 6 Dec 2020 16:59:03 +0000 (17:59 +0100)
committerLaurent Mazet <mazet@softndesign.org>
Sun, 6 Dec 2020 16:59:03 +0000 (17:59 +0100)
1  2 
l10n/po/fr/trivabble.po
l10n/pot/trivabble.pot
public/index.html
public/trivabble.css
public/trivabble.js

index 50a414fa4b7e25784f11e9e85ff4fd3dbe418e66,571bc21434215ba5da38ea18c8cb3ae23b556bdb..f9c022fc2ab10ed304492c28f85189246c5c702b
@@@ -229,20 -232,11 +235,29 @@@ msgstr  "Astuce !
  msgid "Next tip"
  msgstr "Astuce suivante"
  
 -msgid  "Disable the spell checker"
++msgid "Disable the spell checker"
+ msgstr "Désactiver la vérification orthographique"
+ 
+ msgid "Spell checking is not available for this language."
+ msgstr "La vérification orthographique n'est pas disponible dans cette langue."
+ 
+ msgid "Score new words"
+ msgstr "Compter les points"
++
 +msgid  "Turn timer:"
 +msgstr "Temps du tour :"
 +
 +msgid  "Global timer:"
 +msgstr "Temp global :"
 +
 +msgid  "{0}d"
 +msgstr "{0}j"
 +
 +msgid  "{0}h"
 +msgstr "{0}h"
 +
 +msgid  "{0}' {1}''"
 +msgstr "{0}' {1}''"
 +
 +msgid  "Enable timer"
 +msgstr "Activer le timer"
index 89d41edd06befca65d7f2b6c2b5a55f2a2035d1d,7b042715756339b966d0d393414240b1d945e8b1..380a1974f91556b68a9cc2f6e8b972ce336ea11c
@@@ -142,6 -142,6 +142,12 @@@ msgstr "
  msgid  "Who's turn? Click on the Turn button!"
  msgstr ""
  
++msgid  "Click on (+) to increase someone's score."
++msgstr ""
++
++msgid  "Show a cell to everyone by double-clicking on it."
++msgstr ""
++
  msgid  "Show my rack to other players"
  msgstr ""
  
@@@ -222,32 -225,23 +234,35 @@@ msgstr "
  msgid  "Flash light color"
  msgstr ""
  
--msgid  "Click on (+) to increase someone's score."
 -msgstr ""
 -
 -msgid  "Show a cell to everyone by double-clicking on it."
 -msgstr ""
 -
+ msgid  "Tip!"
  msgstr ""
  
- msgid  "Show a cell to everyone by double-clicking on it."
+ msgid "Next tip"
  msgstr ""
  
- msgid  "Tip!"
+ msgid "Disable the spell checker"
  msgstr ""
  
- msgid "Next tip"
+ msgid "Spell checking is not available for this language."
+ msgstr ""
+ 
+ msgid "Score new words"
  msgstr ""
 +
 +msgid  "Turn timer:"
 +msgstr ""
 +
 +msgid  "Global timer:"
 +msgstr ""
 +
 +msgid  "{0}d"
 +msgstr ""
 +
 +msgid  "{0}h"
 +msgstr ""
 +
 +msgid  "{0}' {1}''"
 +msgstr ""
 +
 +msgid  "Enable timer"
 +msgstr ""
Simple merge
Simple merge
index e74c3f877f05663ec6954385979c52382899cf9c,08733245b56e108a53acd4689392c49916667575..e0b30ff55b3fcc9112255e8e2ea29fe2466d9669
      setConf("FLASH_LIGHT_DURATIONS", [800, 1600, 3200]);
      setConf("FLASH_LIGHT_DURATION",  middle("FLASH_LIGHT_DURATIONS"));
      setConf("FLASH_LIGHT_COLOR",     "#ee6633");
+     setConf("API_ENTRY_POINT",       Conf.APP_PATH + "/:trivabble");
+     setConf("PREMIUM_SEVEN_TILES",   50);
+     setConf("SCORE_LAST_PLAYER",     true);
 +    setConf("ENABLE_TIMER",          true);
 +
 +    function isSetting(key) {
 +        return Object.prototype.hasOwnProperty.call(Conf, key) ||
 +            Object.prototype.hasOwnProperty.call(localStorage, key);
 +    }
  
      function getSetting(key) {
          let type;
      function setCurrentPlayer(player) {
          if (currentPlayer && tablePlayers[currentPlayer]) {
              tablePlayers[currentPlayer].classList.remove("current-player");
 +            localStorage.timerTurnDate = timerDate();
          }
  
-         currentTilePlayed = {};
          currentPlayer = player;
          refreshCurrentPlayer();
      }
          }
      }
  
 +    function timerString(delta) {
 +        const d = Math.floor(delta / (60 * 60 * 24));
 +        const h = Math.floor((delta % (60 * 60 * 24)) / (60 * 60));
 +        const m = Math.floor((delta % (60 * 60)) / 60);
 +        const s = Math.floor(delta % 60);
 +        return ((d > 0) ? format(_("{0}d "), d) : "") +
 +               ((h > 0) ? format(_("{0}h "), h) : "") +
 +               format(_("{0}' {1}''"), m, s);
 +    }
 +
 +    function timerDate() {
 +        return Math.floor(Date.now() / 1000);
 +    }
 +
 +    function initTimer() {
 +        if (!Object.prototype.hasOwnProperty.call(localStorage, "timerTurnDate")) {
 +            localStorage.timerTurnDate = timerDate();
 +        }
 +        if (!Object.prototype.hasOwnProperty.call(localStorage, "timerGlobalDate")) {
 +            localStorage.timerGlobalDate = timerDate();
 +        }
 +        if (!Object.prototype.hasOwnProperty.call(localStorage, "timerEnable")) {
 +            localStorage.timerEnable = getSetting("ENABLE_TIMER");
 +        }
 +        document.getElementById("enable-timer").onclick = function () {
 +            setTimerState(document.getElementById("enable-timer").checked);
 +        };
 +        setTimerState(localStorage.timerEnable);
 +    }
 +
 +    function setTimerState(state) {
 +        if (state) {
 +            document.getElementById("timer").style.display = "block";
 +            document.getElementById("enable-timer").checked = true;
 +            localStorage.timer = setInterval(function () {
 +                document.getElementById("timer-turn").textContent = timerString(timerDate() - Number(localStorage.timerTurnDate));
 +                document.getElementById("timer-global").textContent = timerString(timerDate() - Number(localStorage.timerGlobalDate));
 +            }, 1000);
 +        } else {
 +            document.getElementById("timer").style.display = "none";
 +            document.getElementById("enable-timer").checked = false;
 +            if (Object.prototype.hasOwnProperty.call(localStorage, "timer")) {
 +                clearInterval(localStorage.timer);
 +                delete localStorage.timer;
 +            }
 +            localStorage.timerGlobalDate = localStorage.timerTurnDate = timerDate();
 +        }
 +    }
 +
      function repromptName(f) {
-         if (getSetting("trivabblePlayerName") && getSetting("trivabblePlayerName").trim()) {
+         if (getSetting("PlayerName") && getSetting("PlayerName").trim()) {
              f();
          } else {
              myPrompt(