From 575f69832df2909f7f79d58a4facfc035b5b8e81 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Sat, 29 Oct 2016 17:25:32 +0200 Subject: [PATCH] Group WebSocket settings together It was easy to confuse them as being VNC settings, so keep them all under one group. --- app/images/expander.svg | 69 +++++++++++++++++++++++++++++++++++++++++ app/styles/base.css | 32 +++++++++++++++++-- app/ui.js | 19 ++++++++++-- vnc.html | 31 ++++++++++-------- 4 files changed, 133 insertions(+), 18 deletions(-) create mode 100644 app/images/expander.svg diff --git a/app/images/expander.svg b/app/images/expander.svg new file mode 100644 index 0000000..e163535 --- /dev/null +++ b/app/images/expander.svg @@ -0,0 +1,69 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/app/styles/base.css b/app/styles/base.css index 749bcea..19ec70e 100644 --- a/app/styles/base.css +++ b/app/styles/base.css @@ -458,6 +458,32 @@ input[type=button]:active, select:active { float: right; } +/* Expanders */ +.noVNC_expander { + cursor: pointer; +} +.noVNC_expander::before { + content: url("../images/expander.svg"); + display: inline-block; + margin-right: 5px; + transition: 0.2s ease-in-out; +} +.noVNC_expander.noVNC_open::before { + transform: rotateZ(90deg); +} +.noVNC_expander ~ * { + margin: 5px; + margin-left: 10px; + padding: 5px; + background: rgba(0, 0, 0, 0.05); + border-radius: 5px; +} +.noVNC_expander:not(.noVNC_open) ~ * { + display: none; +} + +/* Control bar content */ + :root:not(.noVNC_connected) #noVNC_view_drag_button { display: none; } @@ -528,6 +554,9 @@ input[type=button]:active, select:active { margin: 0px; padding: 0px; } +#noVNC_setting_port { + width: 80px; +} #noVNC_setting_path { width: 100px; } @@ -544,9 +573,6 @@ input[type=button]:active, select:active { margin: 0px; padding: 0px; } -#noVNC_setting_port { - width: 80px; -} /* ---------------------------------------- * Status Dialog diff --git a/app/ui.js b/app/ui.js index 9ff2406..b2e7e99 100644 --- a/app/ui.js +++ b/app/ui.js @@ -254,6 +254,11 @@ var UI; .addEventListener('mousemove', UI.dragControlbarHandle); // resize events aren't available for elements window.addEventListener('resize', UI.updateControlbarHandle); + + var exps = document.getElementsByClassName("noVNC_expander"); + for (var i = 0;i < exps.length;i++) { + exps[i].addEventListener('click', UI.toggleExpander); + } }, addTouchSpecificHandlers: function() { @@ -459,6 +464,8 @@ var UI; document.getElementById('noVNC_setting_resize').disabled = UI.connected; document.getElementById('noVNC_setting_shared').disabled = UI.connected; document.getElementById('noVNC_setting_view_only').disabled = UI.connected; + document.getElementById('noVNC_setting_host').disabled = UI.connected; + document.getElementById('noVNC_setting_port').disabled = UI.connected; document.getElementById('noVNC_setting_path').disabled = UI.connected; document.getElementById('noVNC_setting_repeaterID').disabled = UI.connected; @@ -722,6 +729,14 @@ var UI; UI.activateControlbar(); }, + toggleExpander: function(e) { + if (this.classList.contains("noVNC_open")) { + this.classList.remove("noVNC_open"); + } else { + this.classList.add("noVNC_open"); + } + }, + /* ------^------- * /VISUAL * ============== @@ -825,6 +840,8 @@ var UI; UI.saveSetting('clip'); UI.saveSetting('shared'); UI.saveSetting('view_only'); + UI.saveSetting('host'); + UI.saveSetting('port'); UI.saveSetting('path'); UI.saveSetting('repeaterID'); UI.saveSetting('logging'); @@ -1021,8 +1038,6 @@ var UI; document.getElementById('noVNC_connect_controls_button') .classList.remove("noVNC_selected"); - UI.saveSetting('host'); - UI.saveSetting('port'); //UI.saveSetting('password'); }, diff --git a/vnc.html b/vnc.html index 9d2240e..2ac7511 100644 --- a/vnc.html +++ b/vnc.html @@ -176,9 +176,6 @@
  • Settings
  • -
  • - -
  • @@ -196,8 +193,24 @@

  • - - +
    WebSocket
    +
      +
    • + +
    • +
    • + + +
    • +
    • + + +
    • +
    • + + +
    • +
  • @@ -241,14 +254,6 @@
  • Connection
  • -
  • - - -
  • -
  • - - -
  • -- 2.39.2