PageSourceSearch

https://www.dhaman.org//js/custom.js

js dhaman.org collected 2026-10-09 23:33:18 UTC 10,166 bytes, 400 lines download raw bytes

1// const lenis = new Lenis()
2
3// lenis.on('scroll', (e) => {
4//   console.log(e)
5// })
6
7// function raf(time) {
8//   lenis.raf(time)
9//   requestAnimationFrame(raf)
10// }
11
12// requestAnimationFrame(raf);
13
14var num = 0;
15var loader = document.getElementById("loader")
16var banner = document.getElementById("banner")
17//var content =document.getElementById("imgs");
18var viewport = document.getElementById("viewport");
19var headers = document.getElementById("header");
20var loader_num = document.getElementById("loader_num");
21var loader_num2 = document.getElementById("loader_num2");
22var progressbar = document.getElementById("progressbar");
23 
24
25const chairmans = document.getElementById("chairman");
26class StickySidebar {
27
28  constructor(element, container) {
29    if(chairmans){
30      this.element = element;
31      this.container = container;
32      let scrollTop = window.pageYOffset || document.documentElement.scrollTop;
33      this.offsetBottom = this.element.getBoundingClientRect().bottom + scrollTop;
34      this.fixed = false;
35      this.init();
36    }
37  }
38
39  init() {
40    this.setElementState();
41    window.onscroll = this.setElementState.bind(this);
42  }
43
44  setElementState() {
45   
46      let containerBottomPosition = this.container.getBoundingClientRect().bottom;
47      if (this.offsetBottom >= containerBottomPosition && this.fixed) {
48        this.element.setAttribute('style', `position: relative; align-self: flex-end`);
49        this.fixed = false;
50      } else if (this.offsetBottom < containerBottomPosition && !this.fixed) {
51        this.element.setAttribute('style', `position: fixed`);
52        this.fixed = true;
53      }
54    
55  }}
56  document.addEventListener('DOMContentLoaded', () => {
57    if(chairmans){
58      let chairman = document.getElementById("chairman");
59      let stickyElement = document.getElementById("sticky-sidebar");
60      let container = document.getElementById("sidebar-container");
61      new StickySidebar(stickyElement, container);
62      chairman.style.setProperty("width", (container.offsetWidth - 25) + "px");
63    }
64  });
65
66window.onload=function(){
67//   const lenis = new Lenis({
68//     duration: 1.2,
69//     easing: (t) => (t === 1 ? 1 : 1 - Math.pow(2, -10 * t)),
70//     direction: "vertical",
71//     gestureDirection: "vertical",
72//     smooth: true,
73//     smoothTouch: false,
74//     touchMultiplier: 2,
75// });
76
77// function raf(time) {
78//     lenis.raf(time);
79//     requestAnimationFrame(raf);
80// }
81
82// requestAnimationFrame(raf);
83
84  AOS.init({
85    duration:1000, 
86  });
87  var swiperBanner = new Swiper(".myBanner", {
88    slidesPerView:1,
89    effect: "fade",
90    autoplay: {
91      delay:3000,
92      disableOnInteraction: false,
93    },
94    spaceBetween:0,
95    navigation: {
96      nextEl: ".banner-button-next",
97      prevEl: ".banner-button-prev",
98      },
99    spaceBetween:0,
100    pagination: {
101      el: ".banner-pagination",
102      clickable: true,
103    }
104  }); 
105var swiperPublications = new Swiper(".myPublications", {
106  slidesPerView:3,
107  spaceBetween:30,
108  navigation: {
109    nextEl: ".publications-button-next",
110    prevEl: ".publications-button-prev",
111    },
112    breakpoints: {
113      300: {
114      slidesPerView:1,
115      spaceBetween:0,
116    },
117    480: {
118      slidesPerView:1,
119      spaceBetween:10,
120    },
121    640: {
122      slidesPerView: 2,
123      spaceBetween:10,
124    },
125    768: {
126      slidesPerView:3,
127      spaceBetween:20,
128    },
129    1024: {
130      slidesPerView:3,
131      spaceBetween:10,
132    },
133    1300: {
134      slidesPerView:3,
135      spaceBetween:30,
136    },
137  }
138});   
139  var swiperInsurance = new Swiper(".myInsurance", {
140    slidesPerView:3,
141    spaceBetween:0,
142    navigation: {
143      nextEl: ".insurance-button-next",
144      prevEl: ".insurance-button-prev",
145      },
146    spaceBetween:0,
147    pagination: {
148      el: ".swiper-insurance",
149      clickable: true,
150    },breakpoints: {
151        300: {
152        slidesPerView:1,
153        spaceBetween:0,
154      },
155      480: {
156        slidesPerView:1,
157        spaceBetween:0,
158      },
159      640: {
160        slidesPerView: 2,
161        spaceBetween:0,
162      },
163      768: {
164        slidesPerView:3,
165        spaceBetween:0,
166      },
167      1024: {
168        slidesPerView:3,
169        spaceBetween:0,
170      },
171    },
172  });
173  var swiperTestimonial = new Swiper(".myTestimonial", {
174    slidesPerView:1,
175    spaceBetween:0,
176    navigation: {
177      nextEl: ".testimonial-button-next",
178      prevEl: ".testimonial-button-prev",
179      },
180    spaceBetween:0,
181    pagination: {
182      el: ".swiper-testimonial",
183      clickable: true,
184    }
185  });
186  var swiperMilestone = new Swiper(".myMilestone", {
187    slidesPerView:5,
188    spaceBetween:0,
189    mousewheel: true,
190    parallax: true,
191        speed: 600,
192    navigation: {
193      nextEl: ".milestone-button-next",
194      prevEl: ".milestone-button-prev",
195      },
196    spaceBetween:0,
197    pagination: {
198      el: ".milestone-insurance",
199      clickable: true,
200    },breakpoints: {
201        300: {
202        slidesPerView: 2
203      },
204      640: {
205        slidesPerView: 2
206      },
207      768: {
208        slidesPerView:3
209      },
210      1024: {
211        slidesPerView:5
212      },
213    },
214  });
215  var swiperRating = new Swiper(".myRating", {
216    slidesPerView: 2,
217    grid: {
218      rows: 2,
219    },
220    spaceBetween:20,
221    pagination: {
222      el: ".rating-pagination",
223      clickable: true,
224    },breakpoints: {
225    300: {
226      slidesPerView:1
227    },
228    992: {
229      slidesPerView:1
230    },
231    1024: {
232      slidesPerView:2
233    },
234  },
235  });
236  var swiperCountries = new Swiper(".myCountries", {
237    slidesPerView:5,
238    spaceBetween:5,
239    mousewheel: true,
240    parallax: true,
241        speed: 600,
242    navigation: {
243      nextEl: ".countries-button-next",
244      prevEl: ".countries-button-prev",
245      },
246    spaceBetween:0,
247    pagination: {
248      el: ".countries-insurance",
249      clickable: true,
250    },breakpoints: {
251        300: {
252        slidesPerView: 2
253      },
254      640: {
255        slidesPerView: 2
256      },
257      768: {
258        slidesPerView:3
259      },
260      1024: {
261        slidesPerView:5,spaceBetween:5,
262      },
263    },
264  });
265
266  var swiperMedia = new Swiper(".myMedia", {
267    slidesPerView:4,
268    grid: {
269      rows: 2,
270    },
271    spaceBetween: 30,
272    navigation: {
273      nextEl: ".media-button-next",
274      prevEl: ".media-button-prev",
275      },
276      breakpoints: {
277        300: {
278        slidesPerView: 2,spaceBetween:10,
279      },
280      576: {
281        slidesPerView:3,spaceBetween:10,
282      },
283      768: {
284        slidesPerView:3,spaceBetween:10,
285      },
286      992: {
287        slidesPerView:4,spaceBetween:20,
288      },
289      1024: {
290        slidesPerView:4,spaceBetween:20,
291      },
292    },
293  });
294
295
296  const searchClose = document.querySelector('.search-close');
297  const searchLink = document.querySelector('.search-link');
298  const searchContetns = document.querySelector('.search-container');
299  const searchCloseBanner = document.querySelector('.banner');
300  if(searchLink){
301    searchLink.addEventListener('click', function searchClickFun(){    
302      if(searchContetns.classList.contains('opened')){
303        searchContetns.classList.remove('opened');
304        searchLink.classList.remove('active');
305      }
306      else{
307        searchContetns.classList.add('opened');
308        searchLink.classList.add('active');
309      }
310    });
311  }
312  if(searchCloseBanner){
313    searchCloseBanner.addEventListener("click", searchCloseFun);
314  }
315  searchClose.addEventListener("click", searchCloseFun);
316  function searchCloseFun() {
317    searchContetns.classList.remove('opened');
318    searchLink.classList.remove('active');
319  }
320}
321"use strict"
322document.addEventListener("DOMContentLoaded", function() {
323  // You can change this class to specify which elements are going to behave as counters.
324  var elements = document.querySelectorAll(".scroll-counter")
325
326  elements.forEach(function(item) {
327    // Add new attributes to the elements with the '.scroll-counter' HTML class
328    item.counterAlreadyFired = false
329    item.counterSpeed = item.getAttribute("data-counter-time") / 45
330    item.counterTarget = +item.innerText
331    item.counterCount = 0
332    item.counterStep = item.counterTarget / item.counterSpeed
333
334    item.updateCounter = function() {
335      item.counterCount = item.counterCount + item.counterStep
336      item.innerText = Math.ceil(item.counterCount)
337
338      if (item.counterCount < item.counterTarget) {
339        setTimeout(item.updateCounter, item.counterSpeed)
340      } else {
341        item.innerText = item.counterTarget
342      }
343    }
344  })
345
346  // Function to determine if an element is visible in the web page
347  var isElementVisible = function isElementVisible(el) {
348    var scroll = window.scrollY || window.pageYOffset
349    var boundsTop = el.getBoundingClientRect().top + scroll
350    var viewport = {
351      top: scroll,
352      bottom: scroll + window.innerHeight,
353    }
354    var bounds = {
355      top: boundsTop,
356      bottom: boundsTop + el.clientHeight,
357    }
358    return (
359      (bounds.bottom >= viewport.top && bounds.bottom <= viewport.bottom) ||
360      (bounds.top <= viewport.bottom && bounds.top >= viewport.top)
361    )
362  }
363
364  // Funciton that will get fired uppon scrolling
365  var handleScroll = function handleScroll() {
366    elements.forEach(function(item, id) {
367      if (true === item.counterAlreadyFired) return
368      if (!isElementVisible(item)) return
369      item.updateCounter()
370      item.counterAlreadyFired = true
371    })
372  }
373
374  // Fire the function on scroll
375  window.addEventListener("scroll", handleScroll)
376})
377//Record how many pixels are scrolled vertically
378let scrollpos = window.scrollY
379
380const header = document.querySelector("header")
381
382//How many pixels you need to scroll to add a class. You can change the value
383const scrollChange = 150
384
385//The function that will add the class
386const add_class_on_scroll = () => header.classList.add('smaller')
387
388//Tracking a "scroll" event
389window.addEventListener('scroll', function() { 
390  scrollpos = window.scrollY;
391  //console.log(scrollpos);
392//If we scrolled more than we specified in the scrollChange variable, the add class function is executed
393  if (scrollpos >= scrollChange) { add_class_on_scroll() }
394  else{
395    header.classList.remove('smaller');
396  }
397});
398/*Fancybox.bind("[data-fancybox]", {
399   
400}) */

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.