-
Notifications
You must be signed in to change notification settings - Fork 3
/
ManageNewFiles.js
80 lines (67 loc) · 2.17 KB
/
ManageNewFiles.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
var filename;
let AddedInputPath;
document.querySelector('body').addEventListener('click', event => {
if(event.target.id==='getTagInfo')
{
event.preventDefault();
console.log("getTagInfo");
window.electron.showTagInfo();
}
if(event.target.className.includes('inputTag'))
{
AddedInputPath = event.target.parentNode;
filename=event.target.value;
if(AddedInputPath.querySelector("div")){
AddedInputPath.removeChild(AddedInputPath.querySelector("div"));
}
else {
let box = document.createElement("div");
box.classList.add("d-flex");
let input = document.createElement("INPUT");
input.id="tag";
input.setAttribute("type", "text");
let enterButton = document.createElement("button");
enterButton.id="enter";
enterButton.classList.add("btn", "btn-primary");
enterButton.appendChild(document.createTextNode("Enter"));
box.appendChild(input);
box.appendChild(enterButton);
AddedInputPath.appendChild(box);
}
}
if(event.target.className.includes('fixTag'))
{
AddedInputPath = event.target.parentNode;
filename=event.target.value;
if(AddedInputPath.querySelector("div")){
AddedInputPath.removeChild(AddedInputPath.querySelector("div"));
}
else {
let box = document.createElement("div");
box.classList.add("d-flex");
let input = document.createElement("INPUT");
input.id="tag";
input.setAttribute("type", "text");
let enterButton = document.createElement("button");
enterButton.id="enter";
enterButton.classList.add("btn", "btn-primary");
enterButton.appendChild(document.createTextNode("Enter"));
box.appendChild(input);
box.appendChild(enterButton);
AddedInputPath.appendChild(box);
}
}
if(event.target.className.includes('deleteTag'))
{
filename=event.target.value;
window.electron.deleteTag(filename);
window.electron.showTagInfo();
}
if(event.target.id==='enter')
{
var tag=document.getElementById('tag').value;
window.electron.inputTag(filename,tag);
window.electron.showTagInfo();
}
});
window.electron.showTagInfo();