From: Laurent Mazet Date: Tue, 6 Oct 2020 09:48:25 +0000 (+0200) Subject: Merge branch 'develop' into timer X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=12cc95b700b4532b1e8d8d423e3e27a8aaa95051;p=trivabble.git Merge branch 'develop' into timer --- 12cc95b700b4532b1e8d8d423e3e27a8aaa95051 diff --cc l10n/po/fr/trivabble.po index a12c96f,d46f707..50a414f --- a/l10n/po/fr/trivabble.po +++ b/l10n/po/fr/trivabble.po @@@ -220,20 -220,8 +223,26 @@@ msgstr "Durée du flash laser : msgid "Flash light color" msgstr "Couleur du flash laser" + msgid "Tip!" + msgstr "Astuce !" + + msgid "Next tip" + msgstr "Astuce suivante" ++ +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" diff --cc l10n/pot/trivabble.pot index 69976b6,c0d9408..89d41ed --- a/l10n/pot/trivabble.pot +++ b/l10n/pot/trivabble.pot @@@ -225,20 -219,14 +222,32 @@@ 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 "Next tip" + 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 "" diff --cc public/index.html index e64be9c,e5924b2..5b4bf7a --- a/public/index.html +++ b/public/index.html @@@ -54,19 -58,36 +58,39 @@@

-
- +
+

+ + + (fast) + + (slow)
+
+

-
-

-

-

+
+

+ + + (fast) + + (slow) + +

-
+
+

+ +

+
++
+

+
-
+
@@@ -77,17 -98,12 +101,19 @@@ -
- +
+
+ +
+
-

Number of tiles in the bag:
102
Click on it to take one.

+

Number of tiles in the bag:
102

diff --cc public/trivabble.css index 9528819,711af96..e7ad35a --- a/public/trivabble.css +++ b/public/trivabble.css @@@ -563,6 -640,91 +640,95 @@@ td.blink color:black; } + #help-messages { + box-sizing:border-box; + overflow:auto; + width: auto; + margin-bottom:1px; + } + + #help-box { + margin-left:1ex; + margin-top:1ex; + display:-webkit-flex; + -webkit-flex-direction:column; + -webkit-justify-content:center; + -webkit-align-items:center; + align-items:center; + display:flex; + flex-direction:column; + justify-content:center; + } + + #help-box-inner { + display:-webkit-flex; + -webkit-flex-direction:row; + display:flex; + flex-direction:row; + min-height:2em; + border-top:1px solid gray; + border-bottom:1px solid gray; + -webkit-align-items:center; + align-items:center; + } + + button#next-help-msg { + border:0; + background:none; + color:#333; + font-size:1.5rem; + margin-right:0.5ex; + background:#F1F1F1; + border-radius:100rem; + height:1.5em; + width:1.5em; + font-weight:bold; + transition:500ms; + padding:0; + } + + button#next-help-msg:hover { + background:#CCC; + } + + #help-box-title { + margin:0; + padding:0 0 0.25ex 0; + text-align:right; + width:100%; + color:gray; + font-size:small; + font-style:italic; + } + + #help-messages p { + margin:0; + font-size:0.9; + color:#222; + padding:0 0.5ex; + max-width:17em; + } + + #help-box-inner:before { + content:"i"; + display:inline-block; + height:1.2em; + width:1.2em; + font-style:italic; + font-weight:bold; + font-family:serif; + color:#AAA; + border:2px solid; + border-radius:100rem; + } + + #panel-buttons { + display:-webkit-flex; + -webkit-flex-direction: column; + display:flex; + flex-direction:column; + } ++ +#timer { + text-align: center; +} diff --cc public/trivabble.js index 56aaa08,ccfd03d..e74c3f8 --- a/public/trivabble.js +++ b/public/trivabble.js @@@ -49,9 -54,10 +54,11 @@@ setConf("ENABLE_TILE_SOUND", true); setConf("ENABLE_SPELL_CHECKER", false); setConf("DOUBLE_TAP_DURATIONS", [650, 1100, 1800, 3000, 5000]); + setConf("DOUBLE_TAP_DURATION", middle("DOUBLE_TAP_DURATIONS")); setConf("FLASH_LIGHT_DURATIONS", [800, 1600, 3200]); - setConf("FLASH_LIGHT_COLOR", "#E3E"); + setConf("FLASH_LIGHT_DURATION", middle("FLASH_LIGHT_DURATIONS")); + setConf("FLASH_LIGHT_COLOR", "#ee6633"); + setConf("ENABLE_TIMER", true); function isSetting(key) { return Object.prototype.hasOwnProperty.call(Conf, key) || @@@ -2087,55 -2075,25 +2078,74 @@@ } } + function nextHelpMessage() { + if (typeof nextHelpMessage.index === "undefined") { + nextHelpMessage.index = -1; + } + + const helpMessages = document.getElementById("help-messages"); + if (helpMessages) { + const listOfMessages = helpMessages.getElementsByTagName("p"); + if ((nextHelpMessage.index >= 0) && (nextHelpMessage.index < listOfMessages.length)) { + listOfMessages[nextHelpMessage.index].hidden = true; + } + nextHelpMessage.index++; + if (nextHelpMessage.index === listOfMessages.length) { + nextHelpMessage.index = 0; + } + listOfMessages[nextHelpMessage.index].hidden = false; + } + } + + 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()) { f(); @@@ -2356,8 -2321,8 +2373,9 @@@ initGame(); initSound(); initSpellChecker(); - initLaserPointer(); + initFlashLight(); + nextHelpMessage(); + initTimer(); }; trivabble.l10nError = trivabble.run;
ParticipantRackScoreTurn
Waiting for other participants…