vnc.html, ui.js: move all Javascript to ui.js.
Move all the inline Javascript event handlers from vnc.html to include/ui.js except the load handler which is moved to include/start.js). This is on the path towards a Chrome extension/packaged app since inline Javascript is prohibited in that situation.
This commit is contained in:
parent
ee1af44161
commit
26945049be
|
@ -0,0 +1 @@
|
|||
window.onload = UI.load;
|
|
@ -118,11 +118,44 @@ start: function(callback) {
|
|||
UI.toggleConnectPanel();
|
||||
}
|
||||
|
||||
// Add mouse event click/focus/blur event handlers to the UI
|
||||
UI.addMouseHandlers();
|
||||
|
||||
if (typeof callback === "function") {
|
||||
callback(UI.rfb);
|
||||
}
|
||||
},
|
||||
|
||||
addMouseHandlers: function() {
|
||||
// Setup interface handlers that can't be inline
|
||||
$D("noVNC_view_drag_button").onclick = UI.setViewDrag;
|
||||
$D("noVNC_mouse_button0").onclick = function () { UI.setMouseButton(1); };
|
||||
$D("noVNC_mouse_button1").onclick = function () { UI.setMouseButton(2); };
|
||||
$D("noVNC_mouse_button2").onclick = function () { UI.setMouseButton(4); };
|
||||
$D("noVNC_mouse_button4").onclick = function () { UI.setMouseButton(0); };
|
||||
$D("showKeyboard").onclick = UI.showKeyboard;
|
||||
//$D("keyboardinput").onkeydown = function (event) { onKeyDown(event); };
|
||||
$D("keyboardinput").onblur = UI.keyInputBlur;
|
||||
|
||||
$D("sendCtrlAltDelButton").onclick = UI.sendCtrlAltDel;
|
||||
$D("clipboardButton").onclick = UI.toggleClipboardPanel;
|
||||
$D("settingsButton").onclick = UI.toggleSettingsPanel;
|
||||
$D("connectButton").onclick = UI.toggleConnectPanel;
|
||||
$D("disconnectButton").onclick = UI.disconnect;
|
||||
$D("descriptionButton").onclick = UI.toggleConnectPanel;
|
||||
|
||||
$D("noVNC_clipboard_text").onfocus = UI.displayBlur;
|
||||
$D("noVNC_clipboard_text").onblur = UI.displayFocus;
|
||||
$D("noVNC_clipboard_text").onchange = UI.clipSend;
|
||||
$D("noVNC_clipboard_clear_button").onclick = UI.clipClear;
|
||||
|
||||
$D("noVNC_settings_menu").onmouseover = UI.displayBlur;
|
||||
$D("noVNC_settings_menu").onmouseover = UI.displayFocus;
|
||||
$D("noVNC_apply").onclick = UI.settingsApply;
|
||||
|
||||
$D("noVNC_connect_button").onclick = UI.connect;
|
||||
},
|
||||
|
||||
// Read form control compatible setting from cookie
|
||||
getSetting: function(name) {
|
||||
var val, ctrl = $D('noVNC_' + name);
|
||||
|
|
60
vnc.html
60
vnc.html
|
@ -41,38 +41,34 @@
|
|||
|
||||
<script src="include/vnc.js"></script>
|
||||
<script src="include/ui.js"></script>
|
||||
<script src="include/start.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="noVNC-control-bar">
|
||||
<div id="noVNC-menu-bar" style="display:none;">
|
||||
</div>
|
||||
<!--noVNC Mobile Device only Buttons-->
|
||||
<div class="noVNC-buttons-left">
|
||||
<input type="image" src="images/drag.png"
|
||||
id="noVNC_view_drag_button" class="noVNC_status_button"
|
||||
title="Move/Drag Viewport"
|
||||
onclick="UI.setViewDrag();">
|
||||
title="Move/Drag Viewport">
|
||||
<div id="noVNC_mobile_buttons">
|
||||
<input type="image" src="images/mouse_none.png"
|
||||
id="noVNC_mouse_button0" class="noVNC_status_button"
|
||||
onclick="UI.setMouseButton(1);">
|
||||
id="noVNC_mouse_button0" class="noVNC_status_button">
|
||||
<input type="image" src="images/mouse_left.png"
|
||||
id="noVNC_mouse_button1" class="noVNC_status_button"
|
||||
onclick="UI.setMouseButton(2);">
|
||||
id="noVNC_mouse_button1" class="noVNC_status_button">
|
||||
<input type="image" src="images/mouse_middle.png"
|
||||
id="noVNC_mouse_button2" class="noVNC_status_button"
|
||||
onclick="UI.setMouseButton(4);">
|
||||
id="noVNC_mouse_button2" class="noVNC_status_button">
|
||||
<input type="image" src="images/mouse_right.png"
|
||||
id="noVNC_mouse_button4" class="noVNC_status_button"
|
||||
onclick="UI.setMouseButton(0);">
|
||||
id="noVNC_mouse_button4" class="noVNC_status_button">
|
||||
<input type="image" src="images/keyboard.png"
|
||||
id="showKeyboard" class="noVNC_status_button"
|
||||
value="Keyboard" title="Show Keyboard"
|
||||
onclick="UI.showKeyboard()"/>
|
||||
value="Keyboard" title="Show Keyboard"/>
|
||||
<input type="email"
|
||||
autocapitalize="off" autocorrect="off"
|
||||
id="keyboardinput" class="noVNC_status_button"
|
||||
onKeyDown="onKeyDown(event);" onblur="UI.keyInputBlur();"/>
|
||||
id="keyboardinput" class="noVNC_status_button"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -80,24 +76,19 @@
|
|||
<div class="noVNC-buttons-right">
|
||||
<input type="image" src="images/ctrlaltdel.png"
|
||||
id="sendCtrlAltDelButton" class="noVNC_status_button"
|
||||
title="Send Ctrl-Alt-Del"
|
||||
onclick="UI.sendCtrlAltDel();" />
|
||||
title="Send Ctrl-Alt-Del" />
|
||||
<input type="image" src="images/clipboard.png"
|
||||
id="clipboardButton" class="noVNC_status_button"
|
||||
title="Clipboard"
|
||||
onclick="UI.toggleClipboardPanel();" />
|
||||
title="Clipboard" />
|
||||
<input type="image" src="images/settings.png"
|
||||
id="settingsButton" class="noVNC_status_button"
|
||||
title="Settings"
|
||||
onclick="UI.toggleSettingsPanel();" />
|
||||
title="Settings" />
|
||||
<input type="image" src="images/connect.png"
|
||||
id="connectButton" class="noVNC_status_button"
|
||||
title="Connect"
|
||||
onclick="UI.toggleConnectPanel()" />
|
||||
title="Connect" />
|
||||
<input type="image" src="images/disconnect.png"
|
||||
id="disconnectButton" class="noVNC_status_button"
|
||||
title="Disconnect"
|
||||
onclick="UI.disconnect()" />
|
||||
title="Disconnect" />
|
||||
</div>
|
||||
|
||||
<!-- Description Panel -->
|
||||
|
@ -113,25 +104,21 @@
|
|||
and <a href="http://kanaka.github.com/noVNC">website</a>
|
||||
for more information.
|
||||
<br />
|
||||
<input type="button" value="Close"
|
||||
onclick="UI.toggleConnectPanel();">
|
||||
<input id="descriptionButton" type="button" value="Close">
|
||||
</div>
|
||||
|
||||
<!-- Clipboard Panel -->
|
||||
<div id="noVNC_clipboard" class="triangle-right top">
|
||||
<textarea id="noVNC_clipboard_text" rows=5
|
||||
onfocus="UI.displayBlur();" onblur="UI.displayFocus();"
|
||||
onchange="UI.clipSend();">
|
||||
<textarea id="noVNC_clipboard_text" rows=5>
|
||||
</textarea>
|
||||
<br />
|
||||
<input id="noVNC_clipboard_clear_button" type="button"
|
||||
value="Clear" onclick="UI.clipClear();">
|
||||
value="Clear">
|
||||
</div>
|
||||
|
||||
<!-- Settings Panel -->
|
||||
<div id="noVNC_settings" class="triangle-right top">
|
||||
<span id="noVNC_settings_menu" onmouseover="UI.displayBlur();"
|
||||
onmouseout="UI.displayFocus();">
|
||||
<span id="noVNC_settings_menu">
|
||||
<ul>
|
||||
<li><input id="noVNC_encrypt" type="checkbox"> Encrypt</li>
|
||||
<li><input id="noVNC_true_color" type="checkbox" checked> True Color</li>
|
||||
|
@ -156,8 +143,7 @@
|
|||
</select></label>
|
||||
</li>
|
||||
<hr>
|
||||
<li><input type="button" id="noVNC_apply" value="Apply"
|
||||
onclick="UI.settingsApply()"></li>
|
||||
<li><input type="button" id="noVNC_apply" value="Apply"></li>
|
||||
</ul>
|
||||
</span>
|
||||
</div>
|
||||
|
@ -168,7 +154,7 @@
|
|||
<li><label><strong>Host: </strong><input id="noVNC_host" /></label></li>
|
||||
<li><label><strong>Port: </strong><input id="noVNC_port" /></label></li>
|
||||
<li><label><strong>Password: </strong><input id="noVNC_password" type="password" /></label></li>
|
||||
<li><input id="noVNC_connect_button" type="button" value="Connect" onclick="UI.connect();"></li>
|
||||
<li><input id="noVNC_connect_button" type="button" value="Connect"></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
@ -192,9 +178,5 @@
|
|||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.onload = UI.load;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue