Improved night mode in web app.

This commit is contained in:
Ylian Saint-Hilaire 2019-05-11 14:02:42 -07:00
parent d5655a9fdf
commit df6ec68905
41 changed files with 97 additions and 30 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "meshcentral", "name": "meshcentral",
"version": "0.3.4-a", "version": "0.3.4-c",
"keywords": [ "keywords": [
"Remote Management", "Remote Management",
"Intel AMT", "Intel AMT",

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
public/images/gears-128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 24 KiB

BIN
public/images/icons64.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

BIN
public/images/mesh-256.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 754 B

After

Width:  |  Height:  |  Size: 718 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
public/images/user-128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

BIN
public/images/user-256.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -352,6 +352,7 @@ body {
width: 300px; width: 300px;
padding: 16px; padding: 16px;
text-align: center; text-align: center;
color: black;
} }
#passwordPolicyCallout, #rpasswordPolicyCallout { #passwordPolicyCallout, #rpasswordPolicyCallout {
@ -460,6 +461,7 @@ body {
top: 180px; top: 180px;
left: calc((100% / 2) - 200px); left: calc((100% / 2) - 200px);
width: 400px; width: 400px;
color:black;
} }
#dialogHeader { #dialogHeader {
@ -615,6 +617,31 @@ body {
text-align: center; text-align: center;
} }
.deviceBarCheckbox {
width:22px;
float:left;
background-color:white;
}
.night .deviceBarCheckbox {
background-color:black;
}
#devs {
color:black;
}
.deviceBarIcon {
float:left;
height:18px;
width:18px;
background-color:white
}
.night .deviceBarIcon {
background-color:black;
}
#devListToolbarViewIcons { #devListToolbarViewIcons {
float: right; float: right;
} }
@ -739,8 +766,8 @@ NoMeshesPanel img {
} }
#p2AccountImage { #p2AccountImage {
width: 150px; width: 128px;
height: 103px; height: 128px;
margin-bottom: 10px; margin-bottom: 10px;
margin-right: 20px; margin-right: 20px;
float: right; float: right;
@ -1172,6 +1199,10 @@ a {
opacity: 0.5; opacity: 0.5;
} }
.night .lbbutton {
background-color: black;
}
.lbbutton:hover { .lbbutton:hover {
opacity: 1; opacity: 1;
} }
@ -1187,7 +1218,7 @@ a {
} }
.lb1 { .lb1 {
background: url(../images/leftbar-62.jpg) -0px 0px; background: url(../images/leftbar-64.png) -1px -2px;
height: 62px; height: 62px;
width: 62px; width: 62px;
cursor: pointer; cursor: pointer;
@ -1198,7 +1229,7 @@ a {
} }
.lb2 { .lb2 {
background: url(../images/leftbar-62.jpg) -75px 0px; background: url(../images/leftbar-64.png) -66px -2px;
height: 62px; height: 62px;
width: 62px; width: 62px;
cursor: pointer; cursor: pointer;
@ -1209,7 +1240,7 @@ a {
} }
.lb3 { .lb3 {
background: url(../images/leftbar-62.jpg) -150px 0px; background: url(../images/leftbar-64.png) -130px -2px;
height: 62px; height: 62px;
width: 62px; width: 62px;
cursor: pointer; cursor: pointer;
@ -1220,7 +1251,7 @@ a {
} }
.lb4 { .lb4 {
background: url(../images/leftbar-62.jpg) -225px 0px; background: url(../images/leftbar-64.png) -194px -2px;
height: 62px; height: 62px;
width: 62px; width: 62px;
cursor: pointer; cursor: pointer;
@ -1231,7 +1262,7 @@ a {
} }
.lb5 { .lb5 {
background: url(../images/leftbar-62.jpg) -294px 0px; background: url(../images/leftbar-64.png) -257px -2px;
height: 62px; height: 62px;
width: 62px; width: 62px;
cursor: pointer; cursor: pointer;
@ -1242,7 +1273,7 @@ a {
} }
.lb6 { .lb6 {
background: url(../images/leftbar-62.jpg) -360px 0px; background: url(../images/leftbar-64.png) -318px -2px;
height: 62px; height: 62px;
width: 62px; width: 62px;
cursor: pointer; cursor: pointer;
@ -1675,6 +1706,11 @@ a {
margin-bottom: 2px; margin-bottom: 2px;
} }
.night .bar {
color: black;
}
#p3users .bar { #p3users .bar {
width: 100%; width: 100%;
font-size: medium; font-size: medium;
@ -1687,6 +1723,10 @@ a {
background-color: white; background-color: white;
} }
.night .baricon {
background-color: black;
}
.baricon div { .baricon div {
width: 16px; width: 16px;
margin-top: 4px; margin-top: 4px;
@ -1707,6 +1747,7 @@ a {
height: 18px; height: 18px;
float: left; float: left;
margin-bottom: 2px; margin-bottom: 2px;
color: black;
} }
.bar182 { .bar182 {
@ -2020,6 +2061,7 @@ a {
top: 24px; top: 24px;
bottom: 0px; bottom: 0px;
width: 100%; width: 100%;
color:black;
} }
.deskToolsBar { .deskToolsBar {
@ -2047,6 +2089,19 @@ a {
margin-left: 6px; margin-left: 6px;
} }
.serverStateTableCell {
width: 300px;
height: 24px;
background-color: #d3d9d6;
margin-bottom: 4px;
vertical-align: middle;
border-spacing: 0;
}
.night .serverStateTableCell {
color: black;
}
.userTableHeader { .userTableHeader {
border-bottom: 1pt solid lightgray; border-bottom: 1pt solid lightgray;
padding-top: 4px; padding-top: 4px;

File diff suppressed because one or more lines are too long

View File

@ -245,7 +245,7 @@
</div> </div>
<div id=p2 style="display:none"> <div id=p2 style="display:none">
<h1>My Account</h1> <h1>My Account</h1>
<img id="p2AccountImage" alt="" src="images/mainaccount.jpg"/> <img id="p2AccountImage" alt="" src="images/clipboard-128.png"/>
<div id="p2AccountSecurity" style="display:none"> <div id="p2AccountSecurity" style="display:none">
<p><strong>Account security</strong></p> <p><strong>Account security</strong></p>
<div style="margin-left:25px"> <div style="margin-left:25px">
@ -688,8 +688,8 @@
</div> </div>
<div id=p20 style="display:none"> <div id=p20 style="display:none">
<picture id=MainMeshImage style=border-width:0px;height:200px;width:200px;float:right> <picture id=MainMeshImage style=border-width:0px;height:200px;width:200px;float:right>
<source type="image/webp" width=200 height=200 srcset="images/webp/mesh-200.webp"> <source type="image/webp" width=200 height=200 srcset="images/webp/mesh-256.webp">
<img alt="" width=200 height=200 src=images/mesh-200.jpg /> <img alt="" width=200 height=200 src=images/mesh-256.png />
</picture> </picture>
<div style="float:left"><div class="backButton" onclick=goBack() title="Back"><div class="backButtonEx"></div></div></div> <div style="float:left"><div class="backButton" onclick=goBack() title="Back"><div class="backButtonEx"></div></div></div>
<h1>General - <span id=p20meshName></span></h1> <h1>General - <span id=p20meshName></span></h1>
@ -708,8 +708,8 @@
<td style=width:20px></td> <td style=width:20px></td>
<td style=width:200px> <td style=width:200px>
<picture id=MainUserImage style=border-width:0px;height:200px;width:200px;float:right> <picture id=MainUserImage style=border-width:0px;height:200px;width:200px;float:right>
<source type="image/webp" width=200 height=200 srcset="images/webp/user-200.webp"> <source type="image/webp" width=200 height=200 srcset="images/webp/user-256.webp">
<img alt="" width=200 height=200 src=images/user-200.jpg /> <img alt="" width=200 height=200 src=images/user-256.jpg />
</picture> </picture>
<div style="width:100%;text-align:center"><strong><span id=MainUserState></span></strong></div> <div style="width:100%;text-align:center"><strong><span id=MainUserState></span></strong></div>
</td> </td>
@ -927,7 +927,7 @@
var uiMode = parseInt(getstore('uiMode', 1)); var uiMode = parseInt(getstore('uiMode', 1));
var webPageStackMenu = false; var webPageStackMenu = false;
var webPageFullScreen = true; var webPageFullScreen = true;
var nightMode = (getstore('uiMode', 1) == 1); var nightMode = (getstore('_nightMode', '0') == '1');
function startup() { function startup() {
if ((features & 32) == 0) { if ((features & 32) == 0) {
@ -1090,7 +1090,7 @@
function toggleNightMode() { function toggleNightMode() {
nightMode = !nightMode; nightMode = !nightMode;
if (nightMode) { QC('body').add('night'); } else { QC('body').remove('night'); } if (nightMode) { QC('body').add('night'); } else { QC('body').remove('night'); }
putstore('nightMode', nightMode?1:0); putstore('_nightMode', nightMode?'1':'0');
} }
// Toggle the web page to full screen // Toggle the web page to full screen
@ -2245,8 +2245,8 @@
if ((node.conn & 8) != 0) { states.push('<span title="Mesh agent is reachable using another agent as relay.">Relay</span>'); } if ((node.conn & 8) != 0) { states.push('<span title="Mesh agent is reachable using another agent as relay.">Relay</span>'); }
} }
r += '<tr><td><div id=devs class=bar18 onmouseover=devMouseHover(this,1) onmouseout=devMouseHover(this,0) style=height:18px;width:100%;font-size:medium>'; r += '<tr><td><div id=devs class=bar18 onmouseover=devMouseHover(this,1) onmouseout=devMouseHover(this,0) style=height:18px;width:100%;font-size:medium>';
r += '<div style=width:22px;float:left;background-color:white><input class="' + node.meshid + ' DeviceCheckbox" onclick=p1updateInfo() value=devid_' + node._id + ' type=checkbox></div>'; r += '<div class=deviceBarCheckbox><input class="' + node.meshid + ' DeviceCheckbox" onclick=p1updateInfo() value=devid_' + node._id + ' type=checkbox></div>';
r += '<div style=float:left;height:18px;width:18px;background-color:white onclick=gotoDevice(\'' + node._id + '\',null,null,event)><div class=j' + icon + ' style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>'; r += '<div class=deviceBarIcon onclick=gotoDevice(\'' + node._id + '\',null,null,event)><div class=\"j' + icon + '\" style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>';
r += '<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>'; r += '<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>';
r += '<div style=cursor:pointer;font-size:14px title="' + title + '" onclick=gotoDevice(\'' + node._id + '\',null,null,event)><span style=width:300px>' + name + '</span></div></div></td>'; r += '<div style=cursor:pointer;font-size:14px title="' + title + '" onclick=gotoDevice(\'' + node._id + '\',null,null,event)><span style=width:300px>' + name + '</span></div></div></td>';
r += '<td style=text-align:center>' + getUserShortStr(node); r += '<td style=text-align:center>' + getUserShortStr(node);
@ -3832,7 +3832,7 @@
QH('MainComputerState', powerstate); QH('MainComputerState', powerstate);
// Set the node icon // Set the node icon
Q('MainComputerImage').setAttribute("src", "images/icons200-" + node.icon + "-1.jpg"); Q('MainComputerImage').setAttribute("src", "images/icons256-" + node.icon + "-1.png");
Q('MainComputerImage').className = ((!node.conn) || (node.conn == 0)?'gray':''); Q('MainComputerImage').className = ((!node.conn) || (node.conn == 0)?'gray':'');
// Check if we have terminal and file access // Check if we have terminal and file access
@ -7531,7 +7531,7 @@
for (var i in message.values) { for (var i in message.values) {
x += '<div class=userTableHeader style=margin-bottom:4px;width:200px>' + i + '</div>'; x += '<div class=userTableHeader style=margin-bottom:4px;width:200px>' + i + '</div>';
for (var j in message.values[i]) { for (var j in message.values[i]) {
x += '<div style=display:inline-block><table style=width:300px;height:24px;background-color:#d3d9d6;margin-bottom:4px;vertical-align:middle;border-spacing:0><tr><td class=h1></td><td><span>' + j + '</span><span style=float:right>' + message.values[i][j] + '</span></td><td class=h2></td></tr></table></div>'; x += '<div style=display:inline-block><table class=serverStateTableCell><tr><td class=h1></td><td><span>' + j + '</span><span style=float:right>' + message.values[i][j] + '</span></td><td class=h2></td></tr></table></div>';
} }
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -24,6 +24,7 @@
<div id=uiViewButton1 class=uiSelector onclick=userInterfaceSelectMenu(1) title="Left bar interface"><div class="uiSelector1"></div></div> <div id=uiViewButton1 class=uiSelector onclick=userInterfaceSelectMenu(1) title="Left bar interface"><div class="uiSelector1"></div></div>
<div id=uiViewButton2 class=uiSelector onclick=userInterfaceSelectMenu(2) title="Top bar interface"><div class="uiSelector2"></div></div> <div id=uiViewButton2 class=uiSelector onclick=userInterfaceSelectMenu(2) title="Top bar interface"><div class="uiSelector2"></div></div>
<div id=uiViewButton3 class=uiSelector onclick=userInterfaceSelectMenu(3) title="Fixed width interface"><div class="uiSelector3"></div></div> <div id=uiViewButton3 class=uiSelector onclick=userInterfaceSelectMenu(3) title="Fixed width interface"><div class="uiSelector3"></div></div>
<div id=uiViewButton4 class=uiSelector onclick=toggleNightMode() title="Toggle night mode"><div class="uiSelector4"></div></div>
</div> </div>
</div> </div>
</div> </div>
@ -34,7 +35,7 @@
<tr> <tr>
<td id="welcomeimage"> <td id="welcomeimage">
<picture> <picture>
<img alt="" src=welcome.jpg /> <img alt="" src=welcome.jpg style="border-radius:20px" />
</picture> </picture>
</td> </td>
<td id="logincell"> <td id="logincell">
@ -254,8 +255,10 @@
var features = parseInt('{{{features}}}'); var features = parseInt('{{{features}}}');
var welcomeText = decodeURIComponent("{{{welcometext}}}"); var welcomeText = decodeURIComponent("{{{welcometext}}}");
var currentpanel = 0; var currentpanel = 0;
var uiMode = parseInt(getstore('uiMode', 1)); var uiMode = parseInt(getstore('uiMode', '1'));
var webPageFullScreen = true; var webPageFullScreen = true;
var nightMode = (getstore('_nightMode', '0') == '1');
//var webPageFullScreen = getstore('webPageFullScreen', true); //var webPageFullScreen = getstore('webPageFullScreen', true);
//if (webPageFullScreen == 'false') { webPageFullScreen = false; } //if (webPageFullScreen == 'false') { webPageFullScreen = false; }
//if (webPageFullScreen == 'true') { webPageFullScreen = true; } //if (webPageFullScreen == 'true') { webPageFullScreen = true; }
@ -269,6 +272,8 @@
if (top != self && (loc == null || top.active == false)) { top.location = self.location; return; } if (top != self && (loc == null || top.active == false)) { top.location = self.location; return; }
} }
if (nightMode) { QC('body').add('night'); }
QV('createPanelHint', passRequirements.hint === true); QV('createPanelHint', passRequirements.hint === true);
QV('resetpasswordpanelHint', passRequirements.hint === true); QV('resetpasswordpanelHint', passRequirements.hint === true);
@ -645,6 +650,7 @@
Q('uiViewButton3').classList.remove('uiSelectorSel'); Q('uiViewButton3').classList.remove('uiSelectorSel');
try { Q('uiViewButton' + uiMode).classList.add('uiSelectorSel'); } catch (ex) { } try { Q('uiViewButton' + uiMode).classList.add('uiSelectorSel'); } catch (ex) { }
QV('uiMenu', (QS('uiMenu').display == 'none')); QV('uiMenu', (QS('uiMenu').display == 'none'));
if (nightMode) { Q('uiViewButton4').classList.add('uiSelectorSel'); }
} }
function userInterfaceSelectMenu(s) { function userInterfaceSelectMenu(s) {
@ -655,6 +661,12 @@
//toggleStackMenu(0); //toggleStackMenu(0);
} }
function toggleNightMode() {
nightMode = !nightMode;
if (nightMode) { QC('body').add('night'); } else { QC('body').remove('night'); }
putstore('_nightMode', (nightMode ? '1' : '0'));
}
function center() { function center() {
/* Now we use CSS media to achive the same effect as deleted JS */ /* Now we use CSS media to achive the same effect as deleted JS */

File diff suppressed because one or more lines are too long

View File

@ -2705,18 +2705,18 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
// Server picture // Server picture
obj.app.get(url + 'serverpic.ashx', function (req, res) { obj.app.get(url + 'serverpic.ashx', function (req, res) {
// Check if we have "server.jpg" in the data folder, if so, use that. // Check if we have "server.jpg" in the data folder, if so, use that.
if ((parent.configurationFiles != null) && (parent.configurationFiles['server.jpg'] != null)) { if ((parent.configurationFiles != null) && (parent.configurationFiles['server.png'] != null)) {
res.set({ 'Content-Type': 'image/jpeg' }); res.set({ 'Content-Type': 'image/png' });
res.send(parent.configurationFiles['server.jpg']); res.send(parent.configurationFiles['server.png']);
} else { } else {
// Check if we have "server.jpg" in the data folder, if so, use that. // Check if we have "server.jpg" in the data folder, if so, use that.
var p = obj.path.join(obj.parent.datapath, 'server.jpg'); var p = obj.path.join(obj.parent.datapath, 'server.png');
if (obj.fs.existsSync(p)) { if (obj.fs.existsSync(p)) {
// Use the data folder server picture // Use the data folder server picture
try { res.sendFile(p); } catch (e) { res.sendStatus(404); } try { res.sendFile(p); } catch (e) { res.sendStatus(404); }
} else { } else {
// Use the default server picture // Use the default server picture
try { res.sendFile(obj.path.join(obj.parent.webPublicPath, 'images/server-200.jpg')); } catch (e) { res.sendStatus(404); } try { res.sendFile(obj.path.join(obj.parent.webPublicPath, 'images/server-256.png')); } catch (e) { res.sendStatus(404); }
} }
} }
}); });