mirror of
https://github.com/TheGreyDiamond/Enlight.git
synced 2025-07-18 04:33:50 +02:00
The battle aginst deprecation
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ Code/__pycache__/session.cpython-36.pyc
|
|||||||
node_modules
|
node_modules
|
||||||
ui_templates/temp.html
|
ui_templates/temp.html
|
||||||
ui_templates/temp.html
|
ui_templates/temp.html
|
||||||
|
ui_templates/temp.html
|
||||||
|
27
index.js
27
index.js
@ -158,31 +158,6 @@ function rebuildFixtureLib() {
|
|||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
/*, [], (err, rows) => {
|
|
||||||
if (err) {
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
rows.length;
|
|
||||||
} catch (error) {
|
|
||||||
console.log("There is no DB structure, creating a new one.");
|
|
||||||
sql =
|
|
||||||
" \
|
|
||||||
CREATE TABLE `fixtures` ( \
|
|
||||||
`id` INTEGER PRIMARY KEY AUTOINCREMENT, \
|
|
||||||
`LongName` VARCHAR(255), \
|
|
||||||
`Name` VARCHAR(255), \
|
|
||||||
`ShortName` VARCHAR(255), \
|
|
||||||
`Manufacturer` VARCHAR(255), \
|
|
||||||
`Description` VARCHAR(255), \
|
|
||||||
`Thumbnail` VARCHAR(150), \
|
|
||||||
`fileName` VARCHAR(255) );";
|
|
||||||
db.run(sql)
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Preload all pages
|
// Preload all pages
|
||||||
@ -239,6 +214,7 @@ function createWindow() {
|
|||||||
height: screen.getPrimaryDisplay().size.height,
|
height: screen.getPrimaryDisplay().size.height,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
|
contextIsolation: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
win.setFullScreen(true);
|
win.setFullScreen(true);
|
||||||
@ -262,6 +238,7 @@ function createStartupInfo() {
|
|||||||
frame: false,
|
frame: false,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
|
contextIsolation: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<h1>Fixtures</h1>
|
<h1>Fixtures</h1>
|
||||||
<button onclick='ipcRenderer.sendSync("synchronous-message", "PAGE:change.index");'>Back</button>
|
<button onclick='ipcRenderer.sendSync("synchronous-message", "PAGE:change.index");'>Back</button>
|
||||||
<button onclick='ipcRenderer.sendSync("synchronous-message", "FIXTURE:initDB");'>Do magic init stuff</button>
|
<button onclick='ipcRenderer.sendSync("synchronous-message", "FIXTURE:initDB");'>Do magic init stuff</button><br><br>
|
||||||
|
<input type = "text" placeholder="Search fixture libary"></input><br>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -201,8 +201,209 @@
|
|||||||
|
|
||||||
<!--</body>
|
<!--</body>
|
||||||
</html>-->
|
</html>-->
|
||||||
<h1>Fixtures</h1>
|
<!DOCTYPE html>
|
||||||
<button onclick='ipcRenderer.sendSync("synchronous-message", "PAGE:change.index");'>Back</button>
|
<html>
|
||||||
<button onclick='ipcRenderer.sendSync("synchronous-message", "FIXTURE:initDB");'>Do magic init stuff</button>
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<title>Enlight - Screen 1</title>
|
||||||
|
<!--<meta
|
||||||
|
http-equiv="Content-Security-Policy"
|
||||||
|
content="script-src 'self' 'unsafe-inline';"
|
||||||
|
/>-->
|
||||||
|
<script src="static/jquery-1.7.1.min.js" type="text/javascript"></script>
|
||||||
|
<script src="static/js/helper.js" type="text/javascript"></script>
|
||||||
|
<!--<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>*-->
|
||||||
|
<link href="static/default.css" rel="stylesheet" />
|
||||||
|
<link
|
||||||
|
href="static/fontawesome-free-5.15.1-web/css/all.css"
|
||||||
|
rel="stylesheet"
|
||||||
|
/>
|
||||||
|
<!--<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">-->
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!--<div id="header-bar" class="header-bar">
|
||||||
|
<div class="areaRight">
|
||||||
|
<network>
|
||||||
|
<i
|
||||||
|
class="fas fa-network-wired"
|
||||||
|
id="networkBtn"
|
||||||
|
onclick='document.getElementById("networkDropdown").classList.toggle("show");'
|
||||||
|
></i>
|
||||||
|
<div id="networkDropdown" class="dropdown-content"></div>
|
||||||
|
</network>
|
||||||
|
<battery id="battery" class="fa"></battery>
|
||||||
|
<clock id="clock" class="header-clock"></clock>
|
||||||
|
<i
|
||||||
|
class="fa-spin loader1 fa"
|
||||||
|
style="font-size: 18px; padding-right: 4px"
|
||||||
|
id="loader"
|
||||||
|
></i
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
var loaderInUse = true;
|
||||||
|
const { ipcRenderer } = require("electron");
|
||||||
|
setInterval(function () {
|
||||||
|
// Pulling general info from main thread
|
||||||
|
loadOverride = ipcRenderer.sendSync(
|
||||||
|
"synchronous-message",
|
||||||
|
"loadOverride"
|
||||||
|
);
|
||||||
|
if (!loaderInUse) {
|
||||||
|
if (loadOverride) {
|
||||||
|
document.getElementById("loader").innerHTML = "";
|
||||||
|
} else {
|
||||||
|
document.getElementById("loader").innerHTML = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
|
||||||
|
// Network info
|
||||||
|
var allNetworkNames = [];
|
||||||
|
function buildNetworkDropDown() {
|
||||||
|
loaderInUse = true;
|
||||||
|
document.getElementById("loader").innerHTML = "";
|
||||||
|
allNetworks = ipcRenderer.sendSync(
|
||||||
|
"synchronous-message",
|
||||||
|
"getNetworks"
|
||||||
|
);
|
||||||
|
lastNetwork = ipcRenderer.sendSync(
|
||||||
|
"synchronous-message",
|
||||||
|
"getMainNetwork"
|
||||||
|
);
|
||||||
|
allNetworkNames = [];
|
||||||
|
console.log(lastNetwork);
|
||||||
|
i = 0;
|
||||||
|
var dropDown = document.getElementById("networkDropdown");
|
||||||
|
dropDown.innerHTML = "";
|
||||||
|
while (i < allNetworks.length) {
|
||||||
|
temp =
|
||||||
|
"<a id='networkEntry" +
|
||||||
|
String(i) +
|
||||||
|
"' onclick='selectNewNetwork(" +
|
||||||
|
String(i) +
|
||||||
|
")'> " +
|
||||||
|
encode_html(allNetworks[i].ifaceName) +
|
||||||
|
"</a>";
|
||||||
|
dropDown.innerHTML += temp;
|
||||||
|
allNetworkNames.push(allNetworks[i].ifaceName);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (does_list_contain(allNetworkNames, lastNetwork)) {
|
||||||
|
nameOfElm =
|
||||||
|
"networkEntry" + String(allNetworkNames.indexOf(lastNetwork));
|
||||||
|
networkEntryElm = document.getElementById(nameOfElm);
|
||||||
|
networkEntryElm.innerHTML = networkEntryElm.innerHTML.replace(
|
||||||
|
" ",
|
||||||
|
"✔"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
console.warn("Network is no longer valid");
|
||||||
|
ipcRenderer.sendSync(
|
||||||
|
"synchronous-message",
|
||||||
|
"state:networkNoLongerValid"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
loaderInUse = false;
|
||||||
|
document.getElementById("loader").innerHTML = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectNewNetwork(id) {
|
||||||
|
idAsNumber = parseInt(id);
|
||||||
|
newNetwork = allNetworkNames[id];
|
||||||
|
ipcRenderer.sendSync(
|
||||||
|
"synchronous-message",
|
||||||
|
"set:newNetwork|" + newNetwork
|
||||||
|
);
|
||||||
|
buildNetworkDropDown();
|
||||||
|
|
||||||
|
nameOfElm = "networkEntry" + String(idAsNumber);
|
||||||
|
networkEntryElm = document.getElementById(nameOfElm);
|
||||||
|
networkEntryElm.innerHTML = networkEntryElm.innerHTML.replace(
|
||||||
|
" ",
|
||||||
|
"✔"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
buildNetworkDropDown();
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
// Battery info screen
|
||||||
|
batteryExists = ipcRenderer.sendSync("synchronous-message", "hasBattery"); // prints "pong"
|
||||||
|
var batteryShowdStart = false;
|
||||||
|
if (batteryExists) {
|
||||||
|
batteryLevel = ipcRenderer.sendSync(
|
||||||
|
"synchronous-message",
|
||||||
|
"getBatteryLevel"
|
||||||
|
);
|
||||||
|
|
||||||
|
//Setup regular updates
|
||||||
|
setInterval(function () {
|
||||||
|
batteryLevel = parseInt(
|
||||||
|
ipcRenderer.sendSync("synchronous-message", "getBatteryLevel")
|
||||||
|
);
|
||||||
|
|
||||||
|
batteryShowdStart = true;
|
||||||
|
if (batteryLevel > 75) {
|
||||||
|
document.getElementById("battery").innerHTML = "";
|
||||||
|
} else if (batteryLevel <= 75 && batteryLevel > 50) {
|
||||||
|
document.getElementById("battery").innerHTML = "";
|
||||||
|
} else if (batteryLevel <= 50 && batteryLevel > 25) {
|
||||||
|
document.getElementById("battery").innerHTML = "";
|
||||||
|
} else if (batteryLevel <= 25 && batteryLevel > 5) {
|
||||||
|
document.getElementById("battery").innerHTML = "";
|
||||||
|
} else {
|
||||||
|
document.getElementById("battery").innerHTML = "";
|
||||||
|
}
|
||||||
|
}, 2000);
|
||||||
|
} else {
|
||||||
|
batteryShowdStart = true;
|
||||||
|
}
|
||||||
|
if (batteryShowdStart) {
|
||||||
|
document.getElementById("loader").innerHTML = "";
|
||||||
|
loaderInUse = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
setInterval(function () {
|
||||||
|
var date = new Date();
|
||||||
|
hour = updateTime(date.getHours());
|
||||||
|
min = updateTime(date.getMinutes());
|
||||||
|
sec = updateTime(date.getSeconds());
|
||||||
|
document.getElementById("clock").innerHTML =
|
||||||
|
hour + ":" + min + ":" + sec;
|
||||||
|
}, 500);
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
window.onclick = function (event) {
|
||||||
|
if (!event.target.matches("#networkBtn")) {
|
||||||
|
var dropdowns = document.getElementsByClassName("dropdown-content");
|
||||||
|
var i;
|
||||||
|
for (i = 0; i < dropdowns.length; i++) {
|
||||||
|
var openDropdown = dropdowns[i];
|
||||||
|
if (openDropdown.classList.contains("show")) {
|
||||||
|
openDropdown.classList.remove("show");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>-->
|
||||||
|
<!--<iframe src="header.html" class="headerIframe"></iframe>-->
|
||||||
|
<h1>Hello World!</h1>
|
||||||
|
<button onclick='ipcRenderer.sendSync("synchronous-message", "PAGE:change.session");'>Session screen</button>
|
||||||
|
<button onclick='ipcRenderer.sendSync("synchronous-message", "PAGE:change.fixtures");'>Fixture screen</button>
|
||||||
|
We are using node
|
||||||
|
<script>
|
||||||
|
document.write(process.versions.node);
|
||||||
|
</script>
|
||||||
|
, Chrome
|
||||||
|
<script>
|
||||||
|
document.write(process.versions.chrome);
|
||||||
|
</script>
|
||||||
|
, and Electron
|
||||||
|
<script>
|
||||||
|
document.write(process.versions.electron);
|
||||||
|
</script>
|
||||||
|
.
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Reference in New Issue
Block a user