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) ||
Timer: "number",
TimerEnable: "boolean",
TimerGameDate: "number",
- TimerTurnDate: "number"
+ TimerTurnDate: "number",
+ CellCaptions: "string"
};
const _ = (window.libD && libD.l10n) ? libD.l10n() : function (s) {
}
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";
}
}
}
+ 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();
initFlashLight();
nextHelpMessage();
initTimer();
+ initCellCaptions();
};
trivabble.l10nError = trivabble.run;