Skip to content

Commit 084ffda

Browse files
committed
Enhanded Dark-mode and bug fixes
1 parent 0cc7519 commit 084ffda

5 files changed

Lines changed: 78 additions & 23 deletions

File tree

UI/electron.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ const electron = require('electron');
22
const {app, BrowserWindow} = electron
33
const url = require('url')
44
const path = require('path');
5-
require("./server")
5+
try {
6+
require("./server")
7+
} catch (e) {
8+
console.log(e)
9+
}
10+
611

712
//require('electron-reload')(__dirname,{electron: path.join(__dirname, 'node_modules', '.bin', 'electron')})
813

@@ -23,14 +28,23 @@ function createWindow(){
2328
titleBarStyle: 'hidden',
2429
transparent: true
2530
});
26-
2731
windowObj.loadURL(url.format(path.join(__dirname, 'index.html')));
28-
32+
//windowObj.webContents.openDevTools()
2933
windowObj.on('closed', () => {
3034
windowObj = null
3135
})
36+
37+
//Workaround for frame top-bar glitch (electron 25)
38+
windowObj.on('blur', () => {
39+
windowObj.setBackgroundColor('#00000000')
40+
})
41+
42+
windowObj.on('focus', () => {
43+
windowObj.setBackgroundColor('#00000000')
44+
})
3245
}
3346

47+
3448
app.on('window-all-closed', () => {
3549
if (process.platform !== 'darwin') app.quit()
3650
})

UI/handler.js

Lines changed: 54 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1-
localStorage.clear()
21
document.getElementById('sec-notif').style.transform = 'scale(0)'
32

