PageSourceSearch

https://lionsystems.com.au/site/DefaultSite/skins/lion-systems/js/main.js?v=1.2

js lionsystems.com.au collected 2026-10-06 13:14:25 UTC 8,244 bytes, 233 lines download raw bytes

1"use strict";
2var theme = {
3   init: function () {
4      theme.progressPageLoad();
5      theme.menu();
6      theme.otpVarification();
7      theme.stickyHeader();
8      theme.counterState();
9      theme.alertJS();
10      theme.popovers();
11      theme.tooltip();
12      theme.validation();
13      theme.toast();
14   },
15
16   // ProgressPageLoad
17   progressPageLoad: () => {
18      var progressWrap = document.querySelector(".btn-scroll-top");
19      if (progressWrap != null) {
20         var progressPath = document.querySelector(".btn-scroll-top path");
21         var pathLength = progressPath.getTotalLength();
22         var offset = 50;
23         progressPath.style.transition = progressPath.style.WebkitTransition = "none";
24         progressPath.style.strokeDasharray = pathLength + " " + pathLength;
25         progressPath.style.strokeDashoffset = pathLength;
26         progressPath.getBoundingClientRect();
27         progressPath.style.transition = progressPath.style.WebkitTransition = "stroke-dashoffset 10ms linear";
28         window.addEventListener("scroll", function (event) {
29            var scroll = document.body.scrollTop || document.documentElement.scrollTop;
30            var height = document.documentElement.scrollHeight - document.documentElement.clientHeight;
31            var progress = pathLength - (scroll * pathLength) / height;
32            progressPath.style.strokeDashoffset = progress;
33            var scrollElementPos = document.body.scrollTop || document.documentElement.scrollTop;
34            if (scrollElementPos >= offset) {
35               progressWrap.classList.add("active-progress");
36            } else {
37               progressWrap.classList.remove("active-progress");
38            }
39         });
40         progressWrap.addEventListener("click", function (e) {
41            e.preventDefault();
42            window.scroll({
43               top: 0,
44               left: 0,
45               behavior: "smooth",
46            });
47         });
48      }
49   },
50
51   // Menu
52   menu: () => {
53      const dropdownLinks = document.querySelectorAll(".dropdown-menu a.dropdown-toggle");
54
55      dropdownLinks.forEach(function (dropdownLink) {
56         dropdownLink.addEventListener("click", function (e) {
57            if (!this.nextElementSibling.classList.contains("show")) {
58               const parentDropdownMenu = this.closest(".dropdown-menu");
59               const currentlyOpenSubMenus = parentDropdownMenu.querySelectorAll(".show");
60               currentlyOpenSubMenus.forEach(function (openSubMenu) {
61                  openSubMenu.classList.remove("show");
62               });
63            }
64
65            const subMenu = this.nextElementSibling;
66            subMenu.classList.toggle("show");
67
68            const parentDropdown = this.closest("li.nav-item.dropdown.show");
69            if (parentDropdown) {
70               parentDropdown.addEventListener("hidden.bs.dropdown", function (e) {
71                  const dropdownSubMenus = document.querySelectorAll(".dropdown-submenu .show");
72                  dropdownSubMenus.forEach(function (dropdownSubMenu) {
73                     dropdownSubMenu.classList.remove("show");
74                  });
75               });
76            }
77
78            e.stopPropagation();
79         });
80      });
81   },
82
83   // Sticky Header
84   stickyHeader: () => {
85      var navbar = document.querySelector(".navbar");
86      if (navbar == null) return;
87      var options = {
88         offset: 400,
89         offsetSide: "top",
90         classes: {
91            clone: "navbar-clone fixed",
92            stick: "navbar-stick",
93            unstick: "navbar-unstick",
94         },
95         onStick: function () {
96            var navbarClonedClass = this.clonedElem.classList;
97            if (navbarClonedClass.contains("transparent") && navbarClonedClass.contains("navbar-dark")) {
98               this.clonedElem.className = this.clonedElem.className.replace("navbar-dark", "navbar-light", "navbar-stick");
99            }
100         },
101      };
102      var banner = new Headhesive(".navbar", options);
103   },
104
105   // Counter State
106   counterState: () => {
107      var counters = document.querySelectorAll(".counter");
108      counters.forEach(function (counter) {
109         var countTo = counter.getAttribute("data-count");
110         var countNum = parseInt(counter.textContent);
111         var duration = 4000;
112         var stepDuration = duration / Math.abs(countTo - countNum);
113         var increment = countTo > countNum ? 1 : -1;
114
115         var timer = setInterval(function () {
116            countNum += increment;
117            counter.textContent = countNum;
118
119            if (countNum == countTo) {
120               clearInterval(timer);
121               //alert('finished');
122            }
123         }, stepDuration);
124      });
125   },
126
127   // Alert
128   alertJS: () => {
129      const alertPlaceholder = document.getElementById("liveAlertPlaceholder");
130      const appendAlert = (message, type) => {
131         const wrapper = document.createElement("div");
132         wrapper.innerHTML = [
133            `<div class="alert alert-${type} alert-dismissible" role="alert">`,
134            `   <div>${message}</div>`,
135            '   <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>',
136            "</div>",
137         ].join("");
138
139         alertPlaceholder.append(wrapper);
140      };
141
142      const alertTrigger = document.getElementById("liveAlertBtn");
143      if (alertTrigger) {
144         alertTrigger.addEventListener("click", () => {
145            appendAlert("Nice, you triggered this alert message!", "success");
146         });
147      }
148   },
149
150   // Popovers
151   popovers: () => {
152      const popoverTriggerList = document.querySelectorAll('[data-bs-toggle="popover"]');
153      const popoverList = [...popoverTriggerList].map((popoverTriggerEl) => new bootstrap.Popover(popoverTriggerEl));
154   },
155
156   // Tooltip
157   tooltip: () => {
158      const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]');
159      const tooltipList = [...tooltipTriggerList].map((tooltipTriggerEl) => new bootstrap.Tooltip(tooltipTriggerEl));
160   },
161
162   // Validation
163   validation: () => {
164      // Fetch all the forms we want to apply custom Bootstrap validation styles to
165      const forms = document.querySelectorAll(".needs-validation");
166      // Loop over them and prevent submission
167      Array.from(forms).forEach((form) => {
168         form.addEventListener(
169            "submit",
170            (event) => {
171               if (!form.checkValidity()) {
172                  event.preventDefault();
173                  event.stopPropagation();
174               }
175
176               form.classList.add("was-validated");
177            },
178            false,
179         );
180      });
181   },
182
183   // Toast
184   toast: () => {
185      const toastTrigger = document.getElementById("liveToastBtn");
186      const toastLiveExample = document.getElementById("liveToast");
187
188      if (toastTrigger) {
189         const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastLiveExample);
190         toastTrigger.addEventListener("click", () => {
191            toastBootstrap.show();
192         });
193      }
194   },
195
196   // Otp code
197   otpVarification: () => {
198      document.moveToNextInput = function (input) {
199         if (input.value.length === input.maxLength) {
200            // Get the index of the current input field
201            const currentIndex = Array.from(input.parentElement.children).indexOf(input);
202
203            // Get the next input field if it exists
204            const nextInput = input.parentElement.children[currentIndex + 1];
205
206            // Move focus to the next input field
207            if (nextInput) {
208               nextInput.focus();
209            }
210         }
211      };
212   },
213};
214
215theme.init();
216
217var navbar = document.querySelector(".navbar");
218const navOffCanvasBtn = document.querySelectorAll(".offcanvas-nav-btn")
219  , navOffCanvas = document.querySelector(".navbar:not(.navbar-clone) .offcanvas-nav");
220let bsOffCanvas;
221function toggleOffCanvas() {
222    bsOffCanvas && bsOffCanvas._isShown ? bsOffCanvas.hide() : bsOffCanvas && bsOffCanvas.show()
223}
224navOffCanvas && (bsOffCanvas = new bootstrap.Offcanvas(navOffCanvas,{
225    scroll: !0
226}),
227navOffCanvasBtn.forEach((e=>{
228    e.addEventListener("click", (e=>{
229        toggleOffCanvas()
230    }
231    ))
232}
233)));

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.