-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
63 lines (56 loc) · 1.51 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
const fs = require('fs');
const goalFile = './goals.json';
const app = Vue.createApp({
data: function() {
return {
checkboxes: [false, false, false, true, false, true, true]
};
},
methods: {
reload: function () {
window.nw.Window.get().reload();
}
},
computed: {
nw: function () {
return window.nw;
}
}
}).mount('#app')
function loadSettings () {
try {
if (fs.existsSync(goalFile)) {
const data = fs.readFileSync(goalFile, 'utf8');
const goals = JSON.parse(data);
document.getElementById('enterGoal').value = goals.goal;
document.getElementById('enterMotivation').value = goals.motivations;
document.getElementById('g1').value = goals.monthlyGoals[0];
document.getElementById('g2').value = goals.monthlyGoals[1];
document.getElementById('g3').value = goals.monthlyGoals[2];
}
} catch (error) {
console.error(error);
}
}
loadSettings();
/*
function add () {
document.frm.count.value = parseInt(document.frm.count.value) + 1;
addTextBox();
}
function subtract () {
document.frm.count.value = parseInt(document.frm.count.value) - 1;
removeTextBox();
}
function addTextBox () {
var form = document.frm;
form.appendChild(document.createElement('div')).innerHTML = "<table>"
+ "<tr><td>Name</td><td><input type=\"text\" name=\"txt\"></td></tr>"
+ "</table>";
}
function removeTextBox () {
var form = document.frm;
if (form.lastChild.nodeName.toLowerCase() == 'div')
form.removeChild(form.lastChild);
}
*/