-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
35 lines (31 loc) · 957 Bytes
/
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
Application.load();
// action of "addColumn" button
document
.querySelector('[data-action-addColumn]')
.addEventListener('click', function (event) {
const columnElement = new Column().element;
document.querySelector('.columns').append(columnElement);
columnElement.querySelector('.column-header').focus()
});
// bin events
var bin = document.querySelector('.bin');
bin.addEventListener('dragenter', function(e){
bin.classList.add('under');
});
bin.addEventListener('dragover', function(e){
e.preventDefault();
});
bin.addEventListener('dragleave', function(e){
bin.classList.remove('under');
});
bin.addEventListener('drop', function(e){
e.stopPropagation();
bin.classList.remove('under');
if (Note.dragged) Note.dragged.remove();
if (Column.dragged) Column.dragged.remove();
Application.save();
});
window.onbeforeunload = function(e){
document.querySelectorAll('.column, .note').forEach(a => a.blur());
Application.save();
};