made copy paste better?

This commit is contained in:
Richard Klafter 2016-07-18 17:48:18 -07:00
parent 0542fcd450
commit 5615c57290
1 changed files with 40 additions and 21 deletions

View File

@ -38,10 +38,6 @@
<!-- Stylesheets --> <!-- Stylesheets -->
<link rel="stylesheet" href="include/base.css" title="plain"> <link rel="stylesheet" href="include/base.css" title="plain">
<!--
<script type='text/javascript'
src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
-->
<script src="include/util.js"></script> <script src="include/util.js"></script>
</head> </head>
@ -53,8 +49,8 @@
Loading Loading
</div></td> </div></td>
<td width="1%"><div id="noVNC_buttons"> <td width="1%"><div id="noVNC_buttons">
<input type=button value="Send CtrlAltDel" <!--<input type=button value="Send CtrlAltDel"
id="sendCtrlAltDelButton"> id="sendCtrlAltDelButton">-->
<span id="noVNC_xvp_buttons"> <span id="noVNC_xvp_buttons">
<!-- <!--
<input type=button value="Shutdown" <input type=button value="Shutdown"
@ -68,10 +64,19 @@
</div></td> </div></td>
</tr></table> </tr></table>
</div> </div>
<canvas id="noVNC_canvas" width="640px" height="20px"> <div>
<div id="vnc-input" tabindex="-1" style="display:inline-block; float:left; margin:10px;">
<canvas id="noVNC_canvas" width="640px" height="20px" style="position:inherit;">
Canvas not supported. Canvas not supported.
</canvas> </canvas>
</div> </div>
<div style="width:20%; display:inline-block; float:left; margin:10px;">
<h3 style="color:white; margin:10px;">Remote Clipboard</h3>
<textarea id="copyBox" style="height:752px;width:98%;overflow:scroll;"></textarea>
</div>
</div>
</div>
<script> <script>
/*jslint white: false */ /*jslint white: false */
@ -135,7 +140,7 @@
var s, sb, cad, level; var s, sb, cad, level;
s = $D('noVNC_status'); s = $D('noVNC_status');
sb = $D('noVNC_status_bar'); sb = $D('noVNC_status_bar');
cad = $D('sendCtrlAltDelButton'); //cad = $D('sendCtrlAltDelButton');
switch (state) { switch (state) {
case 'failed': level = "error"; break; case 'failed': level = "error"; break;
case 'fatal': level = "error"; break; case 'fatal': level = "error"; break;
@ -146,9 +151,9 @@
} }
if (state === "normal") { if (state === "normal") {
cad.disabled = false; //cad.disabled = false;
} else { } else {
cad.disabled = true; //cad.disabled = true;
xvpInit(0); xvpInit(0);
} }
@ -178,14 +183,26 @@
} }
} }
function onClipboard(rfb, text){
$D('copyBox').value = text
}
window.onscriptsload = function () { window.onscriptsload = function () {
var host, port, password, path, token; var host, port, password, path, token;
$D('sendCtrlAltDelButton').style.display = "inline"; //$D('sendCtrlAltDelButton').style.display = "inline";
$D('sendCtrlAltDelButton').onclick = sendCtrlAltDel; //$D('sendCtrlAltDelButton').onclick = sendCtrlAltDel;
$D('xvpShutdownButton').onclick = xvpShutdown; //$D('xvpShutdownButton').onclick = xvpShutdown;
$D('xvpRebootButton').onclick = xvpReboot; //$D('xvpRebootButton').onclick = xvpReboot;
$D('xvpResetButton').onclick = xvpReset; //$D('xvpResetButton').onclick = xvpReset;
$D('noVNC_canvas').addEventListener('click',function(){
$D('vnc-input').focus();
});
function updateClipboard(){
rfb.clipboardPasteFrom($D('copyBox').value);
}
$D('copyBox').addEventListener('change', updateClipboard);
$D('copyBox').addEventListener('paste', updateClipboard);
WebUtil.init_logging(WebUtil.getConfigVar('logging', 'warn')); WebUtil.init_logging(WebUtil.getConfigVar('logging', 'warn'));
document.title = unescape(WebUtil.getConfigVar('title', 'noVNC')); document.title = unescape(WebUtil.getConfigVar('title', 'noVNC'));
@ -225,8 +242,8 @@
try { try {
rfb = new RFB({'target': $D('noVNC_canvas'), rfb = new RFB({'target': $D('noVNC_canvas'),
'encrypt': WebUtil.getConfigVar('encrypt', 'focusContainer': $D("vnc-input"),
(window.location.protocol === "https:")), 'encrypt': WebUtil.getConfigVar('encrypt',(window.location.protocol === "https:")),
'repeaterID': WebUtil.getConfigVar('repeaterID', ''), 'repeaterID': WebUtil.getConfigVar('repeaterID', ''),
'true_color': WebUtil.getConfigVar('true_color', false), 'true_color': WebUtil.getConfigVar('true_color', false),
'local_cursor': WebUtil.getConfigVar('cursor', true), 'local_cursor': WebUtil.getConfigVar('cursor', true),
@ -235,7 +252,9 @@
'onUpdateState': updateState, 'onUpdateState': updateState,
'onXvpInit': xvpInit, 'onXvpInit': xvpInit,
'onPasswordRequired': passwordRequired, 'onPasswordRequired': passwordRequired,
'onFBUComplete': FBUComplete}); 'onFBUComplete': FBUComplete,
'onClipboard': onClipboard
});
} catch (exc) { } catch (exc) {
updateState(null, 'fatal', null, 'Unable to create RFB client -- ' + exc); updateState(null, 'fatal', null, 'Unable to create RFB client -- ' + exc);
return; // don't continue trying to connect return; // don't continue trying to connect