auxMsg is working
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmRfEwoACgkQO3+8IhRO Y5iVTQ//TuJTj2v0y7dS5/ChBEswtAf5Mt43nZh+kAQAB5/M9siqgfPYD33/ZtZT dd7nX1x6TilEQFL/ZaXMMi9UQWQS+QYrqJ89D423tpy/H/HRDbbCr5kLD/7NqMJ3 ouIjaTLTFSuXu2+H8mRCbxTAwyGUyL0YXJWWqW/aqyODIdEu6vXcFKsKIlTu9fEX aHhQg0r7Tfxzi5h6ARW5qP9/uTGJngCr1O+tKAkPwGUDzClHRfz4VOCi15HQp5aT A0ZYKtj1+fZ07p1rgD/GMMaKYxX047+QyISmSqd1+ZAATulGuslGm1E/iJsBUxoO XLil7neG6BzF2JV+qPIRfkL1gGp6+89y5aaMzbjYAGh42WrvdRzCxMcrfxjIv0yC v/YiauquJ08tlTCkbgzvGRnOok/rNeP+fkG0dKve4lny9r6n8iGguUipnBlNBuDC Gc5WiBIPMEhBF0UoFSzcRBFY9hPYm+AfD1Pp00aFcaaPz3muf419CJzoTs9mcSl+ gp4l4rFEF0sWGiIXYYGosRo1qkJupMHLR6+JOKeIU/Ml9rxoO77qKIKlEc71RkTA eFSq92/t9YXWIsZ5s1TiCJU7sdkW7iCBuCzrzn/5vyd5QE9DlGZML4GMV4VjfOeW 4Nte+xvSSMJ5F5PuzraA/giv6d9geY2JIHyxgazypUnAMzOvhLI= =pJph -----END PGP SIGNATURE-----
5 files changed,
36 insertions(+),
18 deletions(-)
M
gametable/server.go
→
gametable/server.go
@@ -232,10 +232,10 @@ return err
} } if tableMsg.AuxMsg != nil { - err := self.dbAdapter.SetAuxMessage(key, *tableMsg.AuxMsg) - if err != nil { - return err - } + err := self.dbAdapter.SetAuxMessage(key, *tableMsg.AuxMsg) + if err != nil { + return err + } } } }
M
models/models.go
→
models/models.go
@@ -17,23 +17,22 @@ Note string `json:"note"`
Timestamp time.Time `json:"timestamp"` } - type Token struct { Id string `json:"id"` Name string `json:"name"` SpriteUri string `json:"spriteUrl"` - X *int `json:"x"` - Y *int `json:"y"` + X *int `json:"x"` + Y *int `json:"y"` } 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 {
M
static/index.html
→
static/index.html
@@ -57,9 +57,10 @@ <option>20</option>
</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;"> + <div id="adminWrapper" style="display:none;"> <div id="adminCtrl"> <button onclick="setTableCreateFormVisible(true)">New Table</button> <form onsubmit="return false" id="createTableForm" style="display:none;">
M
static/socket.js
→
static/socket.js
@@ -39,13 +39,26 @@ }
} } +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 @@ })
table = data; makeUpToDate(table); } else { - if (data.diceRoll) { - logDice(data.diceRoll); - } - if (data.mapImageUrl) { - setMapImg(data.mapImageUrl); - } + makeUpToDate(data); } + console.log(data); }); }
M
static/style.css
→
static/style.css
@@ -77,4 +77,13 @@ }
#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; }