PageSourceSearch

https://rmas.consistent.in/assets/js/main.js

js consistent.in collected 2026-10-08 04:31:42 UTC 3,879 bytes, 118 lines download raw bytes

1/**
2 * Main
3 */
4
5"use strict";
6
7let menu, animate;
8
9function Main() {
10  // Initialize menu
11  //-----------------
12
13  // let layoutMenuEl = document.querySelectorAll('#layout-menu');
14  // layoutMenuEl.forEach(function (element) {
15  //   menu = new Menu(element, {
16  //     orientation: 'vertical',
17  //     closeChildren: false
18  //   });
19  //   // Change parameter to true if you want scroll animation
20  //   window.Helpers.scrollToActive((animate = false));
21  //   window.Helpers.mainMenu = menu;
22  // });
23
24  // Initialize menu togglers and bind click on each
25  let menuToggler = document.querySelectorAll(".layout-menu-toggle");
26  menuToggler.forEach((item) => {
27    item.addEventListener("click", (event) => {
28      event.preventDefault();
29      window.Helpers.toggleCollapsed();
30    });
31  });
32
33  // Display menu toggle (layout-menu-toggle) on hover with delay
34  let delay = function (elem, callback) {
35    let timeout = null;
36    elem.onmouseenter = function () {
37      // Set timeout to be a timer which will invoke callback after 300ms (not for small screen)
38      if (!Helpers.isSmallScreen()) {
39        timeout = setTimeout(callback, 300);
40      } else {
41        timeout = setTimeout(callback, 0);
42      }
43    };
44
45    elem.onmouseleave = function () {
46      // Clear any timers set to timeout
47      document.querySelector(".layout-menu-toggle").classList.remove("d-block");
48      clearTimeout(timeout);
49    };
50  };
51  if (document.getElementById("layout-menu")) {
52    delay(document.getElementById("layout-menu"), function () {
53      // not for small screen
54      if (!Helpers.isSmallScreen()) {
55        document.querySelector(".layout-menu-toggle").classList.add("d-block");
56      }
57    });
58  }
59
60  // Display in main menu when menu scrolls
61  let menuInnerContainer = document.getElementsByClassName("menu-inner"),
62    menuInnerShadow = document.getElementsByClassName("menu-inner-shadow")[0];
63  if (menuInnerContainer.length > 0 && menuInnerShadow) {
64    menuInnerContainer[0].addEventListener("ps-scroll-y", function () {
65      if (this.querySelector(".ps__thumb-y").offsetTop) {
66        menuInnerShadow.style.display = "block";
67      } else {
68        menuInnerShadow.style.display = "none";
69      }
70    });
71  }
72
73  // Init helpers & misc
74  // --------------------
75
76  // Init BS Tooltip
77  const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
78  tooltipTriggerList.map(function (tooltipTriggerEl) {
79    return new bootstrap.Tooltip(tooltipTriggerEl);
80  });
81
82  // Accordion active class
83  const accordionActiveFunction = function (e) {
84    if (e.type == "show.bs.collapse" || e.type == "show.bs.collapse") {
85      e.target.closest(".accordion-item").classList.add("active");
86    } else {
87      e.target.closest(".accordion-item").classList.remove("active");
88    }
89  };
90
91  const accordionTriggerList = [].slice.call(document.querySelectorAll(".accordion"));
92  const accordionList = accordionTriggerList.map(function (accordionTriggerEl) {
93    accordionTriggerEl.addEventListener("show.bs.collapse", accordionActiveFunction);
94    accordionTriggerEl.addEventListener("hide.bs.collapse", accordionActiveFunction);
95  });
96
97  // Auto update layout based on screen size
98  window.Helpers.setAutoUpdate(true);
99
100  // Toggle Password Visibility
101  window.Helpers.initPasswordToggle();
102
103  // Speech To Text
104  window.Helpers.initSpeechToText();
105
106  // Manage menu expanded/collapsed with templateCustomizer & local storage
107  //------------------------------------------------------------------
108
109  // If current layout is horizontal OR current window screen is small (overlay menu) than return from here
110  if (window.Helpers.isSmallScreen()) {
111    return;
112  }
113
114  // If current layout is vertical and current window screen is > small
115
116  // Auto update menu collapsed/expanded based on the themeConfig
117  window.Helpers.setCollapsed(true, false);
118}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.