diff options
author | Roland Reichwein <mail@reichwein.it> | 2023-08-06 13:11:41 +0200 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2023-08-06 13:11:41 +0200 |
commit | e9b1b6899e588cb563953eab07bc6baf2eb7bcaa (patch) | |
tree | 3cd013a0e39310993d27a3b086e6c403fb409e5e | |
parent | c30637794dccbd890a6d0b9f290ffece97f5fad5 (diff) |
Hide QR code on second click
-rw-r--r-- | html/whiteboard.js | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/html/whiteboard.js b/html/whiteboard.js index 379c757..50b0058 100644 --- a/html/whiteboard.js +++ b/html/whiteboard.js @@ -214,7 +214,7 @@ function init_board() { //board.addEventListener("selectionchange", function() {on_selectionchange(); }); document.getElementById("qrwindow").onclick = function() { - hideQRWindow(); + hideQRWindow(); } document.onkeydown = function(evt) { @@ -328,20 +328,24 @@ function textAreaSetPos(id, pos) // HTML button function on_qrcode_click() { - var parser = new DOMParser(); - var xmlDocument = parser.parseFromString("<request></request>", "text/xml"); - - var requestElement = xmlDocument.getElementsByTagName("request")[0]; + if (document.getElementById("qrwindow").style.display == "block") { + hideQRWindow(); + } else { + var parser = new DOMParser(); + var xmlDocument = parser.parseFromString("<request></request>", "text/xml"); - var commandElement = xmlDocument.createElement("command"); - commandElement.appendChild(document.createTextNode("qrcode")); - requestElement.appendChild(commandElement); + var requestElement = xmlDocument.getElementsByTagName("request")[0]; - var idElement = xmlDocument.createElement("url"); - idElement.appendChild(document.createTextNode(document.location)); - requestElement.appendChild(idElement); + var commandElement = xmlDocument.createElement("command"); + commandElement.appendChild(document.createTextNode("qrcode")); + requestElement.appendChild(commandElement); - websocket.send(new XMLSerializer().serializeToString(xmlDocument)); + var idElement = xmlDocument.createElement("url"); + idElement.appendChild(document.createTextNode(document.location)); + requestElement.appendChild(idElement); + + websocket.send(new XMLSerializer().serializeToString(xmlDocument)); + } } function on_pdf_click() |