<tr><th data-l10n="text-content">Participant</th><th data-l10n="text-content">Rack</th><th data-l10n="text-content">Score</th><th data-l10n="text-content">Turn</th></tr>
<tr id="participants-placeholder"><td colspan="4" data-l10n="text-content">Waiting for other participants…</td></tr>
</table>
- <p id="help-scores" data-l10n="text-content">Click on someone's score to change it.</p>
- <p id="help-turn" data-l10n="text-content">Who's turn? Click on the Turn button!</p>
- <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="score-words" class="minibutton" data-l10n="text-content">Score new words</button>
- <p id="info-spell-checking" style="display:none;"><span data-l0n="text-content">Spell checking is based on:</span> <a rel="noopener noreferrer" target="_blank" href="http://aspell.net">Aspell</a></p>
+ <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" hidden="true">Check spelling for new words</button>
++ <button id="score-words" class="minibutton" data-l10n="text-content">Score 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" 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" 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 triggerLaser(cell) {
+ function getRowIndex(tr) {
+ // tr.rowIndex is -1 on WebKit-based browsers in Debian Jessie, hence this function
+ return [].indexOf.call(tr.parentNode.rows, tr);
+ }
+
+ function scoreWords() {
+ let totalScore = 0;
+
+ const newWords = searchNewWords();
+ for (const k of Object.keys(newWords)) {
+ let wordFactor = 1;
+ let wordScore = 0;
+
+ const word = newWords[k];
+ for (let l = 0; l < word.letters.length; l++) {
+ const index = ((word.row + (l * word.incRow)) * 15) + word.col + (l * word.incCol);
+
+ /* Letter score */
+ const tilePlaceholder = boardCells[index].getElementsByClassName("tile-placeholder")[0];
+ const tile = tilePlaceholder.getElementsByClassName("tile")[0];
+ const letterScore = tile.lastChild.textContent;
+ let letterFactor = 1;
+
+ /* Is a freshly played letter? */
+ if (currentTilePlayed[index] === word.letters[l]) {
+
+ /* Letter factor */
+ if (boardCells[index].classList.contains("special-cell-doubleLetter")) {
+ letterFactor = 2;
+ } else if (boardCells[index].classList.contains("special-cell-tripleLetter")) {
+ letterFactor = 3;
+ }
+
+ /* Word factor */
+ if (boardCells[index].classList.contains("special-cell-doubleWord")) {
+ wordFactor *= 2;
+ } else if (boardCells[index].classList.contains("special-cell-tripleWord")) {
+ wordFactor *= 3;
+ }
+
+ }
+
+ wordScore += letterScore * letterFactor;
+ }
+
+ totalScore += wordScore * wordFactor;
+ }
+
+ /* Check for trivabble */
+ if (Object.keys(currentTilePlayed).length === 7) {
+ totalScore += 50;
+ }
+
+ /* Confirm score */
+ myConfirm(
+ _("Do you want to add score to active player?") + " " + totalScore,
+ function () {
+ const scoreCell = tablePlayers[currentPlayer].childNodes[2].childNodes[0];
+ sendCmds([{
+ cmd: "score",
+ player: currentPlayer,
+ score: parseInt(scoreCell.textContent) + totalScore
+ }]);
+ }
+ );
+ }
+
+ function triggerFlashLight(cell) {
if (!cell) {
return;
}
document.getElementById("clear-rack").onclick = clearRack;
document.getElementById("show-rack").onclick = showRack;
document.getElementById("check-spelling").onclick = checkSpellingClicked;
- document.getElementById("score-words").onclick = scoreWords;
- helpClear.onclick = clearGame;
-
document.getElementById("btn-settings").onclick = showSettings;
- document.getElementById("btn-settings-close").onclick = showSettings;
+ document.getElementById("btn-settings-close").onclick = hideSettings;
+ document.getElementById("next-help-msg").onclick = nextHelpMessage;
+ document.getElementById("disable-spell-checker").onclick = toggleSpellChecker;
++ document.getElementById("score-words").onclick = scoreWords;
+ window.addEventListener("keydown", function (e) {
+ if (e.key === "Escape") {
+ document.querySelector(".modal").classList.remove("show-modal");
+ }
+ });
}
function initGame() {