4-
function colormode(){
5-
if(document.getElementById('menu1').style.backgroundColor === 'white'){
3+
try {
4+
console.log(localStorage.getItem("colormode"))
5+
colormode(localStorage.getItem("colormode"))
6+
} catch (e) {colormode("light")}
7+
8+
function colorbridge(){
9+
if(document.getElementById('menu1').style.backgroundColor === 'white') colormode("dark")
10+
else colormode("light")
11+
}
12+
13+
function colormode(pref){
14+
if(pref === 'dark'){
15+
localStorage.setItem("colormode", "dark")
616
document.getElementById('filter').style.opacity = '70%'
717
document.getElementById('menu1').style.backgroundColor = 'black'
818
document.getElementById('sec-notif').style.backgroundColor = 'black'
@@ -25,11 +35,23 @@ function colormode(){
2535
document.getElementById('sub-select1').style.borderColor = 'white'
2636
document.getElementById('sel-txt').style.color = 'white';
2737
//console.log(document.querySelector('.multiselect-wrapper').style)
28-
//document.querySelector('.multiselect-wrapper').style.borderColor = 'white'
38+
//document.querySelector('.multiselect-wrapper').classList.add('invert')
2939
//document.querySelector('.multiselect-wrapper').style.backgroundColor = 'black'
30-
//console.log(document.querySelector('.multiselect-wrapper').style)
31-
document.getElementById('top-bar').classList.add('invert')
32-
} else{
40+
try {
41+
document.querySelector('.multiselect-wrapper ul').style.backgroundColor = 'black';
42+
document.querySelector('.multiselect-wrapper ul').style.color = 'white';
43+
document.querySelector('.multiselect-list').style.color = 'white';
44+
document.querySelector('.multiselect-list').style.backgroundColor = 'black';
45+
} catch (e) {
46+
console.log(e)
47+
}
48+
document.getElementById('top-bar').classList.add('invert');
49+
document.getElementById('err-path').style.color = 'white'
50+
document.getElementById('error').style.color = 'white'
51+
document.getElementById('success').style.color = 'white';
52+
document.getElementById("notification").style.backgroundColor = 'black'
53+
} else if(pref === 'light'){
54+
localStorage.setItem("colormode", "light")
3355
document.getElementById('filter').style.opacity = '5%'
3456
document.getElementById('menu1').style.backgroundColor = 'white'
3557
document.getElementById('sec-notif').style.backgroundColor = 'white'
@@ -45,13 +67,29 @@ function colormode(){
4567
}
4668
document.getElementsByClassName('gg-dark-mode')[0].style.backgroundColor = null
4769
document.getElementById('sec-notif').style.color = 'black';
48-
document.getElementById('top-bar').classList.remove('invert')
70+
document.getElementById('top-bar').classList.remove('invert');
71+
try {
72+
document.querySelector('.multiselect-wrapper').classList.remove('invert');
73+
document.querySelector('.multiselect-wrapper ul').style.backgroundColor = 'white';
74+
document.querySelector('.multiselect-wrapper ul').style.color = 'black';
75+
document.querySelector('.multiselect-list').style.color = 'black';
76+
document.querySelector('.multiselect-list').style.backgroundColor = 'white';
77+
} catch (e) {
78+
console.log(e)
79+
}
80+
document.getElementById('sub-select1').style.backgroundColor = 'white'
81+
document.getElementById('sub-select1').style.borderColor = 'black'
82+
document.getElementById('sel-txt').style.color = 'black';
83+
document.getElementById('err-path').style.color = 'black'
84+
document.getElementById('error').style.color = 'black'
85+
document.getElementById('success').style.color = 'black';
86+
document.getElementById("notification").style.backgroundColor = 'white'
4987
}
5088
}
5189

52-
function handler(value){
90+
function handler(value){
91+
console.log('entered')
5392
if(!value){
54-
5593
document.getElementById('sec-notif').style.visibility = 'visible'
5694
document.getElementById('sec-notif').style.transform = 'scale(1)'
5795
document.getElementsByClassName('btn-select')[0].children[0].innerHTML = 'Folder selected'}
@@ -71,11 +109,12 @@ function handler(value){
71109
.then(response => {
72110
console.log(response)
73111
switch(response.status){
74-
case 404: {
112+
case 220: {
75113
console.log('path was not valid')
76114
document.getElementsByClassName('btn-select')[0].children[0].innerHTML = 'No Folder selected'
77115
document.getElementById('path-ph').innerHTML = null;
78-
116+
document.getElementById('sec-notif').style.transform = 'scale(0)'
117+
document.getElementById('sec-notif').style.visibility = 'hidden'
79118
document.getElementById('notification').style.display = 'block';
80119
document.getElementById('err-path').style.display = 'block';
81120
document.getElementById('notification').style.opacity = '100%';
@@ -84,8 +123,9 @@ function handler(value){
84123
setTimeout(() => {
85124
document.getElementById('err-path').style.display = 'none';
86125
document.getElementById('notification').style.display = 'none';
87-
}, 1000)
88-
}, 3000)
126+
window.location.reload()
127+
}, 500)
128+
}, 2000)
89129
}break;
90130
case 205: {
91131
console.log('path was valid')

UI/index.html

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,21 @@ <h3 style="text-align:left; color: rgb(0, 0, 0); font-weight: 600; -webkit-text-
3535
<span style="text-align: center;">ENHANCER</span></h3>
3636

3737
<div style="position: absolute; right: 110px; top: 13px; border-radius: 50%;">
38-
<i class="gg-dark-mode" onclick="colormode()"></i>
38+
<i class="gg-dark-mode" onclick="colorbridge()"></i>
3939
</div>
4040
</div>
4141

4242
<div id="menu1" class="menu1" style="background-color: white; color: black; border-radius: 10px; border-width: 3px; opacity: 70%; border-style: dashed; border-color: gray; height: 300px; width: 80%; position: absolute; display: block; bottom: 10%; left: 10%; align-items: center; justify-content: center;">
4343
<h4 style="text-align: center; margin-top: 70px; font-size: larger;">
4444
Choose the folder you want to transform
4545
</h4>
46-
<a onclick="document.getElementById('div-select').click()" class="btn-select" id="btn-select" style="color: black;">
46+
<a onclick="document.getElementById('div-select').click(); console.log('yes')" class="btn-select" id="btn-select" style="color: black;">
4747
<span>
4848
No folder selected
4949
</span>
5050
</a>
5151
<h4 style="text-align: center; margin-top: 100px; margin-right: 15px;" id="path-ph"></h4>
52-
<a><input type="file" id="div-select" class="div-select" oninput="handler()" webkitdirectory = multiple style="display: none;"></a>
52+
<input type="file" id="div-select" class="div-select" oninput="handler()" webkitdirectory style="display: none;">
5353

5454
</div>
5555

@@ -123,15 +123,16 @@ <h3 style="text-align: center; margin-top: 60px;">
123123
height: 70px;
124124
width: 250px;
125125
background-color: rgb(26, 23, 23);
126+
color: white;
126127
border-radius: 10px;
127128
border-width: 2px;
128129
border-style: solid;
129-
animation: notif 2s;
130+
animation: notif 1s;
130131
position: absolute;
131132
bottom: 0;
132133
right: 0;
133134
display: block;
134-
transition: all 1s ease-out;
135+
transition: all .5s ease-out;
135136
}
136137

137138
@keyframes notif {

UI/main.cpp

Whitespace-only changes.

UI/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ app.get('/request', (req, res, next) => {
3636
})
3737
}
3838
}else{
39-
res.sendStatus(404)
39+
res.sendStatus(220)
4040
}}
4141
});
4242

0 commit comments

Comments
 (0)