Merge branch 'lmazet/trivabble-help_message' into develop

This commit is contained in:
Raphaël Jakse 2020-10-03 10:07:43 +02:00
commit 26b2c9d206
7 changed files with 156 additions and 35 deletions

View File

@ -164,8 +164,8 @@ msgstr "Son ar c'hemennadenoù"
msgid "Number of tiles in the bag:"
msgstr "Niver a bezhioù er sac'h:"
msgid "Click on it to take one."
msgstr "Klikit warnañ evit kemer unan"
msgid "Click on the bag to take onei tile."
msgstr ""
msgid "Put back all the tiles in the bag"
msgstr "Adlakaat an holl pezhioù er sac'h"

View File

@ -85,8 +85,8 @@ msgstr "Bruit des messages"
msgid "Number of tiles in the bag:"
msgstr "Nombre de pièces dans le sac :"
msgid "Click on it to take one."
msgstr "Cliquez dessus pour en prendre une."
msgid "Click on the bag to take one tile."
msgstr "Cliquez sur le sac pour prendre une pièce."
msgid "Put back all the tiles in the bag"
msgstr "Ranger toutes les pièces dans le sac"
@ -136,6 +136,12 @@ msgstr "Tour"
msgid "Who's turn? Click on the Turn button!"
msgstr "À qui le tour ? Cliquez sur le bouton Tour !"
msgid "Click on (+) to increase someone's score."
msgstr "Cliquez sur (+) pour augmenter le score de quelquun."
msgid "Show a cell to everyone by double-clicking on it."
msgstr "Montrez une case à tout le monde en double-cliquant dessus."
msgid "Show my rack to other players"
msgstr "Montrer mon jeu aux autres"
@ -216,3 +222,9 @@ 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"

View File

@ -156,8 +156,8 @@ msgstr "Sunet de la mesaje"
msgid "Number of tiles in the bag:"
msgstr "Număr de jetoane în sac:"
msgid "Click on it to take one."
msgstr "Apasă pe el ca să iei unul."
msgid "Click on the bag to take one tile."
msgstr ""
msgid "Put back all the tiles in the bag"
msgstr "Pune toate jetoanele înapoi în sac"

View File

@ -87,7 +87,7 @@ msgstr ""
msgid "Number of tiles in the bag:"
msgstr ""
msgid "Click on it to take one."
msgid "Click on the bag to take one tile."
msgstr ""
msgid "Put back all the tiles in the bag"
@ -221,3 +221,15 @@ 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 ""

View File

@ -73,17 +73,30 @@
<div id="panel">
<button id="btn-settings" data-l10n="text-content">Settings</button>
<div id="bag"></div>
<p><span data-l10n="text-content">Number of tiles in the bag:</span><br /><span id="remaining-letters">102</span><br /><span id="help-bag" data-l10n="text-content">Click on it to take one.</span><a href="#" id="help-clear" style="display:none"></a></p>
<p><span data-l10n="text-content">Number of tiles in the bag:</span><br /><span id="remaining-letters">102</span></p>
<table id="participants">
<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&#10;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&#10;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>
<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&#10;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>
</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&#10;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>
</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>
</div>
</body>
</html>

View File

@ -47,7 +47,7 @@ html, #board, [draggable], .tile {
color: green;
}
#clear-game, #help-scores, #clear-rack, #help-turn {
#clear-game, #clear-rack {
white-space:pre-wrap;
}
@ -57,7 +57,7 @@ html, #board, [draggable], .tile {
-webkit-user-drag: element;
}
#help-clear, #help-bag, #help-scores, #help-turn {
#help-message {
font-size:small
}
@ -141,7 +141,7 @@ body {
display:-webkit-flex;
display:flex;
-webkit-flex-direction:column;
flex-direction:column
flex-direction:column;
}
button {
@ -335,8 +335,8 @@ td.blink {
#panel {
-webkit-justify-content:center;
justify-content:center;
text-align:center
justify-content:space-between;
text-align:center;
}
#bag, #rack-outer {
@ -369,7 +369,6 @@ td.blink {
height:160px;
background:url(bag.svg) no-repeat;
background-size:100% 100%;
flex:1;
}
#bag:hover {
@ -562,3 +561,80 @@ td.blink {
#info-spell-checking a {
color:black;
}
#help-messages {
box-sizing:border-box;
overflow:auto;
width: auto;
margin-bottom:1px;
}
#help-box {
margin-left:1ex;
margin-top:1ex;
align-items:center;
display:flex;
flex-direction:column;
justify-content:center;
}
#help-box-inner {
display:flex;
flex-direction:row;
min-height:2em;
border-top:1px solid gray;
border-bottom:1px solid gray;
align-items:center;
}
#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;
}
#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;
}
#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:flex;
flex-direction:column;
}

View File

@ -179,8 +179,6 @@
let audioChat;
let chatMessages;
let chatTextarea;
let helpBag;
let helpClear;
let tablePlayers = {};
let participantPlaceholder;
@ -1163,13 +1161,6 @@
if (typeof data.remainingLetters === "number") {
remainingLetters = data.remainingLetters;
document.getElementById("remaining-letters").textContent = data.remainingLetters;
if (data.remainingLetters === 0) {
helpBag.style.display = "none";
helpClear.style.display = "";
} else {
helpBag.style.display = "";
helpClear.style.display = "none";
}
}
if (data.rack) {
@ -2016,11 +2007,11 @@
if (x < 0) {
return null;
}
if (x < values.length) {
return values[Math.floor(x)];
}
for (let i = 0; i < values.length; i++) {
if (x <= values[i]) {
return i;
@ -2084,6 +2075,25 @@
}
}
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].style.display = "none";
}
nextHelpMessage.index++;
if (nextHelpMessage.index === listOfMessages.length) {
nextHelpMessage.index = 0;
}
listOfMessages[nextHelpMessage.index].style.display = "";
}
}
function repromptName(f) {
if (getSetting("trivabblePlayerName") && getSetting("trivabblePlayerName").trim()) {
f();
@ -2162,8 +2172,6 @@
bag = document.getElementById("bag");
chatMessages = document.getElementById("chat-messages");
chatTextarea = document.getElementById("chat-ta");
helpBag = document.getElementById("help-bag");
helpClear = document.getElementById("help-clear");
participantPlaceholder = document.getElementById("participants-placeholder");
}
@ -2177,10 +2185,9 @@
document.getElementById("clear-rack").onclick = clearRack;
document.getElementById("show-rack").onclick = showRack;
document.getElementById("check-spelling").onclick = checkSpellingClicked;
helpClear.onclick = clearGame;
document.getElementById("btn-settings").onclick = showSettings;
document.getElementById("btn-settings-close").onclick = showSettings;
document.getElementById("next-help-msg").onclick = nextHelpMessage;
}
function initGame() {
@ -2305,6 +2312,7 @@
initSound();
initSpellChecker();
initLaserPointer();
nextHelpMessage();
};
trivabble.l10nError = trivabble.run;