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