-
Notifications
You must be signed in to change notification settings - Fork 1
/
script.js
37 lines (27 loc) · 945 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
36
37
'use strict';
var $checkbox = document.getElementsByClassName('show_completed');
if ($checkbox.length) {
$checkbox[0].addEventListener('change', function (event) {
var is_checked = +event.target.checked;
var searchParams = new URLSearchParams(window.location.search);
searchParams.set('show_completed', is_checked);
window.location = '/index.php?' + searchParams.toString();
});
}
var $taskCheckboxes = document.getElementsByClassName('tasks');
if ($taskCheckboxes.length) {
$taskCheckboxes[0].addEventListener('change', function (event) {
if (event.target.classList.contains('task__checkbox')) {
var el = event.target;
var is_checked = +el.checked;
var task_id = el.getAttribute('value');
var url = '/index.php?task_id=' + task_id + '&check=' + is_checked;
window.location = url;
}
});
}
flatpickr('#date', {
enableTime: false,
dateFormat: "Y-m-d",
locale: "ru"
});