<option value="ro">Română</option>
</select>
</p>
- <p id="board-lang-selection" style="display:none">
+ <p id="board-lang-selection" hidden="true">
<label for="board-lang" data-l10n="text-content">Board language: </label>
<select id="board-lang">
<option value="fr">French</option>
<div id="prefs">
<p><label><input type="checkbox" id="tiles-sound" /><span data-l10n="text-content">Sound of the tiles</span></label></p>
<p><label><input type="checkbox" id="msg-sound" /><span data-l10n="text-content">Sound of messages</span></label></p>
- <p id="enable-spell-checker-outer" style="display:none"><label><input type="checkbox" id="enable-spell-checker" /> <span data-l10n="text-content">Enable spell checker</span></label></p>
+ <p id="enable-spell-checker-outer" hidden="true"><label><input type="checkbox" id="enable-spell-checker" /> <span data-l10n="text-content">Enable spell checker</span></label></p>
<p><label><span data-l10n="text-content">(fast)</span><input type="range" min="0" max="0" id="double-tap-duration"/><span data-l10n="text-content">(slow)</span><br/><span data-l10n="text-content">Double tap duration</span></label></p>
<p><label><span data-l10n="text-content">(fast)</span><input type="range" min="0" max="0" id="flash-light-duration"/><span data-l10n="text-content">(slow)</span><br/><span data-l10n="text-content">Flash light duration</span></label></p>
- <p><label><input type="color" size="6" id="flash-light-color" /> <span data-l10n="text-content">Flash light color</span></label></p>
+ <p id="flash-light-color-p"><label><input type="color" size="6" id="flash-light-color" /> <span data-l10n="text-content">Flash light color</span></label></p>
</div>
</div>
</div>
<div id="panel-buttons">
<button id="clear-rack" class="minibutton" data-l10n="text-content">Put back all the tiles of your rack in the bag</button>
<button id="show-rack" class="minibutton" data-l10n="text-content">Show my rack to other players</button>
- <button id="check-spelling" class="minibutton" data-l10n="text-content" style="display:none">Check spelling for new words</button>
+ <button id="check-spelling" class="minibutton" data-l10n="text-content" hidden="true">Check spelling for new words</button>
</div>
<div id="help-box">
<p id="help-box-title" data-l10n="text-content">Tip!</p>
<div id="help-box-inner">
<div id="help-messages">
- <p data-l10n="text-content" style="display:none">Click on the bag to take one tile.</p>
- <p data-l10n="text-content" style="display:none">Click on someone's score to change it.</p>
- <p data-l10n="text-content" style="display:none">Who's turn? Click on the Turn button!</p>
- <p data-l10n="text-content" style="display:none">Click on (+) to increase someone's score.</p>
- <p data-l10n="text-content" style="display:none">Show a cell to everyone by double-clicking on it.</p>
+ <p data-l10n="text-content" hidden="true">Click on the bag to take one tile.</p>
+ <p data-l10n="text-content" hidden="true">Click on someone's score to change it.</p>
+ <p data-l10n="text-content" hidden="true">Who's turn? Click on the Turn button!</p>
+ <p data-l10n="text-content" hidden="true">Click on (+) to increase someone's score.</p>
+ <p data-l10n="text-content" hidden="true">Show a cell to everyone by double-clicking on it.</p>
</div>
<button id="next-help-msg" class="minibutton" data-l10n="title" title="Next tip">→</button>
</div>
</div>
- <p id="info-spell-checking" style="display:none;"><span data-l10n="text-content">Spell checking is based on:</span> <a rel="noopener noreferrer" target="_blank" href="http://aspell.net">Aspell</a></p>
+ <p id="info-spell-checking" hidden="true"><span data-l10n="text-content">Spell checking is based on:</span> <a rel="noopener noreferrer" target="_blank" href="http://aspell.net">Aspell</a></p>
</div>
</body>
</html>
}
function touchStartTilePreventDefault(e) {
- laserTouch(e);
+ flashLightTouch(e);
return preventDefault(e);
}
}
}
- function triggerLaser(cell) {
+ function triggerFlashLight(cell) {
if (!cell) {
return;
}
return null;
}
- function laserDblClick(e) {
- triggerLaser(getCellFromEvent(e));
+ function flashLightDblClick(e) {
+ triggerFlashLight(getCellFromEvent(e));
}
- function laserTouch(e) {
+ function flashLightTouch(e) {
const cell = getCellFromEvent(e);
if (!cell) {
return;
}
- if ((laserTouch.last !== cell) || (Date.now() - laserTouch.date > getSetting("DOUBLE_TAP_DURATION"))) {
- laserTouch.last = cell;
- laserTouch.date = Date.now();
+ if ((flashLightTouch.last !== cell) || (Date.now() - flashLightTouch.date > getSetting("DOUBLE_TAP_DURATION"))) {
+ flashLightTouch.last = cell;
+ flashLightTouch.date = Date.now();
return;
}
- triggerLaser(cell);
+ triggerFlashLight(cell);
}
function localHighlightCell(id) {
const placeholder = boardCells[id].getElementsByClassName("tile-placeholder")[0];
- placeholder.classList.add("laser-highlighting");
- placeholder.classList.add("laser-highlight");
+ placeholder.classList.add("flash-light-highlighting");
+ placeholder.classList.add("flash-light-highlight");
const sixthFlashLightDuration = getSetting("FLASH_LIGHT_DURATION") / 6;
function on() {
- placeholder.classList.add("laser-highlight");
+ placeholder.classList.add("flash-light-highlight");
}
function off() {
- placeholder.classList.remove("laser-highlight");
+ placeholder.classList.remove("flash-light-highlight");
}
setTimeout(off, sixthFlashLightDuration);
setTimeout(
function () {
- placeholder.classList.remove("laser-highlighting");
+ placeholder.classList.remove("flash-light-highlighting");
},
sixthFlashLightDuration * 6
);
function initSpellChecker() {
if (getSetting("ENABLE_SPELL_CHECKER")) {
- document.getElementById("enable-spell-checker-outer").style.display = "";
+ document.getElementById("enable-spell-checker-outer").hidden = false;
}
document.getElementById("enable-spell-checker").onclick = spellCheckerSettingChecked;
if (!getSetting("ENABLE_SPELL_CHECKER") || !getSetting("spellCheckerEnabled")) {
- document.getElementById("check-spelling").style.display = "none";
+ document.getElementById("check-spelling").hidden = true;
document.getElementById("enable-spell-checker").checked = false;
- document.getElementById("info-spell-checking").style.display = "none";
+ document.getElementById("info-spell-checking").hidden = true;
} else {
- document.getElementById("check-spelling").style.display = "";
- document.getElementById("info-spell-checking").style.display = "";
+ document.getElementById("check-spelling").hidden = false;
+ document.getElementById("info-spell-checking").hidden = false;
document.getElementById("enable-spell-checker").checked = true;
}
}
return values.length - 1;
}
- function initLaserPointer() {
- document.body.addEventListener("dblclick", laserDblClick);
- document.body.addEventListener("touchstart", laserTouch);
+ function initFlashLight() {
+ document.body.addEventListener("dblclick", flashLightDblClick);
+ document.body.addEventListener("touchstart", flashLightTouch);
const doubleTapDuration = document.getElementById("double-tap-duration");
if (doubleTapDuration) {
};
}
+ if (!document.documentElement.style.setProperty && document.getElementById("flash-light-color-p")) {
+ document.getElementById("flash-light-color-p").hidden = true;
+ return;
+ }
+
const flashLightColor = document.getElementById("flash-light-color");
if (flashLightColor) {
- console.log(getSetting("FLASH_LIGHT_COLOR"));
flashLightColor.value = getSetting("FLASH_LIGHT_COLOR");
flashLightColor.onchange = function () {
- setSetting("FLASH_LIGHT_COLOR", document.getElementById("flash-light-color").value);
- const style = document.createElement("style");
- style.textContent = ".laser-highlight {background-color: " + getSetting("FLASH_LIGHT_COLOR") + ";}";
- document.body.appendChild(style);
+ const color = document.getElementById("flash-light-color").value;
+ setSetting("FLASH_LIGHT_COLOR", color);
+ document.documentElement.style.setProperty("--flash-light-color", color);
};
flashLightColor.onchange();
}
if (helpMessages) {
const listOfMessages = helpMessages.getElementsByTagName("p");
if ((nextHelpMessage.index >= 0) && (nextHelpMessage.index < listOfMessages.length)) {
- listOfMessages[nextHelpMessage.index].style.display = "none";
+ listOfMessages[nextHelpMessage.index].hidden = true;
}
nextHelpMessage.index++;
if (nextHelpMessage.index === listOfMessages.length) {
nextHelpMessage.index = 0;
}
- listOfMessages[nextHelpMessage.index].style.display = "";
+ listOfMessages[nextHelpMessage.index].hidden = false;
}
}
if (!boardLangSelect) {
const boardLangSelection = document.getElementById("board-lang-selection");
boardLangSelect = boardLangSelection.querySelector("select");
- boardLangSelection.style.display = "";
+ boardLangSelection.hidden = false;
}
boardLangSelect.textContent = "";
initGame();
initSound();
initSpellChecker();
- initLaserPointer();
+ initFlashLight();
nextHelpMessage();
};