Fix write add functionality breaking web version.

This commit is contained in:
kor 2018-08-10 03:18:32 +12:00
parent 8d2eed7f3c
commit 28b3f2db29
4 changed files with 284 additions and 272 deletions

View File

@ -1,3 +1,5 @@
if (window.showAdd != undefined && window.showAdd)
{
const { ipcRenderer } = nodeRequire('electron');
function Add()
@ -292,3 +294,4 @@ document.onkeydown = function(evt)
}
}
};
}

View File

@ -13,7 +13,8 @@ function Main()
{
var client = new XMLHttpRequest();
client.open('GET', FILELOCATION);
client.onreadystatechange = function()
client.overrideMimeType("text/plain");
client.onreadystatechange = function(req, res)
{
if (client.responseText.trim() != '')
{
@ -30,14 +31,17 @@ function Main()
this.db.install(data);
this.view = new View();
this.view.install();
if (window.showAdd != undefined && window.showAdd)
{
this.add = new Add();
this.add.install();
var escape = document.getElementById("escape");
escape.onclick = function()
{
main.load(main.queryPrev);
}
}
this.start();
}

View File

@ -48,8 +48,11 @@ function View()
}
this.display = function(db)
{
if (window.showAdd != undefined && window.showAdd)
{
main.add.setOverlay(false);
}
// BUILD
this.grid.innerHTML = '';

View File

@ -2,3 +2,5 @@ window.nodeRequire = require;
delete window.require;
delete window.exports;
delete window.module;
// window.showAdd = true;