From aa595353ac095aef5a2a2c9f35321353ad44a2be Mon Sep 17 00:00:00 2001
From: Laurent Mazet
Date: Wed, 23 Dec 2020 21:52:09 +0100
Subject: [PATCH 01/23] New option for caption
---
public/index.html | 12 +++++++++++
public/trivabble.css | 17 +++++++++++++++-
public/trivabble.js | 47 ++++++++++++++++++++++++++++++++++++++------
3 files changed, 69 insertions(+), 7 deletions(-)
diff --git a/public/index.html b/public/index.html
index 8d046a0..ed592cf 100644
--- a/public/index.html
+++ b/public/index.html
@@ -101,6 +101,18 @@
+
+
+
+
diff --git a/public/trivabble.css b/public/trivabble.css
index 85127fd..ce40519 100644
--- a/public/trivabble.css
+++ b/public/trivabble.css
@@ -122,10 +122,25 @@ html, #board, [draggable], .tile {
display:inline-block;
white-space:pre-wrap;
font-size:7px;
- text-overflow:ellipsis;
overflow:hidden;
}
+.special-cell-label-clip {
+ text-overflow:clip;
+}
+
+.special-cell-label-dots {
+ text-overflow:ellipsis;
+}
+
+.special-cell-label-none {
+ visibility:hidden;
+}
+
+.special-cell-label-short {
+ display:inline;
+}
+
#center-cell .special-cell-label {
font-weight:bold;
color:black;
diff --git a/public/trivabble.js b/public/trivabble.js
index 717ebd8..4e7a3b2 100644
--- a/public/trivabble.js
+++ b/public/trivabble.js
@@ -63,6 +63,7 @@
setConf("PREMIUM_SEVEN_TILES", 50);
setConf("SCORE_LAST_PLAYER", true);
setConf("ENABLE_TIMER", false);
+ setConf("CELL_CAPTIONS", "dots"); // "clip", "dots", "none", "short"
function isSetting(key) {
return Object.prototype.hasOwnProperty.call(Conf, key) ||
@@ -155,7 +156,8 @@
Timer: "number",
TimerEnable: "boolean",
TimerGameDate: "number",
- TimerTurnDate: "number"
+ TimerTurnDate: "number",
+ CellCaptions: "string"
};
const _ = (window.libD && libD.l10n) ? libD.l10n() : function (s) {
@@ -1542,17 +1544,25 @@
}
const specialTypesText = {
- doubleLetter: _("Double\nLetter"),
- doubleWord: _("Double\nWord"),
- tripleLetter: _("Triple\nLetter"),
- tripleWord: _("Triple\nWord")
+ doubleLetter: "Double\nLetter",
+ doubleWord: "Double\nWord",
+ tripleLetter: "Triple\nLetter",
+ tripleWord: "Triple\nWord"
+ };
+
+ const specialTypesShortText = {
+ doubleLetter: "DL",
+ doubleWord: "DW",
+ tripleLetter: "TL",
+ tripleWord: "TW"
};
function specialCell(type, cell) {
cell.firstChild.appendChild(document.createElement("span"));
cell.classList.add("special-cell");
cell.classList.add("special-cell-" + type);
- cell.lastChild.lastChild.textContent = cell.title = _(specialTypesText[type]);
+ cell.lastChild.lastChild.longText = cell.title = _(specialTypesText[type]);
+ cell.lastChild.lastChild.shortText = _(specialTypesShortText[type]);
cell.lastChild.lastChild.className = "special-cell-label";
}
@@ -2295,6 +2305,30 @@
}
}
+ function initCellCaptions() {
+ document.getElementById("cell-captions").onclick = function () {
+ setCellCaptions(document.getElementById("cell-captions").value);
+ };
+
+ setCellCaptions(getSetting("CellCaptions", getSetting("CELL_CAPTIONS")));
+ }
+
+ function setCellCaptions(mode) {
+ setSetting("CellCaptions", mode);
+ document.getElementById("cell-captions").value = mode;
+
+ for (const cells of [].slice.call(document.getElementsByClassName("special-cell-label"))) {
+ cells.classList.remove("special-cell-label-clip");
+ cells.classList.remove("special-cell-label-dots");
+ cells.classList.remove("special-cell-label-none");
+ cells.classList.remove("special-cell-label-short");
+
+ cells.classList.add("special-cell-label-" + mode);
+
+ cells.innerHTML = (mode === "short") ? cells.shortText : cells.longText;
+ }
+ }
+
function repromptName(f) {
if (getSetting("PlayerName") && getSetting("PlayerName").trim()) {
f();
@@ -2528,6 +2562,7 @@
initFlashLight();
nextHelpMessage();
initTimer();
+ initCellCaptions();
};
trivabble.l10nError = trivabble.run;
From b1dade8bb90a08514801e7900c8aa2a4302e5f8a Mon Sep 17 00:00:00 2001
From: Laurent Mazet
Date: Mon, 28 Dec 2020 10:53:05 +0100
Subject: [PATCH 02/23] add a rule for tidy checker
---
Makefile | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Makefile b/Makefile
index cf855d8..1015463 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,8 @@ PORT = 3000
ESLINT?=eslint
+TIDY?=tidy
+
ifeq (, $(shell which $(firstword ${ESLINT})))
ESLINT?=npx eslint
endif
@@ -34,5 +36,8 @@ public/dict/list.js:
eslint:
-${ESLINT} **/*.js
+tidy:
+ -${TIDY} -xml -errors -q public/*.html
+
start-dev-server: lang
cd server && make start-dev-server
From b0eff630ffe8bfd2d577602bdd3408d26a992004 Mon Sep 17 00:00:00 2001
From: Laurent Mazet
Date: Mon, 28 Dec 2020 11:29:17 +0100
Subject: [PATCH 03/23] various fixes
---
public/index.html | 9 +++++----
public/trivabble.js | 2 +-
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/public/index.html b/public/index.html
index ed592cf..b4c1896 100644
--- a/public/index.html
+++ b/public/index.html
@@ -101,18 +101,19 @@
+
-
+
diff --git a/public/trivabble.js b/public/trivabble.js
index 4e7a3b2..7ce7c1c 100644
--- a/public/trivabble.js
+++ b/public/trivabble.js
@@ -2325,7 +2325,7 @@
cells.classList.add("special-cell-label-" + mode);
- cells.innerHTML = (mode === "short") ? cells.shortText : cells.longText;
+ cells.textContent = (mode === "short") ? cells.shortText : cells.longText;
}
}
From aaa1c92ac8aedf62a744aba8d20afc89eeb4986c Mon Sep 17 00:00:00 2001
From: Laurent Mazet
Date: Mon, 28 Dec 2020 11:29:53 +0100
Subject: [PATCH 04/23] default value for CELL_CAPTIONS
---
public/config.js.sample | 3 +++
1 file changed, 3 insertions(+)
diff --git a/public/config.js.sample b/public/config.js.sample
index 59619b9..23912ea 100644
--- a/public/config.js.sample
+++ b/public/config.js.sample
@@ -44,6 +44,9 @@ window.TrivabbleConf = {
// Timer activation
ENABLE_TIMER: false,
+ // Cell captions. Could be "clip", "dots", "none" or "short"
+ CELL_CAPTIONS: "dots",
+
// I don't like trailing commas, here is a nice message for you reading this file :-)
HAVE_FUN: true
};
From 7bd9b6c16be4f37b04ae920e8eb3a2d6a8d261cf Mon Sep 17 00:00:00 2001
From: Laurent Mazet
Date: Fri, 15 Jan 2021 18:20:52 +0100
Subject: [PATCH 05/23] add class to board instead of cells
---
public/trivabble.css | 8 ++++----
public/trivabble.js | 14 +++++++-------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/public/trivabble.css b/public/trivabble.css
index ce40519..b36d130 100644
--- a/public/trivabble.css
+++ b/public/trivabble.css
@@ -125,19 +125,19 @@ html, #board, [draggable], .tile {
overflow:hidden;
}
-.special-cell-label-clip {
+.special-cell-label-clip .special-cell-label {
text-overflow:clip;
}
-.special-cell-label-dots {
+.special-cell-label-dots .special-cell-label {
text-overflow:ellipsis;
}
-.special-cell-label-none {
+.special-cell-label-none .special-cell-label {
visibility:hidden;
}
-.special-cell-label-short {
+.special-cell-label-short .special-cell-label {
display:inline;
}
diff --git a/public/trivabble.js b/public/trivabble.js
index 7ce7c1c..6c843b7 100644
--- a/public/trivabble.js
+++ b/public/trivabble.js
@@ -2317,14 +2317,14 @@
setSetting("CellCaptions", mode);
document.getElementById("cell-captions").value = mode;
+ board.classList.remove("special-cell-label-clip");
+ board.classList.remove("special-cell-label-dots");
+ board.classList.remove("special-cell-label-none");
+ board.classList.remove("special-cell-label-short");
+
+ board.classList.add("special-cell-label-" + mode);
+
for (const cells of [].slice.call(document.getElementsByClassName("special-cell-label"))) {
- cells.classList.remove("special-cell-label-clip");
- cells.classList.remove("special-cell-label-dots");
- cells.classList.remove("special-cell-label-none");
- cells.classList.remove("special-cell-label-short");
-
- cells.classList.add("special-cell-label-" + mode);
-
cells.textContent = (mode === "short") ? cells.shortText : cells.longText;
}
}
From ae79bb84b899e340c57649dec5ae66cb69dc8e33 Mon Sep 17 00:00:00 2001
From: Laurent Mazet
Date: Fri, 15 Jan 2021 18:36:36 +0100
Subject: [PATCH 06/23] Limit changes on cell text content
---
public/trivabble.js | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/public/trivabble.js b/public/trivabble.js
index 6c843b7..0733578 100644
--- a/public/trivabble.js
+++ b/public/trivabble.js
@@ -2317,16 +2317,28 @@
setSetting("CellCaptions", mode);
document.getElementById("cell-captions").value = mode;
- board.classList.remove("special-cell-label-clip");
- board.classList.remove("special-cell-label-dots");
- board.classList.remove("special-cell-label-none");
- board.classList.remove("special-cell-label-short");
+ if (board.classList.contains("special-cell-label-short")) {
+ board.classList.remove("special-cell-label-short");
+
+ if (mode !== "short") {
+ for (const cell of [].slice.call(document.getElementsByClassName("special-cell-label"))) {
+ cell.textContent = cell.longText;
+ }
+ }
+
+ } else {
+ board.classList.remove("special-cell-label-clip");
+ board.classList.remove("special-cell-label-dots");
+ board.classList.remove("special-cell-label-none");
+
+ if (mode === "short") {
+ for (const cell of [].slice.call(document.getElementsByClassName("special-cell-label"))) {
+ cell.textContent = cell.shortText;
+ }
+ }
+ }
board.classList.add("special-cell-label-" + mode);
-
- for (const cells of [].slice.call(document.getElementsByClassName("special-cell-label"))) {
- cells.textContent = (mode === "short") ? cells.shortText : cells.longText;
- }
}
function repromptName(f) {
From 3a148fbbd1daa41afa5a781f786ce0ffb0ea9f0d Mon Sep 17 00:00:00 2001
From: Laurent Mazet
Date: Fri, 15 Jan 2021 18:39:29 +0100
Subject: [PATCH 07/23] fix central star
---
public/trivabble.js | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/public/trivabble.js b/public/trivabble.js
index 0733578..69bf197 100644
--- a/public/trivabble.js
+++ b/public/trivabble.js
@@ -2322,7 +2322,9 @@
if (mode !== "short") {
for (const cell of [].slice.call(document.getElementsByClassName("special-cell-label"))) {
- cell.textContent = cell.longText;
+ if (cell.textContent !== "★") {
+ cell.textContent = cell.longText;
+ }
}
}
@@ -2333,7 +2335,9 @@
if (mode === "short") {
for (const cell of [].slice.call(document.getElementsByClassName("special-cell-label"))) {
- cell.textContent = cell.shortText;
+ if (cell.textContent !== "★") {
+ cell.textContent = cell.shortText;
+ }
}
}
}
From b010c4c43e55094a3fe1cb33450836535bd6d2c5 Mon Sep 17 00:00:00 2001
From: Laurent Mazet
Date: Tue, 20 Apr 2021 08:31:22 +0200
Subject: [PATCH 08/23] clean default configuration
---
public/config.js.sample | 45 ++++++++++++++++++++++++-----------------
public/trivabble.js | 5 +++--
2 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/public/config.js.sample b/public/config.js.sample
index 23912ea..9fb2e12 100644
--- a/public/config.js.sample
+++ b/public/config.js.sample
@@ -3,49 +3,58 @@
window.TrivabbleConf = {
// The amount of time to wait after a connection failure
- POLLING_DELAY: 2000,
+ //POLLING_DELAY: 2000,
// Whether WebSockets should be used, if possible
- ENABLE_WEBSOCKETS: true,
+ //ENABLE_WEBSOCKETS: true,
// Whether Server Sent Events should be used, if available
- ENABLE_EVENT_SOURCE: true,
+ //ENABLE_EVENT_SOURCE: true,
// Max consecutive tries before blacklisting WebSockets for the current session
- MAX_WEBSOCKET_ERRORS: 1,
+ //MAX_WEBSOCKET_ERRORS: 1,
// To tweak only if your webserver is shared with other conflicting resources at / (e.g. Yunohost integration)
- APP_PATH: "",
+ //APP_PATH: "",
// The API entry point. Default value: APP_PATH + '/:trivabble'
- API_ENTRY_POINT: "/:trivabble",
+ //API_ENTRY_POINT: "/:trivabble",
- // The color of the flash light when double clicking on a cell
- FLASH_LIGHT_COLOR: "#EE6633",
+ // Wether sounds should be played when receiving messages
+ //ENABLE_MSG_SOUND: true,
- // The list of durations of the flash light available in the settings box
- FLASH_LIGHT_DURATIONS: [800, 1600, 3200],
+ // Wether sounds should be played when moving tiles
+ //ENABLE_TILE_SOUND: true,
- // The defaut flash light duration. If not set, the value at the middle of the previous array is used.
- FLASH_LIGHT_DURATION: 1600,
+ // Spell checker activation
+ //ENABLE_SPELL_CHECKER: false,
// The list of durations used to detect a double tap available in the settings box
- DOUBLE_TAP_DURATIONS: [650, 1100, 1800, 3000, 5000],
+ //DOUBLE_TAP_DURATIONS: [650, 1100, 1800, 3000, 5000],
// The defaut double tap duration. If not set, the value at the middle of the previous array is used.
- DOUBLE_TAP_DURATION: 1800,
+ //DOUBLE_TAP_DURATION: 1800,
+
+ // The color of the flash light when double clicking on a cell
+ //FLASH_LIGHT_COLOR: "#EE6633",
+
+ // The list of durations of the flash light available in the settings box
+ //FLASH_LIGHT_DURATIONS: [800, 1600, 3200],
+
+ // The defaut flash light duration. If not set, the value at the middle of the previous array is used.
+ //FLASH_LIGHT_DURATION: 1600,
// The default premium for playing seven tiles on a turn
- PREMIUM_SEVEN_TILES: 50,
+ //PREMIUM_SEVEN_TILES: 50,
// Score is automically affected to last player. If false, score is automatically affected to the player who pressed the Score button
- SCORE_LAST_PLAYER: true,
+ //SCORE_LAST_PLAYER: true,
// Timer activation
- ENABLE_TIMER: false,
+ //ENABLE_TIMER: false,
// Cell captions. Could be "clip", "dots", "none" or "short"
- CELL_CAPTIONS: "dots",
+ //CELL_CAPTIONS: "dots",
// I don't like trailing commas, here is a nice message for you reading this file :-)
HAVE_FUN: true
diff --git a/public/trivabble.js b/public/trivabble.js
index 69bf197..a3d38c9 100644
--- a/public/trivabble.js
+++ b/public/trivabble.js
@@ -52,14 +52,15 @@
setConf("ENABLE_EVENT_SOURCE", true);
setConf("MAX_WEBSOCKET_ERRORS", 1);
setConf("APP_PATH", "");
+ setConf("API_ENTRY_POINT", Conf.APP_PATH + "/:trivabble");
setConf("ENABLE_MSG_SOUND", true);
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_COLOR", "#ee6633");
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", false);
From 3384a8c1f7af9998bbf69f7c8bb44370bcafe05a Mon Sep 17 00:00:00 2001
From: Laurent Mazet
Date: Tue, 20 Apr 2021 08:43:27 +0200
Subject: [PATCH 09/23] remove direct call to Conf structure
---
public/trivabble.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/public/trivabble.js b/public/trivabble.js
index a3d38c9..2057c09 100644
--- a/public/trivabble.js
+++ b/public/trivabble.js
@@ -1383,7 +1383,7 @@
webSocket = new WebSocket(
(window.location.protocol === "http:" ? "ws://" : "wss://") +
window.location.host +
- Conf.API_ENTRY_POINT + "/ws/" +
+ getSetting("API_ENTRY_POINT") + "/ws/" +
JSON.stringify(cmdsWithContext())
);
@@ -1397,7 +1397,7 @@
function xhrRequest(data, onreadystatechange) {
const xhr = new XMLHttpRequest();
- xhr.open("POST", Conf.API_ENTRY_POINT, true);
+ xhr.open("POST", getSetting("API_ENTRY_POINT"), true);
xhr.setRequestHeader("Content-Type", "text/plain");
xhr.send(JSON.stringify(data));
From 9c2408c56034d74295b512f64cc65bee121762a6 Mon Sep 17 00:00:00 2001
From: Laurent Mazet
Date: Tue, 20 Apr 2021 14:13:58 +0200
Subject: [PATCH 10/23] only store values that differ from defaults
---
public/trivabble.js | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/public/trivabble.js b/public/trivabble.js
index 2057c09..65b8580 100644
--- a/public/trivabble.js
+++ b/public/trivabble.js
@@ -138,7 +138,13 @@
(type === "number") ||
(type === "object") ||
(type === "string")) {
- localStorage.setItem("trivabble" + key, value);
+ if (Object.prototype.hasOwnProperty.call(Conf, key) && (Conf[key] === value)) {
+ if (Object.prototype.hasOwnProperty.call(localStorage, "trivabble" + key)) {
+ delete localStorage["trivabble" + key];
+ }
+ } else {
+ localStorage.setItem("trivabble" + key, value);
+ }
} else {
console.error("Unsupported type");
}
From c118fd652e78982641461b56c0e5b14a36beea6d Mon Sep 17 00:00:00 2001
From: Laurent Mazet
Date: Tue, 20 Apr 2021 21:57:50 +0200
Subject: [PATCH 11/23] remove CellCaptions key
---
public/trivabble.js | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/public/trivabble.js b/public/trivabble.js
index 65b8580..d8afb67 100644
--- a/public/trivabble.js
+++ b/public/trivabble.js
@@ -164,7 +164,6 @@
TimerEnable: "boolean",
TimerGameDate: "number",
TimerTurnDate: "number",
- CellCaptions: "string"
};
const _ = (window.libD && libD.l10n) ? libD.l10n() : function (s) {
@@ -2317,11 +2316,11 @@
setCellCaptions(document.getElementById("cell-captions").value);
};
- setCellCaptions(getSetting("CellCaptions", getSetting("CELL_CAPTIONS")));
+ setCellCaptions(getSetting("CELL_CAPTIONS"));
}
function setCellCaptions(mode) {
- setSetting("CellCaptions", mode);
+ setSetting("CELL_CAPTIONS", mode);
document.getElementById("cell-captions").value = mode;
if (board.classList.contains("special-cell-label-short")) {
From 291005d150254d2149649f5677d0931056cef485 Mon Sep 17 00:00:00 2001
From: Laurent Mazet
Date: Tue, 20 Apr 2021 21:59:33 +0200
Subject: [PATCH 12/23] remove TimerEnable key
---
public/trivabble.js | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/public/trivabble.js b/public/trivabble.js
index d8afb67..98c0058 100644
--- a/public/trivabble.js
+++ b/public/trivabble.js
@@ -161,7 +161,6 @@
Lang: "string",
PlayerName: "string",
Timer: "number",
- TimerEnable: "boolean",
TimerGameDate: "number",
TimerTurnDate: "number",
};
@@ -2281,7 +2280,7 @@
setTimerState(document.getElementById("enable-timer").checked);
};
- setTimerState(getSetting("TimerEnable", getSetting("ENABLE_TIMER")));
+ setTimerState(getSetting("ENABLE_TIMER"));
}
let timerTimeout = 0
@@ -2293,7 +2292,7 @@
}
function setTimerState(enabled) {
- setSetting("TimerEnable", enabled);
+ setSetting("ENABLE_TIMER", enabled);
if (timerTimeout) {
clearInterval(timerTimeout);
timerTimeout = 0
From 01f622854af60f94896188aca3a205221ae8b9a5 Mon Sep 17 00:00:00 2001
From: Laurent Mazet
Date: Tue, 20 Apr 2021 22:04:10 +0200
Subject: [PATCH 13/23] remove unused config ENABLE_SPELL_CHECKER
---
public/config.js.sample | 3 ---
public/trivabble.js | 1 -
2 files changed, 4 deletions(-)
diff --git a/public/config.js.sample b/public/config.js.sample
index 9fb2e12..601e503 100644
--- a/public/config.js.sample
+++ b/public/config.js.sample
@@ -26,9 +26,6 @@ window.TrivabbleConf = {
// Wether sounds should be played when moving tiles
//ENABLE_TILE_SOUND: true,
- // Spell checker activation
- //ENABLE_SPELL_CHECKER: false,
-
// The list of durations used to detect a double tap available in the settings box
//DOUBLE_TAP_DURATIONS: [650, 1100, 1800, 3000, 5000],
diff --git a/public/trivabble.js b/public/trivabble.js
index 98c0058..f05655b 100644
--- a/public/trivabble.js
+++ b/public/trivabble.js
@@ -55,7 +55,6 @@
setConf("API_ENTRY_POINT", Conf.APP_PATH + "/:trivabble");
setConf("ENABLE_MSG_SOUND", true);
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_COLOR", "#ee6633");
From afba7b12c42411509d89aa9ddc644aa23294533e Mon Sep 17 00:00:00 2001
From: Laurent Mazet
Date: Tue, 20 Apr 2021 22:06:24 +0200
Subject: [PATCH 14/23] reorder SettingTypes and remove unused Timer
---
public/trivabble.js | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/public/trivabble.js b/public/trivabble.js
index f05655b..b191b50 100644
--- a/public/trivabble.js
+++ b/public/trivabble.js
@@ -153,13 +153,12 @@
}
const SettingsTypes = {
- SpellCheckerEnabledOnce: "boolean",
+ BoardLang: "string",
DisableSpellChecker: "boolean",
GameNumber: "number",
- BoardLang: "string",
Lang: "string",
PlayerName: "string",
- Timer: "number",
+ SpellCheckerEnabledOnce: "boolean",
TimerGameDate: "number",
TimerTurnDate: "number",
};
From 8f674f384816aee8aa985b5f0b81db899837ed1a Mon Sep 17 00:00:00 2001
From: Laurent Mazet
Date: Tue, 20 Apr 2021 22:13:09 +0200
Subject: [PATCH 15/23] fix eslint errors
---
public/trivabble.js | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/public/trivabble.js b/public/trivabble.js
index b191b50..2aec370 100644
--- a/public/trivabble.js
+++ b/public/trivabble.js
@@ -103,7 +103,7 @@
} else {
console.error("Unsupported type");
}
- } else if (defaultValue !== undefined) {
+ } else if (typeof defaultValue !== "undefined") {
return defaultValue;
}
@@ -160,7 +160,7 @@
PlayerName: "string",
SpellCheckerEnabledOnce: "boolean",
TimerGameDate: "number",
- TimerTurnDate: "number",
+ TimerTurnDate: "number"
};
const _ = (window.libD && libD.l10n) ? libD.l10n() : function (s) {
@@ -170,7 +170,10 @@
const trivabble = window.trivabble = {l10n: _};
function format(s, v1, v2, v3) {
- return s.replace("{0}", v1).replace("{1}", v2).replace("{2}", v3);
+ return s
+ .replace("{0}", v1)
+ .replace("{1}", v2)
+ .replace("{2}", v3);
}
let board;
@@ -2281,7 +2284,7 @@
setTimerState(getSetting("ENABLE_TIMER"));
}
- let timerTimeout = 0
+ let timerTimeout = 0;
function updateTimer() {
const currentTimer = timerDate();
@@ -2293,7 +2296,7 @@
setSetting("ENABLE_TIMER", enabled);
if (timerTimeout) {
clearInterval(timerTimeout);
- timerTimeout = 0
+ timerTimeout = 0;
}
if (enabled) {
From 2af43c8ad8aef0ddacb82cf9b92e4bb545627065 Mon Sep 17 00:00:00 2001
From: Laurent Mazet
Date: Wed, 21 Apr 2021 10:44:38 +0200
Subject: [PATCH 16/23] Revert "fix eslint errors"
This reverts commit 8f674f384816aee8aa985b5f0b81db899837ed1a.
---
public/trivabble.js | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/public/trivabble.js b/public/trivabble.js
index 2aec370..b191b50 100644
--- a/public/trivabble.js
+++ b/public/trivabble.js
@@ -103,7 +103,7 @@
} else {
console.error("Unsupported type");
}
- } else if (typeof defaultValue !== "undefined") {
+ } else if (defaultValue !== undefined) {
return defaultValue;
}
@@ -160,7 +160,7 @@
PlayerName: "string",
SpellCheckerEnabledOnce: "boolean",
TimerGameDate: "number",
- TimerTurnDate: "number"
+ TimerTurnDate: "number",
};
const _ = (window.libD && libD.l10n) ? libD.l10n() : function (s) {
@@ -170,10 +170,7 @@
const trivabble = window.trivabble = {l10n: _};
function format(s, v1, v2, v3) {
- return s
- .replace("{0}", v1)
- .replace("{1}", v2)
- .replace("{2}", v3);
+ return s.replace("{0}", v1).replace("{1}", v2).replace("{2}", v3);
}
let board;
@@ -2284,7 +2281,7 @@
setTimerState(getSetting("ENABLE_TIMER"));
}
- let timerTimeout = 0;
+ let timerTimeout = 0
function updateTimer() {
const currentTimer = timerDate();
@@ -2296,7 +2293,7 @@
setSetting("ENABLE_TIMER", enabled);
if (timerTimeout) {
clearInterval(timerTimeout);
- timerTimeout = 0;
+ timerTimeout = 0
}
if (enabled) {
From 657ac8c175ec92103718ef73ad0c77808a88d7a1 Mon Sep 17 00:00:00 2001
From: Laurent Mazet
Date: Wed, 21 Apr 2021 10:46:19 +0200
Subject: [PATCH 17/23] fix eslint error
---
public/trivabble.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/trivabble.js b/public/trivabble.js
index 545e303..2aec370 100644
--- a/public/trivabble.js
+++ b/public/trivabble.js
@@ -160,7 +160,7 @@
PlayerName: "string",
SpellCheckerEnabledOnce: "boolean",
TimerGameDate: "number",
- TimerTurnDate: "number",
+ TimerTurnDate: "number"
};
const _ = (window.libD && libD.l10n) ? libD.l10n() : function (s) {
From 8c5c06e543ad110de0a57897edf940376a3104da Mon Sep 17 00:00:00 2001
From: Laurent Mazet
Date: Wed, 21 Apr 2021 11:33:18 +0200
Subject: [PATCH 18/23] translations
---
l10n/po/fr/trivabble.po | 16 ++++++++++++++++
l10n/pot/trivabble.pot | 15 +++++++++++++++
public/index.html | 8 ++++----
3 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/l10n/po/fr/trivabble.po b/l10n/po/fr/trivabble.po
index 5e4bded..e71a3cd 100644
--- a/l10n/po/fr/trivabble.po
+++ b/l10n/po/fr/trivabble.po
@@ -261,3 +261,19 @@ msgstr "Chronométrer la partie"
msgid "To measure playing time, activate the timer."
msgstr "Pour mesurer les temps de jeu, activez le chronomètre."
+
+msgid "Cell captions:"
+msgstr "Légendes des cellules"
+
+msgid "Clip when overflow"
+msgstr "Raccouricies en cas de débordement"
+
+msgid "Dots when overflow"
+msgstr "Pointillés en cas de débordement"
+
+msgid "No caption"
+msgstr "Pas de légende"
+
+msgid "Short caption"
+msgstr "Légendes courtes"
+
diff --git a/l10n/pot/trivabble.pot b/l10n/pot/trivabble.pot
index 89eb0b8..8a36787 100644
--- a/l10n/pot/trivabble.pot
+++ b/l10n/pot/trivabble.pot
@@ -266,3 +266,18 @@ msgstr ""
msgid "To measure playing time, activate the timer."
msgstr ""
+
+msgid "Cell captions:"
+msgstr ""
+
+msgid "Clip when overflow"
+msgstr ""
+
+msgid "Dots when overflow"
+msgstr ""
+
+msgid "No caption"
+msgstr ""
+
+msgid "Short caption"
+msgstr ""
diff --git a/public/index.html b/public/index.html
index b4c1896..cc32bb9 100644
--- a/public/index.html
+++ b/public/index.html
@@ -106,10 +106,10 @@
From 36876cf697c1b7073ed9328cfa12cf2cddfaeae0 Mon Sep 17 00:00:00 2001
From: Laurent Mazet
Date: Wed, 21 Apr 2021 19:31:43 +0000
Subject: [PATCH 19/23] Apply 1 suggestion(s) to 1 file(s)
---
l10n/po/fr/trivabble.po | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/l10n/po/fr/trivabble.po b/l10n/po/fr/trivabble.po
index e71a3cd..bf7e569 100644
--- a/l10n/po/fr/trivabble.po
+++ b/l10n/po/fr/trivabble.po
@@ -266,7 +266,7 @@ msgid "Cell captions:"
msgstr "Légendes des cellules"
msgid "Clip when overflow"
-msgstr "Raccouricies en cas de débordement"
+msgstr "Raccourcies en cas de débordement"
msgid "Dots when overflow"
msgstr "Pointillés en cas de débordement"
From e6f4d09c9a5cfa7ae185e1ff1b787d0b33557ff3 Mon Sep 17 00:00:00 2001
From: Laurent Mazet
Date: Wed, 21 Apr 2021 19:31:53 +0000
Subject: [PATCH 20/23] Apply 1 suggestion(s) to 1 file(s)
---
l10n/po/fr/trivabble.po | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/l10n/po/fr/trivabble.po b/l10n/po/fr/trivabble.po
index bf7e569..4c8af5f 100644
--- a/l10n/po/fr/trivabble.po
+++ b/l10n/po/fr/trivabble.po
@@ -263,7 +263,7 @@ msgid "To measure playing time, activate the timer."
msgstr "Pour mesurer les temps de jeu, activez le chronomètre."
msgid "Cell captions:"
-msgstr "Légendes des cellules"
+msgstr "Légendes des cellules :"
msgid "Clip when overflow"
msgstr "Raccourcies en cas de débordement"
From bccce721d35090871d88c9e62dc509e74da10d78 Mon Sep 17 00:00:00 2001
From: Laurent Mazet
Date: Sat, 24 Apr 2021 13:50:13 +0200
Subject: [PATCH 21/23] fix issue
---
public/trivabble.js | 32 +++++++++-----------------------
1 file changed, 9 insertions(+), 23 deletions(-)
diff --git a/public/trivabble.js b/public/trivabble.js
index 2aec370..ff0791b 100644
--- a/public/trivabble.js
+++ b/public/trivabble.js
@@ -2312,39 +2312,25 @@
}
function initCellCaptions() {
+ setCellCaptions(getSetting("CELL_CAPTIONS"));
+
document.getElementById("cell-captions").onclick = function () {
setCellCaptions(document.getElementById("cell-captions").value);
};
-
- setCellCaptions(getSetting("CELL_CAPTIONS"));
}
function setCellCaptions(mode) {
setSetting("CELL_CAPTIONS", mode);
document.getElementById("cell-captions").value = mode;
- if (board.classList.contains("special-cell-label-short")) {
- board.classList.remove("special-cell-label-short");
+ board.classList.remove("special-cell-label-short");
+ board.classList.remove("special-cell-label-clip");
+ board.classList.remove("special-cell-label-dots");
+ board.classList.remove("special-cell-label-none");
- if (mode !== "short") {
- for (const cell of [].slice.call(document.getElementsByClassName("special-cell-label"))) {
- if (cell.textContent !== "★") {
- cell.textContent = cell.longText;
- }
- }
- }
-
- } else {
- board.classList.remove("special-cell-label-clip");
- board.classList.remove("special-cell-label-dots");
- board.classList.remove("special-cell-label-none");
-
- if (mode === "short") {
- for (const cell of [].slice.call(document.getElementsByClassName("special-cell-label"))) {
- if (cell.textContent !== "★") {
- cell.textContent = cell.shortText;
- }
- }
+ for (const cell of [].slice.call(document.getElementsByClassName("special-cell-label"))) {
+ if (cell.textContent !== "★") {
+ cell.textContent = (mode === "short") ? cell.shortText : cell.longText;
}
}
From b6682f2b19bababc9431a2ccdbc65df2b189b403 Mon Sep 17 00:00:00 2001
From: Laurent Mazet
Date: Sat, 24 Apr 2021 20:54:24 +0200
Subject: [PATCH 22/23] fix issue when PlayerName is empty
---
public/trivabble.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/public/trivabble.js b/public/trivabble.js
index ff0791b..b485aae 100644
--- a/public/trivabble.js
+++ b/public/trivabble.js
@@ -2454,6 +2454,7 @@
setSetting("PlayerName", name);
}
repromptName(initGame);
+ setCellCaptions(getSetting("CELL_CAPTIONS"));
}
);
From 516f66e0b3dcbb37e7895ed5d6b30d221db97a54 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Jakse?=
Date: Sat, 24 Apr 2021 21:29:15 +0200
Subject: [PATCH 23/23] Don't set cell caption setting on load
---
public/trivabble.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/public/trivabble.js b/public/trivabble.js
index b485aae..5dff925 100644
--- a/public/trivabble.js
+++ b/public/trivabble.js
@@ -2314,13 +2314,13 @@
function initCellCaptions() {
setCellCaptions(getSetting("CELL_CAPTIONS"));
- document.getElementById("cell-captions").onclick = function () {
+ document.getElementById("cell-captions").onchange = function () {
setCellCaptions(document.getElementById("cell-captions").value);
+ setSetting("CELL_CAPTIONS", mode);
};
}
function setCellCaptions(mode) {
- setSetting("CELL_CAPTIONS", mode);
document.getElementById("cell-captions").value = mode;
board.classList.remove("special-cell-label-short");