Add download screenshot button
This commit is contained in:
parent
65bd696326
commit
7090db605b
14
app/ui.js
14
app/ui.js
|
|
@ -766,12 +766,21 @@ const UI = {
|
|||
});
|
||||
},
|
||||
|
||||
attachDownloadScreenshotButton() {
|
||||
document.getElementById('noVNC_download_screenshot').addEventListener('click', function() {
|
||||
let link = document.createElement('a');
|
||||
link.download = 'screenshot.png';
|
||||
link.href = UI.rfb.canvas.toDataURL("image/png");
|
||||
link.click();
|
||||
});
|
||||
},
|
||||
|
||||
updateInteractionStackUI() {
|
||||
document.getElementById('noVNC_click_stack').innerHTML = "";
|
||||
document.getElementById('noVNC_click_stack').innerHTML = '';
|
||||
for (var i = 0; i < UI.canvasInteractionEvents.length; i++) {
|
||||
let e = UI.canvasInteractionEvents[i];
|
||||
let el = document.createElement('li');
|
||||
el.innerText = e.name + " at (" + e.x + ", " + e.y + ")";
|
||||
el.innerText = e.name + ' at (' + e.x + ', ' + e.y + ')';
|
||||
document.getElementById('noVNC_click_stack').append(el);
|
||||
}
|
||||
},
|
||||
|
|
@ -1108,6 +1117,7 @@ const UI = {
|
|||
|
||||
UI.trackMouse();
|
||||
UI.trackClicks();
|
||||
UI.attachDownloadScreenshotButton();
|
||||
|
||||
UI.updateViewOnly(); // requires UI.rfb
|
||||
},
|
||||
|
|
|
|||
6
vnc.html
6
vnc.html
|
|
@ -16,7 +16,7 @@
|
|||
<title>noVNC</title>
|
||||
|
||||
<meta charset="utf-8">
|
||||
|
||||
|
||||
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
|
||||
Remove this if you use the .htaccess -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
|
|
@ -338,6 +338,10 @@
|
|||
(0, 0)
|
||||
</div>
|
||||
</div>
|
||||
<div class="noVNC_info_item">
|
||||
<span class="noVNC_info_item_label">Screenshot</span>
|
||||
<button id="noVNC_download_screenshot">Download screenshot</button>
|
||||
</div>
|
||||
<div class="noVNC_info_item">
|
||||
<span class="noVNC_info_item_label">Interaction stack</span>
|
||||
<button id="noVNC_click_stack_copy">Copy stack to clipboard</button>
|
||||
|
|
|
|||
Loading…
Reference in New Issue