]> git.proxmox.com Git - pve-eslint.git/blob - eslint/docs/src/assets/js/components-index.js
import 8.23.1 source
[pve-eslint.git] / eslint / docs / src / assets / js / components-index.js
1 (function() {
2 var index_trigger = document.getElementById("js-index-toggle"),
3 index = document.getElementById("js-index-list"),
4 body = document.getElementsByTagName("body")[0],
5 open = false;
6
7 if (matchMedia) {
8 const mq = window.matchMedia("(max-width: 1023px)");
9 mq.addEventListener('change', WidthChange);
10 WidthChange(mq);
11 }
12
13 function WidthChange(mq) {
14 initIndex();
15 }
16
17 function toggleindex(e) {
18 if (!open) {
19 this.setAttribute("aria-expanded", "true");
20 index.setAttribute("data-open", "true");
21 open = true;
22 } else {
23 this.setAttribute("aria-expanded", "false");
24 index.setAttribute("data-open", "false");
25 open = false;
26 }
27 }
28
29 function initIndex() {
30 index_trigger.removeAttribute("hidden");
31 index_trigger.setAttribute("aria-expanded", "false");
32 index.setAttribute("data-open", "false");
33 index_trigger.addEventListener("click", toggleindex, false);
34 }
35 })();