From f7ec5b2cb61b2bc25e3a8ca9f2deb8754471ccae Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Wed, 10 Nov 2010 16:02:19 -0600 Subject: [PATCH] Rename default_controls.js to ui.js. And DefaultControls to UI. --- README.md | 8 +- include/{default_controls.js => ui.js} | 172 ++++++++++++------------- vnc.html | 6 +- 3 files changed, 92 insertions(+), 94 deletions(-) rename include/{default_controls.js => ui.js} (70%) diff --git a/README.md b/README.md index c1286b4..ccf51ea 100644 --- a/README.md +++ b/README.md @@ -142,19 +142,19 @@ There a few reasons why a proxy is required: The client is designed to be easily integrated with existing web structure and style. -At a minimum you must include the `vnc.js` and `default_controls.js` -scripts and call DefaultControls.load(). For example: +At a minimum you must include the `vnc.js` and `ui.js` scripts and +call UI.load(). For example: - +
Loading
diff --git a/include/default_controls.js b/include/ui.js similarity index 70% rename from include/default_controls.js rename to include/ui.js index 65cf3b0..69ac8c4 100644 --- a/include/default_controls.js +++ b/include/ui.js @@ -9,15 +9,15 @@ /*jslint white: false */ /*global $, Util, RFB, Canvas, VNC_uri_prefix, Element, Fx */ -var DefaultControls = { +var UI = { settingsOpen : false, -// Render default controls and initialize settings menu +// Render default UI and initialize settings menu load: function(target) { - var html = '', i, DC = DefaultControls, sheet, sheets, llevels; + var html = '', i, sheet, sheets, llevels; - /* Populate the 'target' DOM element with default controls */ + /* Populate the 'target' DOM element with default UI */ if (!target) { target = 'vnc'; } if ((!document.createElement('canvas').getContext) && @@ -52,10 +52,10 @@ load: function(target) { html += '
'; html += ' > settingsApply"); - var DC = DefaultControls; - DC.saveSetting('encrypt'); - DC.saveSetting('true_color'); - if (DC.rfb.get_canvas().get_cursor_uri()) { - DC.saveSetting('cursor'); + UI.saveSetting('encrypt'); + UI.saveSetting('true_color'); + if (UI.rfb.get_canvas().get_cursor_uri()) { + UI.saveSetting('cursor'); } - DC.saveSetting('shared'); - DC.saveSetting('connectTimeout'); - DC.saveSetting('stylesheet'); - DC.saveSetting('logging'); + UI.saveSetting('shared'); + UI.saveSetting('connectTimeout'); + UI.saveSetting('stylesheet'); + UI.saveSetting('logging'); // Settings with immediate (non-connected related) effect - WebUtil.selectStylesheet(DC.getSetting('stylesheet')); - WebUtil.init_logging(DC.getSetting('logging')); + WebUtil.selectStylesheet(UI.getSetting('stylesheet')); + WebUtil.init_logging(UI.getSetting('logging')); //Util.Debug("<< settingsApply"); }, @@ -296,12 +294,12 @@ settingsApply: function() { setPassword: function() { - DefaultControls.rfb.sendPassword($('VNC_password').value); + UI.rfb.sendPassword($('VNC_password').value); return false; }, sendCtrlAltDel: function() { - DefaultControls.rfb.sendCtrlAltDel(); + UI.rfb.sendCtrlAltDel(); }, updateState: function(rfb, state, oldstate, msg) { @@ -315,40 +313,40 @@ updateState: function(rfb, state, oldstate, msg) { case 'fatal': c.disabled = true; cad.disabled = true; - DefaultControls.settingsDisabled(true, rfb); + UI.settingsDisabled(true, rfb); klass = "VNC_status_error"; break; case 'normal': c.value = "Disconnect"; - c.onclick = DefaultControls.disconnect; + c.onclick = UI.disconnect; c.disabled = false; cad.disabled = false; - DefaultControls.settingsDisabled(true, rfb); + UI.settingsDisabled(true, rfb); klass = "VNC_status_normal"; break; case 'disconnected': case 'loaded': c.value = "Connect"; - c.onclick = DefaultControls.connect; + c.onclick = UI.connect; c.disabled = false; cad.disabled = true; - DefaultControls.settingsDisabled(false, rfb); + UI.settingsDisabled(false, rfb); klass = "VNC_status_normal"; break; case 'password': c.value = "Send Password"; - c.onclick = DefaultControls.setPassword; + c.onclick = UI.setPassword; c.disabled = false; cad.disabled = true; - DefaultControls.settingsDisabled(true, rfb); + UI.settingsDisabled(true, rfb); klass = "VNC_status_warn"; break; default: c.disabled = true; cad.disabled = true; - DefaultControls.settingsDisabled(true, rfb); + UI.settingsDisabled(true, rfb); klass = "VNC_status_warn"; break; } @@ -362,16 +360,16 @@ updateState: function(rfb, state, oldstate, msg) { }, clipReceive: function(rfb, text) { - Util.Debug(">> DefaultControls.clipReceive: " + text.substr(0,40) + "..."); + Util.Debug(">> UI.clipReceive: " + text.substr(0,40) + "..."); $('VNC_clipboard_text').value = text; - Util.Debug("<< DefaultControls.clipReceive"); + Util.Debug("<< UI.clipReceive"); }, connect: function() { - var host, port, password, DC = DefaultControls; + var host, port, password; - DC.closeSettingsMenu(); + UI.closeSettingsMenu(); host = $('VNC_host').value; port = $('VNC_port').value; @@ -380,39 +378,39 @@ connect: function() { throw("Must set host and port"); } - DC.rfb.set_encrypt(DC.getSetting('encrypt')); - DC.rfb.set_true_color(DC.getSetting('true_color')); - DC.rfb.set_local_cursor(DC.getSetting('cursor')); - DC.rfb.set_shared(DC.getSetting('shared')); - DC.rfb.set_connectTimeout(DC.getSetting('connectTimeout')); + UI.rfb.set_encrypt(UI.getSetting('encrypt')); + UI.rfb.set_true_color(UI.getSetting('true_color')); + UI.rfb.set_local_cursor(UI.getSetting('cursor')); + UI.rfb.set_shared(UI.getSetting('shared')); + UI.rfb.set_connectTimeout(UI.getSetting('connectTimeout')); - DC.rfb.connect(host, port, password); + UI.rfb.connect(host, port, password); }, disconnect: function() { - DefaultControls.closeSettingsMenu(); + UI.closeSettingsMenu(); - DefaultControls.rfb.disconnect(); + UI.rfb.disconnect(); }, canvasBlur: function() { - DefaultControls.rfb.get_canvas().set_focused(false); + UI.rfb.get_canvas().set_focused(false); }, canvasFocus: function() { - DefaultControls.rfb.get_canvas().set_focused(true); + UI.rfb.get_canvas().set_focused(true); }, clipClear: function() { $('VNC_clipboard_text').value = ""; - DefaultControls.rfb.clipboardPasteFrom(""); + UI.rfb.clipboardPasteFrom(""); }, clipSend: function() { var text = $('VNC_clipboard_text').value; - Util.Debug(">> DefaultControls.clipSend: " + text.substr(0,40) + "..."); - DefaultControls.rfb.clipboardPasteFrom(text); - Util.Debug("<< DefaultControls.clipSend"); + Util.Debug(">> UI.clipSend: " + text.substr(0,40) + "..."); + UI.rfb.clipboardPasteFrom(text); + Util.Debug("<< UI.clipSend"); } }; diff --git a/vnc.html b/vnc.html index bbc6a70..de6b427 100644 --- a/vnc.html +++ b/vnc.html @@ -1,6 +1,6 @@ @@ -14,7 +14,7 @@ src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'> --> - + @@ -22,7 +22,7 @@