auxMsg is working

This commit is contained in:
Iris Lightshard 2023-05-12 22:33:14 -06:00
parent 42bb254d84
commit 7ad9d76f78
Signed by: nilix
GPG key ID: 3B7FBC22144E6398
5 changed files with 36 additions and 18 deletions

View file

@ -17,7 +17,6 @@ type DiceRoll struct {
Timestamp time.Time `json:"timestamp"`
}
type Token struct {
Id string `json:"id"`
Name string `json:"name"`
@ -29,11 +28,11 @@ type Token struct {
type Table struct {
Name string `json:"name"`
Passcode string `json:"passcode"`
MapImageUrl string `json:"mapImageUrl"`
MapImageUrl string `json:"mapImg"`
DiceRolls []DiceRoll `json:"diceRolls"`
Tokens []Token `json:"tokens"`
AvailableTokens []Token `json:"availableTokens"`
AuxMessage string `json:"auxMessage"`
AuxMessage string `json:"auxMsg"`
}
type TableMessage struct {

View file

@ -57,6 +57,7 @@
</select>
<input id="dice_note"><button id="dice_submit" onclick="rollDice()">Roll</button>
<div id="dice_log"></div>
<div id="aux"></div>
<div id="map"></div>
</main>
<div id="adminWrapper" style="display:none;">

View file

@ -39,13 +39,26 @@ function logDice(dice, many) {
}
}
function setAuxMsg(msg) {
const auxDiv = document.getElementById("aux");
if (auxDiv) {
console.log("eeee");
auxDiv.innerText = msg;
}
}
function makeUpToDate(table) {
if (table) {
if (table.diceRolls) {
logDice(table.diceRolls, true);
} else if (table.diceRoll) {
logDice(table.diceRoll, false);
}
if (table.mapImageUrl) {
setMapImg(table.mapImageUrl);
if (table.mapImg) {
setMapImg(table.mapImg);
}
if (table.auxMsg) {
setAuxMsg(table.auxMsg);
}
}
}
@ -101,13 +114,9 @@ function dial() {
table = data;
makeUpToDate(table);
} else {
if (data.diceRoll) {
logDice(data.diceRoll);
}
if (data.mapImageUrl) {
setMapImg(data.mapImageUrl);
}
makeUpToDate(data);
}
console.log(data);
});
}

View file

@ -78,3 +78,12 @@ button:hover {
#dice_log p:not(:last-child) {
border-bottom: solid 1px gray;
}
#aux {
display: block;
background: #fff;
color: #000;
height: auto;
width: auto;
border: solid 1px dimgray;
}