diff options
author | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-08-17 11:36:55 +0200 |
---|---|---|
committer | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-08-17 11:36:55 +0200 |
commit | 1229bb6a838e96eb52be7aa1cac8d692746bc783 (patch) | |
tree | 20a337622a62e43f9ac4baf6d609de5d3891cb84 /src/displayheaders.js | |
parent | 97d10a54426d2df2de1c765948989dfc88a316eb (diff) |
convert to bulma css framework
Diffstat (limited to 'src/displayheaders.js')
-rw-r--r-- | src/displayheaders.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/displayheaders.js b/src/displayheaders.js new file mode 100644 index 0000000..3c0936a --- /dev/null +++ b/src/displayheaders.js @@ -0,0 +1,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); +}); + |