blob: 3c0936a39973b81ed92e03a8801e90f3af340166 (
plain)
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
|
function toggle_navbar() {
// Get the target from the "data-target" attribute
const target = this.dataset.target;
const $target = document.getElementById(target);
// Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu"
this.classList.toggle('is-active');
$target.classList.toggle('is-active');
}
function sort_select_submit() {
this.children[0].form.submit();
}
function check_all() {
const setTo = this.checked;
const chkbox = document.getElementsByClassName('jwm-mail-checkbox');
for (const m of chkbox)
m.checked = setTo;
}
document.addEventListener("DOMContentLoaded", function() {
{
const sort_select = document.getElementById("sort");
const current_option_name = new URL(document.location).searchParams.get("sort");
if (current_option_name)
sort_select.value = current_option_name;
}
document.getElementById("sort-select").addEventListener("change", sort_select_submit);
document.getElementById("navbar-toggle").addEventListener("click", toggle_navbar);
document.getElementById("check-all").addEventListener("click", check_all);
});
|