diff options
Diffstat (limited to 'html')
-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() |