Skip to content
This repository
Browse code

Add message panel when hosted at kanaka.github.com.

Add a helpful popup/panel message for when noVNC is used at
kanaka.github.com (e.g. where novnc.com redirects).
  • Loading branch information...
commit 0ce93900ae738bedb75ad01cbdbd592e1e47fff8 1 parent 9e6e666
Joel Martin authored

Showing 3 changed files with 55 additions and 2 deletions. Show diff stats Hide diff stats

  1. +18 0 include/base.css
  2. +19 1 include/ui.js
  3. +18 1 vnc.html
18 include/base.css
@@ -153,6 +153,7 @@ html {
153 153 }
154 154
155 155 #noVNC_controls {
  156 + display:none;
156 157 margin-top:77px;
157 158 right:12px;
158 159 position:fixed;
@@ -161,6 +162,23 @@ html {
161 162 right:15px;
162 163 }
163 164
  165 +#noVNC_description {
  166 + display:none;
  167 + position:fixed;
  168 +
  169 + margin-top:77px;
  170 + right:20px;
  171 + left:20px;
  172 + padding:15px;
  173 + color:#000;
  174 + background:#eee; /* default background for browsers without gradient support */
  175 +
  176 + border:2px solid #E0E0E0;
  177 + -webkit-border-radius:10px;
  178 + -moz-border-radius:10px;
  179 + border-radius:10px;
  180 +}
  181 +
164 182 #noVNC_clipboard {
165 183 display:none;
166 184 margin-top:77px;
20 include/ui.js
@@ -14,7 +14,7 @@ var UI = {
14 14
15 15 rfb_state : 'loaded',
16 16 settingsOpen : false,
17   -connSettingsOpen : true,
  17 +connSettingsOpen : false,
18 18 clipboardOpen: false,
19 19 keyboardVisible: false,
20 20
@@ -102,6 +102,14 @@ load: function() {
102 102 }
103 103 } );
104 104
  105 + // Show description by default when hosted at for kanaka.github.com
  106 + if (location.host === "kanaka.github.com") {
  107 + // Open the description dialog
  108 + $D('noVNC_description').style.display = "block";
  109 + } else {
  110 + // Open the connect panel on first load
  111 + UI.toggleConnectPanel();
  112 + }
105 113 },
106 114
107 115 // Read form control compatible setting from cookie
@@ -189,6 +197,8 @@ forceSetting: function(name, val) {
189 197
190 198 // Show the clipboard panel
191 199 toggleClipboardPanel: function() {
  200 + // Close the description panel
  201 + $D('noVNC_description').style.display = "none";
192 202 //Close settings if open
193 203 if (UI.settingsOpen === true) {
194 204 UI.settingsApply();
@@ -212,6 +222,8 @@ toggleClipboardPanel: function() {
212 222
213 223 // Show the connection settings panel/menu
214 224 toggleConnectPanel: function() {
  225 + // Close the description panel
  226 + $D('noVNC_description').style.display = "none";
215 227 //Close connection settings if open
216 228 if (UI.settingsOpen === true) {
217 229 UI.settingsApply();
@@ -239,6 +251,8 @@ toggleConnectPanel: function() {
239 251 // On open, settings are refreshed from saved cookies.
240 252 // On close, settings are applied
241 253 toggleSettingsPanel: function() {
  254 + // Close the description panel
  255 + $D('noVNC_description').style.display = "none";
242 256 if (UI.settingsOpen) {
243 257 UI.settingsApply();
244 258 UI.closeSettingsMenu();
@@ -265,6 +279,8 @@ toggleSettingsPanel: function() {
265 279
266 280 // Open menu
267 281 openSettingsMenu: function() {
  282 + // Close the description panel
  283 + $D('noVNC_description').style.display = "none";
268 284 if (UI.clipboardOpen === true) {
269 285 UI.toggleClipboardPanel();
270 286 }
@@ -415,10 +431,12 @@ updateVisualState: function() {
415 431 if (connected) {
416 432 UI.setViewClip();
417 433 UI.setMouseButton(1);
  434 + $D('clipboardButton').style.display = "inline";
418 435 $D('showKeyboard').style.display = "inline";
419 436 $D('sendCtrlAltDelButton').style.display = "inline";
420 437 } else {
421 438 UI.setMouseButton();
  439 + $D('clipboardButton').style.display = "none";
422 440 $D('showKeyboard').style.display = "none";
423 441 $D('sendCtrlAltDelButton').style.display = "none";
424 442 }
19 vnc.html
@@ -90,7 +90,7 @@
90 90 title="Settings"
91 91 onclick="UI.toggleSettingsPanel();" />
92 92 <input type="image" src="images/connect.png"
93   - id="connectButton" class="noVNC_status_button_selected"
  93 + id="connectButton" class="noVNC_status_button"
94 94 title="Connect"
95 95 onclick="UI.toggleConnectPanel()" />
96 96 <input type="image" src="images/disconnect.png"
@@ -99,6 +99,23 @@
99 99 onclick="UI.disconnect()" />
100 100 </div>
101 101
  102 + <!-- Description Panel -->
  103 + <!-- Shown by default when hosted at for kanaka.github.com -->
  104 + <div id="noVNC_description" style="display:none;" class="">
  105 + noVNC is a browser based VNC client implemented using HTML5 Canvas
  106 + and WebSockets. You will either need a VNC server with WebSockets
  107 + support (such as <a href="http://libvncserver.sourceforge.net/">libvncserver</a>)
  108 + or you will need to use
  109 + <a href="https://github.com/kanaka/websockify">websockify</a>
  110 + to bridge between your browser and VNC server. See the noVNC
  111 + <a href="https://github.com/kanaka/noVNC">README</a>
  112 + and <a href="http://kanaka.github.com/noVNC">website</a>
  113 + for more information.
  114 + <br />
  115 + <input type="button" value="Close"
  116 + onclick="UI.toggleConnectPanel();">
  117 + </div>
  118 +
102 119 <!-- Clipboard Panel -->
103 120 <div id="noVNC_clipboard" class="triangle-right top">
104 121 <textarea id="noVNC_clipboard_text" rows=5

0 comments on commit 0ce9390

Please sign in to comment.
Something went wrong with that request. Please try again.