Microservice to bring 2FA to self hosted PDSes
1document.addEventListener('DOMContentLoaded', function () {
2 var hamburger = document.getElementById('hamburger');
3 var overlay = document.getElementById('sidebar-overlay');
4
5 function openSidebar() {
6 document.body.classList.add('sidebar-open');
7 }
8
9 function closeSidebar() {
10 document.body.classList.remove('sidebar-open');
11 }
12
13 if (hamburger) {
14 hamburger.addEventListener('click', function () {
15 document.body.classList.toggle('sidebar-open');
16 });
17 }
18
19 if (overlay) {
20 overlay.addEventListener('click', closeSidebar);
21 }
22
23 // Close sidebar when a nav link is tapped on mobile
24 document.querySelectorAll('.sidebar nav a').forEach(function (link) {
25 link.addEventListener('click', closeSidebar);
26 });
27});