mirror of
https://github.com/TheGreyDiamond/Enlight.git
synced 2025-07-18 04:33:50 +02:00
A bit faster
This commit is contained in:
29
index.js
29
index.js
@ -4,6 +4,22 @@ const { win32 } = require("path");
|
|||||||
const sysInf = require("systeminformation");
|
const sysInf = require("systeminformation");
|
||||||
|
|
||||||
var aWin2 = undefined;
|
var aWin2 = undefined;
|
||||||
|
var header = undefined;
|
||||||
|
|
||||||
|
header = fs.readFileSync("ui_templates/header.html").toString();
|
||||||
|
|
||||||
|
/// !!!-----------!!!
|
||||||
|
/// PAGE LOOKUP TABLE
|
||||||
|
var pageLookup = {};
|
||||||
|
pageLookup["index"] = "index.html";
|
||||||
|
pageLookup["session"] = "sessions.html";
|
||||||
|
|
||||||
|
fs.readFile('ui_templates/sessions.html', 'utf8', function (err,data) {
|
||||||
|
if (err) {
|
||||||
|
return console.log(err);
|
||||||
|
}
|
||||||
|
pageLookup["sessionPRELOAD"] = data;
|
||||||
|
});
|
||||||
|
|
||||||
function createWindow() {
|
function createWindow() {
|
||||||
const win = new BrowserWindow({
|
const win = new BrowserWindow({
|
||||||
@ -17,7 +33,7 @@ function createWindow() {
|
|||||||
win.setMenuBarVisibility(false);
|
win.setMenuBarVisibility(false);
|
||||||
win.setAutoHideMenuBar(true);
|
win.setAutoHideMenuBar(true);
|
||||||
main = fs.readFileSync("ui_templates/index.html").toString();
|
main = fs.readFileSync("ui_templates/index.html").toString();
|
||||||
header = fs.readFileSync("ui_templates/header.html").toString();
|
//header = fs.readFileSync("ui_templates/header.html").toString();
|
||||||
toLoad = header + main;
|
toLoad = header + main;
|
||||||
fs.writeFileSync("ui_templates/temp.html", toLoad)
|
fs.writeFileSync("ui_templates/temp.html", toLoad)
|
||||||
//win.loadURL("data:text/html;charset=utf-8," + encodeURI(toLoad));
|
//win.loadURL("data:text/html;charset=utf-8," + encodeURI(toLoad));
|
||||||
@ -123,6 +139,17 @@ function init() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}else if (String(arg).includes("PAGE:change")) {
|
||||||
|
newPage = String(arg).split(".")[1]
|
||||||
|
main = pageLookup[newPage + "PRELOAD"]
|
||||||
|
if(main == undefined){
|
||||||
|
main = fs.readFileSync("ui_templates/" + pageLookup[newPage]).toString();
|
||||||
|
}
|
||||||
|
toLoad = header + main;
|
||||||
|
fs.writeFileSync("ui_templates/temp.html", toLoad)
|
||||||
|
win.loadFile("ui_templates/temp.html")
|
||||||
|
|
||||||
|
event.returnValue = "";
|
||||||
}else{
|
}else{
|
||||||
event.returnValue = "ERR:UNKNOW_CMD"
|
event.returnValue = "ERR:UNKNOW_CMD"
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@
|
|||||||
</script>-->
|
</script>-->
|
||||||
<!--<iframe src="header.html" class="headerIframe"></iframe>-->
|
<!--<iframe src="header.html" class="headerIframe"></iframe>-->
|
||||||
<h1>Hello World!</h1>
|
<h1>Hello World!</h1>
|
||||||
<a href="">Session screen</a>
|
<button onclick='ipcRenderer.sendSync("synchronous-message", "PAGE:change.session");'>Session screen</button>
|
||||||
We are using node
|
We are using node
|
||||||
<script>
|
<script>
|
||||||
document.write(process.versions.node);
|
document.write(process.versions.node);
|
||||||
|
6
ui_templates/sessions.html
Normal file
6
ui_templates/sessions.html
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
<h1>Sessions</h1>
|
||||||
|
yes.
|
||||||
|
<button onclick='ipcRenderer.sendSync("synchronous-message", "PAGE:change.index");'>Go back</button>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -376,7 +376,7 @@
|
|||||||
</script>-->
|
</script>-->
|
||||||
<!--<iframe src="header.html" class="headerIframe"></iframe>-->
|
<!--<iframe src="header.html" class="headerIframe"></iframe>-->
|
||||||
<h1>Hello World!</h1>
|
<h1>Hello World!</h1>
|
||||||
<a href="">Session screen</a>
|
<button onclick='ipcRenderer.sendSync("synchronous-message", "PAGE:change.session");'>Session screen</button>
|
||||||
We are using node
|
We are using node
|
||||||
<script>
|
<script>
|
||||||
document.write(process.versions.node);
|
document.write(process.versions.node);
|
||||||
|
@ -1 +1 @@
|
|||||||
VirtualBox Host-Only Ethernet Adapter
|
Intel(R) I211 Gigabit Network Connection
|
Reference in New Issue
Block a user