- commit
- 5ccb981a5de301e9ff252119242a46853e295687
- parent
- eea1c73081cf10a3c1df65b06ba5e7536bc60f01
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2020-12-17 21:00
show img in more places
Diffstat
| M | drawful.js | 8 | ++++---- |
| M | index.html | 1 | + |
2 files changed, 5 insertions, 4 deletions
diff --git a/drawful.js b/drawful.js
@@ -75,8 +75,9 @@ document.querySelector('#scores').addEventListener('submit', function(event) {
75 75
76 76 document.querySelector('#draw-host').addEventListener('submit', function(event) {
77 77 event.preventDefault();
78 -1 state.img = canvas.toDataURL();
79 -1 send('setImage', state.img);
-1 78 var img = canvas.toDataURL();
-1 79 document.querySelectorAll('img').forEach(el => el.src = img);
-1 80 send('setImage', img);
80 81 html.setView('lie-host');
81 82 });
82 83
@@ -141,8 +142,7 @@ evtSource.onmessage = function(event) {
141 142 }
142 143 } else if (sender === state.host) {
143 144 if (cmd === 'setImage') {
144 -1 document.querySelector('#lie img').src = arg;
145 -1 document.querySelector('#pick img').src = arg;
-1 145 document.querySelectorAll('img').forEach(el => el.src = arg);
146 146 html.setView('lie');
147 147 } else if (cmd === 'setOptions') {
148 148 html.updateOptionList('#pick ul', arg);
diff --git a/index.html b/index.html
@@ -52,6 +52,7 @@ 52 52 </form> 53 53 54 54 <form id="pick-host" hidden> -1 55 <img/> 55 56 <p>Waiting for players to pick their answers.</p> 56 57 <ul id="options-host"></ul> 57 58 <ul id="pick-done"></ul>