-
Notifications
You must be signed in to change notification settings - Fork 0
/
Listpad.js
51 lines (38 loc) · 1.02 KB
/
Listpad.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
class Listpad {
constructor(uid, type, save) {
this.save = save;
this.listpad = document.createElement('listpad');
this.listpad.setAttribute('uid', uid);
this.listpad.className = type;
let deleteBtn = document.createElement('button');
deleteBtn.className = 'listpad-delete symbol-btn';
deleteBtn.innerText = '×';
deleteBtn.onclick = this.delete;
this.append(deleteBtn);
this.listbox = new Listbox(type, save);
this.append(this.listbox.element());
}
append(child) {
this.listpad.append(child);
}
uid() {
return this.listpad.getAttribute('uid');
}
type() {
return this.listpad.getAttribute('class');
}
append(child) {
return this.listpad.append(child);
}
remove() {
this.listpad.remove();
}
delete = () => {
this.remove();
History.append(this.listpad);
this.save();
}
element() {
return this.listpad;
}
}