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,7 +1,9 @@
const { ipcRenderer } = nodeRequire('electron');
function Add()
if (window.showAdd != undefined && window.showAdd)
{
const { ipcRenderer } = nodeRequire('electron');
function Add()
{
this.overlay = null;
this.display = null;
this.grid = null;
@ -255,14 +257,14 @@ function Add()
this.enabledOverlay = false;
}
}
}
}
String.prototype.toProperCase = function () {
String.prototype.toProperCase = function () {
return this.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
};
};
document.onkeydown = function(evt)
{
document.onkeydown = function(evt)
{
evt = evt || window.event;
if (!evt.ctrlKey)
{
@ -291,4 +293,5 @@ document.onkeydown = function(evt)
main.load('add');
}
}
};
};
}

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;