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); });