This commit is contained in:
Devaev Maxim 2018-07-22 04:31:29 +03:00
parent 32c40c3b3a
commit 1f55c63f89
3 changed files with 102 additions and 81 deletions

View File

@ -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 { body {
margin: 0; margin: 0;
color: #c3c3c3; color: var(--fg-color-normal);
background-color: #36393f; background-color: var(--bg-color-normal);
font-family: sans-serif !important; font-family: sans-serif !important;
} }
img#logo { img#logo {
@ -20,78 +43,64 @@ div.centered {
} }
ul#ctl { ul#ctl {
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); box-shadow: var(--small-shadow);
list-style-type: none; list-style-type: none;
margin: 0; margin: 0;
padding: 0; padding: 0;
background-color: #202225; background-color: var(--bg-color-ctl);
position: fixed; position: fixed;
top: 0; top: 0;
width: 100%; width: 100%;
z-index: 10; z-index: 10;
} }
ul#ctl li a:hover:not(.active) {
background-color: #111;
}
ul#ctl li.ctl-left { ul#ctl li.ctl-left {
float: left; float: left;
} }
/*ul#ctl li.ctl-left-sep:last-child {
float: left;
border-right: 1px solid black;
}*/
ul#ctl li.ctl-right { ul#ctl li.ctl-right {
float: 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 { ul#ctl img {
vertical-align: middle; vertical-align: middle;
margin-right: 10px; margin-right: 10px;
height: 20px; height: 20px;
} }
ul#ctl a.ctl-item { ul#ctl li a.ctl-item {
border-left: var(--black-border);
display: inline-block; display: inline-block;
vertical-align: middle; color: var(--fg-color-normal);
color: #c3c3c3;
text-align: center;
padding: 15px 16px; padding: 15px 16px;
text-decoration: none; text-decoration: none;
height: 20px; height: 20px;
} }
ul#ctl li a.ctl-item:hover:not(.active) {
background-color: var(--bg-color-selected);
}
div.ctl-dropdown { div.ctl-dropdown {
position: relative; position: relative;
display: inline-block; display: inline-block;
} }
div.ctl-dropdown-content { div.ctl-dropdown-content {
white-space: nowrap; white-space: nowrap;
border: 1px solid #17191d; border: var(--dark-border);
border-radius: 0 0 8px 8px; border-radius: 0 0 8px 8px;
display: none; display: none;
position: absolute; position: absolute;
background-color: #282b30; background-color: var(--bg-color-ctl);
min-width: 180px; min-width: 180px;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.4); box-shadow: var(--big-shadow);
z-index: 9; z-index: 9;
} }
div.ctl-dropdown:hover .ctl-dropdown-content { div.ctl-dropdown:hover .ctl-dropdown-content {
display: block; display: block;
} }
div.ctl-dropdown:hover .ctl-item { div.ctl-dropdown:hover .ctl-item {
background-color: #111; background-color: var(--bg-color-selected);
} }
div.ctl-dropdown-content button { div.ctl-dropdown-content button {
box-shadow: none; box-shadow: none;
border: none; border: none;
color: #c3c3c3; color: var(--fg-color-normal);
background-color: #36393f; background-color: var(--bg-color-normal);
display: block; display: block;
width: 100%; width: 100%;
height: 30px; height: 30px;
@ -102,55 +111,46 @@ div.ctl-dropdown-content button {
cursor: pointer; cursor: pointer;
} }
div.ctl-dropdown-content button:last-child { 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 { div.ctl-dropdown-content button:enabled:hover {
color: white; color: var(--fg-color-intensive);
background-color: #17191d !important; background-color: var(--bg-color-dark) !important;
} }
div.ctl-dropdown-content button:disabled { div.ctl-dropdown-content button:disabled {
color: #6c7481; color: var(--fg-color-inactive);
cursor: default; cursor: default;
} }
div.ctl-dropdown-content button:active { div.ctl-dropdown-content button:active {
color: #5e646e !important; color: var(--fg-color-selected) !important;
} }
div.ctl-dropdown-content button.first { div.ctl-dropdown-content button.first {
display: inline-block; display: inline-block;
width: 50%; width: 50%;
/*border-right: 1px solid #17191d;*/
border-radius: 0 !important;
} }
div.ctl-dropdown-content button.second-half-first { div.ctl-dropdown-content button.second-half {
display: inline-block; display: inline-block;
width: 25%; width: 25%;
border-left: 1px solid #17191d; border-left: var(--dark-border);
border-radius: 0 !important;
}
div.ctl-dropdown-content button.second-half-second {
display: inline-block;
width: 25%;
border-left: 1px solid #17191d;
border-radius: 0 !important;
} }
div.ctl-dropdown-content button.first-bottom { div.ctl-dropdown-content button.first-bottom {
display: inline-block; display: inline-block;
width: 50%; width: 50%;
border-radius: 0 0 0 8px !important; border-radius: 0 0 0 7px;
} }
div.ctl-dropdown-content button.second-bottom { div.ctl-dropdown-content button.second-bottom {
display: inline-block; display: inline-block;
width: 50%; width: 50%;
border-left: 1px solid #17191d; border-left: var(--dark-border);
border-radius: 0 0 8px 0 !important; border-radius: 0 0 7px 0;
} }
div.ctl-dropdown-content hr { div.ctl-dropdown-content hr {
margin: 0; margin: 0;
display: block; display: block;
height: 0; height: 1px;
border: 0; border: 0;
border-top: 1px solid #17191d;
padding: 0; padding: 0;
background-color: var(--bg-color-dark);
} }
div.ctl-dropdown-content-text { div.ctl-dropdown-content-text {
margin: 10px 15px 10px 15px; margin: 10px 15px 10px 15px;
@ -158,20 +158,20 @@ div.ctl-dropdown-content-text {
} }
div#stream-box { div#stream-box {
border: 1px solid #17191d; border: var(--dark-border);
border-radius: 8px; border-radius: 8px;
box-sizing: border-box; box-sizing: border-box;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.4); box-shadow: var(--big-shadow);
display: inline-block; display: inline-block;
background-color: #484b51; background-color: var(--bg-color-light);
padding: 10px; padding: 10px;
} }
img#stream-image { img#stream-image {
width: 640px; width: 640px;
height: 480px; height: 480px;
display: inline-block; display: inline-block;
border: 1px solid #17191d; border: var(--dark-border);
background-color: black; background-color: var(--bg-color-stream-screen);
} }
img.stream-image-active { img.stream-image-active {
cursor: crosshair; cursor: crosshair;
@ -180,8 +180,8 @@ img.stream-image-active {
} }
img.stream-image-inactive { img.stream-image-inactive {
cursor: wait; cursor: wait;
-webkit-filter: grayscale(100%); /* Safari 6.0 - 9.0 */ -webkit-filter: grayscale(100%) brightness(75%);
filter: grayscale(100%); filter: grayscale(100%) brightness(75%);
} }
img.led-on { img.led-on {
@ -203,14 +203,32 @@ img.led-msd-writing {
-moz-animation:spin 2s linear infinite; -moz-animation:spin 2s linear infinite;
animation:spin 2s linear infinite; animation:spin 2s linear infinite;
} }
@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } } @-webkit-keyframes spin {
@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } } 100% {
@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } } -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 { table#msd-info {
border-spacing: 5px; border-spacing: 5px;
margin: 0 10px 0 10px; margin: 0 10px 0 10px;
font-size: 14px; font-size: 12px;
} }
table#msd-info table#msd-info
td#msd-status, td#msd-status,
@ -220,18 +238,18 @@ td#msd-storage-size,
td#msd-new-image-name, td#msd-new-image-name,
td#msd-new-image-size { td#msd-new-image-size {
font-weight: bold; font-weight: bold;
max-width: 330px; max-width: 310px;
overflow: hidden; overflow: hidden;
} }
div#msd-progress { div#msd-progress {
background-color: #111; background-color: var(--bg-color-progress);
height: 1.5em; height: 1.5em;
width: 100%; width: 100%;
position: relative; position: relative;
} }
div#msd-progress:before { div#msd-progress:before {
color: white; color: var(--fg-color-intensive);
content: attr(data-label); content: attr(data-label);
font-size: 0.8em; font-size: 0.8em;
position: absolute; position: absolute;
@ -241,7 +259,7 @@ div#msd-progress:before {
right: 0; right: 0;
} }
div#msd-progress span#msd-progress-value { div#msd-progress span#msd-progress-value {
background-color: #436a8a; background-color: var(--fg-color-progress);
display: inline-block; display: inline-block;
height: 100%; height: 100%;
} }

