diff options
author | Devaev Maxim <[email protected]> | 2018-07-22 04:31:29 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2018-07-22 04:31:29 +0300 |
commit | 1f55c63f89a7e338d9df8a5a3c6cb3842429fec8 (patch) | |
tree | 9bc01c197ad9700f6eee735d001f8aa32f77cfc9 /kvmd | |
parent | 32c40c3b3a141a98ee3ae70483ba7fe11f536126 (diff) |
ui fixes
Diffstat (limited to 'kvmd')
-rw-r--r-- | kvmd/web/css/main.css | 150 | ||||
-rw-r--r-- | kvmd/web/index.html | 16 | ||||
-rw-r--r-- | kvmd/web/js/msd.js | 17 |
3 files changed, 102 insertions, 81 deletions
diff --git a/kvmd/web/css/main.css b/kvmd/web/css/main.css index ad5bca2d..21935380 100644 --- a/kvmd/web/css/main.css +++ b/kvmd/web/css/main.css @@ -1,7 +1,30 @@ +:root { + --dark-border: 1px solid #17191d; + --black-border: 1px solid black; + + --small-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); + --big-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.4); + + --bg-color-normal: #36393f; + --bg-color-light: #484b51; + --bg-color-dark: #17191d; + --bg-color-ctl: #202225; + --bg-color-selected: #171717; + --bg-color-progress: #171717; + + --fg-color-normal: #c3c3c3; + --fg-color-intensive: white; + --fg-color-inactive: #6c7481; + --fg-color-selected: #6c7481; + --fg-color-progress: #436a8a; + + --bg-color-stream-screen: black; +} + body { margin: 0; - color: #c3c3c3; - background-color: #36393f; + color: var(--fg-color-normal); + background-color: var(--bg-color-normal); font-family: sans-serif !important; } img#logo { @@ -20,78 +43,64 @@ div.centered { } ul#ctl { - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); + box-shadow: var(--small-shadow); list-style-type: none; margin: 0; padding: 0; - background-color: #202225; + background-color: var(--bg-color-ctl); position: fixed; top: 0; width: 100%; z-index: 10; } -ul#ctl li a:hover:not(.active) { - background-color: #111; -} ul#ctl li.ctl-left { float: left; } -/*ul#ctl li.ctl-left-sep:last-child { - float: left; - border-right: 1px solid black; -}*/ ul#ctl li.ctl-right { float: right; } -ul#ctl li.ctl-right-sep:not(last-child) { - float: right; - border-left: 1px solid black; -} -/*ul#ctl p { - color: #c3c3c3; - margin: 0; - padding: 15px 16px; -}*/ ul#ctl img { vertical-align: middle; margin-right: 10px; height: 20px; } -ul#ctl a.ctl-item { +ul#ctl li a.ctl-item { + border-left: var(--black-border); display: inline-block; - vertical-align: middle; - color: #c3c3c3; - text-align: center; + color: var(--fg-color-normal); padding: 15px 16px; text-decoration: none; height: 20px; } +ul#ctl li a.ctl-item:hover:not(.active) { + background-color: var(--bg-color-selected); +} div.ctl-dropdown { position: relative; display: inline-block; } div.ctl-dropdown-content { white-space: nowrap; - border: 1px solid #17191d; + border: var(--dark-border); border-radius: 0 0 8px 8px; display: none; position: absolute; - background-color: #282b30; + background-color: var(--bg-color-ctl); min-width: 180px; - box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.4); + box-shadow: var(--big-shadow); z-index: 9; } div.ctl-dropdown:hover .ctl-dropdown-content { display: block; } div.ctl-dropdown:hover .ctl-item { - background-color: #111; + background-color: var(--bg-color-selected); } div.ctl-dropdown-content button { box-shadow: none; border: none; - color: #c3c3c3; - background-color: #36393f; + color: var(--fg-color-normal); + background-color: var(--bg-color-normal); display: block; width: 100%; height: 30px; @@ -102,55 +111,46 @@ div.ctl-dropdown-content button { cursor: pointer; } div.ctl-dropdown-content button:last-child { - border-radius: 0 0 8px 8px; + border-radius: 0 0 7px 7px; } div.ctl-dropdown-content button:enabled:hover { - color: white; - background-color: #17191d !important; + color: var(--fg-color-intensive); + background-color: var(--bg-color-dark) !important; } div.ctl-dropdown-content button:disabled { - color: #6c7481; + color: var(--fg-color-inactive); cursor: default; } div.ctl-dropdown-content button:active { - color: #5e646e !important; + color: var(--fg-color-selected) !important; } div.ctl-dropdown-content button.first { display: inline-block; width: 50%; - /*border-right: 1px solid #17191d;*/ - border-radius: 0 !important; -} -div.ctl-dropdown-content button.second-half-first { - display: inline-block; - width: 25%; - border-left: 1px solid #17191d; - border-radius: 0 !important; } -div.ctl-dropdown-content button.second-half-second { +div.ctl-dropdown-content button.second-half { display: inline-block; width: 25%; - border-left: 1px solid #17191d; - border-radius: 0 !important; + border-left: var(--dark-border); } div.ctl-dropdown-content button.first-bottom { display: inline-block; width: 50%; - border-radius: 0 0 0 8px !important; + border-radius: 0 0 0 7px; } div.ctl-dropdown-content button.second-bottom { display: inline-block; width: 50%; - border-left: 1px solid #17191d; - border-radius: 0 0 8px 0 !important; + border-left: var(--dark-border); + border-radius: 0 0 7px 0; } div.ctl-dropdown-content hr { margin: 0; display: block; - height: 0; + height: 1px; border: 0; - border-top: 1px solid #17191d; padding: 0; + background-color: var(--bg-color-dark); } div.ctl-dropdown-content-text { margin: 10px 15px 10px 15px; @@ -158,20 +158,20 @@ div.ctl-dropdown-content-text { } div#stream-box { - border: 1px solid #17191d; + border: var(--dark-border); border-radius: 8px; box-sizing: border-box; - box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.4); + box-shadow: var(--big-shadow); display: inline-block; - background-color: #484b51; + background-color: var(--bg-color-light); padding: 10px; } img#stream-image { width: 640px; height: 480px; display: inline-block; - border: 1px solid #17191d; - background-color: black; + border: var(--dark-border); + background-color: var(--bg-color-stream-screen); } img.stream-image-active { cursor: crosshair; @@ -180,8 +180,8 @@ img.stream-image-active { } img.stream-image-inactive { cursor: wait; - -webkit-filter: grayscale(100%); /* Safari 6.0 - 9.0 */ - filter: grayscale(100%); + -webkit-filter: grayscale(100%) brightness(75%); + filter: grayscale(100%) brightness(75%); } img.led-on { @@ -203,14 +203,32 @@ img.led-msd-writing { -moz-animation:spin 2s linear infinite; animation:spin 2s linear infinite; } -@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } } -@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } } -@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } } +@-webkit-keyframes spin { + 100% { + -webkit-transform: rotate(360deg); + } +} +@-moz-keyframes spin { + 100% { + -moz-transform: rotate(360deg); + } +} +@keyframes spin { + 100% { + -webkit-transform: rotate(360deg); + -moz-transform: rotate(360deg); + transform:rotate(360deg); + } +} + +div#msd-menu { + width: 450px; +} table#msd-info { border-spacing: 5px; margin: 0 10px 0 10px; - font-size: 14px; + font-size: 12px; } table#msd-info td#msd-status, @@ -220,18 +238,18 @@ td#msd-storage-size, td#msd-new-image-name, td#msd-new-image-size { font-weight: bold; - max-width: 330px; + max-width: 310px; overflow: hidden; } div#msd-progress { - background-color: #111; + background-color: var(--bg-color-progress); height: 1.5em; width: 100%; position: relative; } div#msd-progress:before { - color: white; + color: var(--fg-color-intensive); content: attr(data-label); font-size: 0.8em; position: absolute; @@ -241,7 +259,7 @@ div#msd-progress:before { right: 0; } div#msd-progress span#msd-progress-value { - background-color: #436a8a; + background-color: var(--fg-color-progress); display: inline-block; height: 100%; } diff --git a/kvmd/web/index.html b/kvmd/web/index.html index 094aa561..d9d953fb 100644 --- a/kvmd/web/index.html +++ b/kvmd/web/index.html @@ -22,7 +22,7 @@ <ul id="ctl"> <li class="ctl-left"><img id="logo" src="svg/logo.svg" alt="π-kvm" /></li> - <li class="ctl-right-sep"> + <li class="ctl-right"> <div class="ctl-dropdown"> <a class="ctl-item" href="#"> <img id="stream-led" class="led-off" src="svg/stream-led.svg" /> @@ -36,7 +36,7 @@ </div> </li> - <li class="ctl-right-sep"> + <li class="ctl-right"> <div class="ctl-dropdown"> <a class="ctl-item" href="#"> <img id="atx-power-led" class="led-off" src="svg/atx-power-led.svg" /> @@ -52,13 +52,13 @@ </div> </li> - <li class="ctl-right-sep"> + <li class="ctl-right"> <div class="ctl-dropdown"> <a class="ctl-item" href="#"> <img id="msd-led" class="led-off" src="svg/msd-led.svg" /> Mass Storage ↴ </a> - <div class="ctl-dropdown-content"> + <div id="msd-menu" class="ctl-dropdown-content"> <div id="msd-not-in-operate" style="display:none"> <div class="ctl-dropdown-content-text"> <table> @@ -105,7 +105,7 @@ <table id="msd-info"> <tr> - <td>Image name:</td> + <td>Current image:</td> <td id="msd-current-image-name"></td> </tr> <tr> @@ -118,14 +118,14 @@ </table> <hr> - <input type="file" id="msd-select-new-image-file" style="display:none;" onchange="msd.selectNewImageFile(this)" /> - <button disabled id="msd-select-new-image-button" class="first" onclick="document.getElementById('msd-select-new-image-file').click();">• Upload new image ⇨</button><button disabled id="msd-upload-new-image-button" class="second-half-first" onclick="msd.clickButton(this);">• Start</button><button disabled id="msd-abort-uploading-button" class="second-half-second" onclick="msd.clickButton(this);">• Abort</button> + <input type="file" id="msd-select-new-image-file" style="display:none;" onchange="msd.selectNewImageFile()" /> + <button disabled id="msd-select-new-image-button" class="first" onclick="document.getElementById('msd-select-new-image-file').click();">• Upload new image</button><button disabled id="msd-upload-new-image-button" class="second-half" onclick="msd.clickButton(this);">• Start</button><button disabled id="msd-abort-uploading-button" class="second-half" onclick="msd.clickButton(this);">• Abort</button> <hr> <div id="msd-new-image" style="display:none"> <table id="msd-info"> <tr> - <td>Image name:</td> + <td>New name:</td> <td id="msd-new-image-name"></td> </tr> <tr> diff --git a/kvmd/web/js/msd.js b/kvmd/web/js/msd.js index 34ba72f7..23dcbf58 100644 --- a/kvmd/web/js/msd.js +++ b/kvmd/web/js/msd.js @@ -56,7 +56,8 @@ var msd = new function() { } }; - this.selectNewImageFile = function(el_input) { + this.selectNewImageFile = function() { + var el_input = $("msd-select-new-image-file"); var image_file = (el_input.files.length ? el_input.files[0] : null); if (image_file && image_file.size > __state.info.size) { alert("New image is too big for your Mass Storage Device; maximum: " + __formatSize(__state.info.size)); @@ -64,11 +65,6 @@ var msd = new function() { image_file = null; } __image_file = image_file; - $("msd-new-image").style.display = (__image_file ? "block" : "none"); - $("msd-progress").setAttribute("data-label", "Waiting for upload ..."); - $("msd-progress-value").style.width = "0%"; - $("msd-new-image-name").innerHTML = (__image_file ? __image_file.name : ""); - $("msd-new-image-size").innerHTML = (__image_file ? __formatSize(__image_file.size) : ""); __applyState(); }; @@ -109,6 +105,12 @@ var msd = new function() { $("msd-select-new-image-button").disabled = (!__state.in_operate || __state.connected_to !== "kvm" || __state.busy || __upload_http); $("msd-upload-new-image-button").disabled = (!__state.in_operate || __state.connected_to !== "kvm" || __state.busy || !__image_file); $("msd-abort-uploading-button").disabled = (!__state.in_operate || !__upload_http); + + $("msd-new-image").style.display = (__image_file ? "block" : "none"); + $("msd-progress").setAttribute("data-label", "Waiting for upload ..."); + $("msd-progress-value").style.width = "0%"; + $("msd-new-image-name").innerHTML = (__image_file ? __image_file.name : ""); + $("msd-new-image-size").innerHTML = (__image_file ? __formatSize(__image_file.size) : ""); }; var __formatSize = function(size) { @@ -125,7 +127,8 @@ var msd = new function() { if (__upload_http.status !== 200) { alert("Can't upload image to the Mass Storage Device:", __upload_http.responseText); } - el_input.value = ""; + $("msd-select-new-image-file").value = ""; + __image_file = null; __upload_http = null; __applyState(); } |