View File

@ -22,7 +22,7 @@
<ul id="ctl"> <ul id="ctl">
<li class="ctl-left"><img id="logo" src="svg/logo.svg" alt="&pi;-kvm" /></li> <li class="ctl-left"><img id="logo" src="svg/logo.svg" alt="&pi;-kvm" /></li>
<li class="ctl-right-sep"> <li class="ctl-right">
<div class="ctl-dropdown"> <div class="ctl-dropdown">
<a class="ctl-item" href="#"> <a class="ctl-item" href="#">
<img id="stream-led" class="led-off" src="svg/stream-led.svg" /> <img id="stream-led" class="led-off" src="svg/stream-led.svg" />
@ -36,7 +36,7 @@
</div> </div>
</li> </li>
<li class="ctl-right-sep"> <li class="ctl-right">
<div class="ctl-dropdown"> <div class="ctl-dropdown">
<a class="ctl-item" href="#"> <a class="ctl-item" href="#">
<img id="atx-power-led" class="led-off" src="svg/atx-power-led.svg" /> <img id="atx-power-led" class="led-off" src="svg/atx-power-led.svg" />
@ -52,13 +52,13 @@
</div> </div>
</li> </li>
<li class="ctl-right-sep"> <li class="ctl-right">
<div class="ctl-dropdown"> <div class="ctl-dropdown">
<a class="ctl-item" href="#"> <a class="ctl-item" href="#">
<img id="msd-led" class="led-off" src="svg/msd-led.svg" /> <img id="msd-led" class="led-off" src="svg/msd-led.svg" />
Mass Storage &#8628; Mass Storage &#8628;
</a> </a>
<div class="ctl-dropdown-content"> <div id="msd-menu" class="ctl-dropdown-content">
<div id="msd-not-in-operate" style="display:none"> <div id="msd-not-in-operate" style="display:none">
<div class="ctl-dropdown-content-text"> <div class="ctl-dropdown-content-text">
<table> <table>
@ -105,7 +105,7 @@
<table id="msd-info"> <table id="msd-info">
<tr> <tr>
<td>Image name:</td> <td>Current image:</td>
<td id="msd-current-image-name"></td> <td id="msd-current-image-name"></td>
</tr> </tr>
<tr> <tr>
@ -118,14 +118,14 @@
</table> </table>
<hr> <hr>
<input type="file" id="msd-select-new-image-file" style="display:none;" onchange="msd.selectNewImageFile(this)" /> <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();">&bull; Upload new image &#8680;</button><button disabled id="msd-upload-new-image-button" class="second-half-first" onclick="msd.clickButton(this);">&bull; Start</button><button disabled id="msd-abort-uploading-button" class="second-half-second" onclick="msd.clickButton(this);">&bull; Abort</button> <button disabled id="msd-select-new-image-button" class="first" onclick="document.getElementById('msd-select-new-image-file').click();">&bull; Upload new image</button><button disabled id="msd-upload-new-image-button" class="second-half" onclick="msd.clickButton(this);">&bull; Start</button><button disabled id="msd-abort-uploading-button" class="second-half" onclick="msd.clickButton(this);">&bull; Abort</button>
<hr> <hr>
<div id="msd-new-image" style="display:none"> <div id="msd-new-image" style="display:none">
<table id="msd-info"> <table id="msd-info">
<tr> <tr>
<td>Image name:</td> <td>New name:</td>
<td id="msd-new-image-name"></td> <td id="msd-new-image-name"></td>
</tr> </tr>
<tr> <tr>

View File

@ -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); var image_file = (el_input.files.length ? el_input.files[0] : null);
if (image_file && image_file.size > __state.info.size) { 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)); 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 = null;
} }
__image_file = image_file; __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(); __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-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-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-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) { var __formatSize = function(size) {
@ -125,7 +127,8 @@ var msd = new function() {
if (__upload_http.status !== 200) { if (__upload_http.status !== 200) {
alert("Can't upload image to the Mass Storage Device:", __upload_http.responseText); 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; __upload_http = null;
__applyState(); __applyState();
} }