PageSourceSearch

https://hafp.tech/assets/js/leo.js

js hafp.tech collected 2026-09-29 14:44:42 UTC 11,776 bytes, 374 lines download raw bytes

1/*
2
3=========================================================
4* Leo Agency Bootstrap Theme
5=========================================================
6
7* Product Page: https://themesberg.com/product/bootstrap-themes/leo-agency-bootstrap-4-template
8* Copyright 2020 Themesberg (https://www.themesberg.com)
9
10* Coded by https://themesberg.com
11
12=========================================================
13
14* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
15
16*/
17
18"use strict";
19
20$(document).ready(function () {
21
22    
23    // preloader
24    var $preloader = $('.preloader');
25    if($preloader.length) {
26        $preloader.delay(500).fadeOut('slow');
27    }
28
29    // options
30    var breakpoints = {
31        sm: 540,
32        md: 720,
33        lg: 960,
34        xl: 1140
35    };
36
37    var $navbarCollapse = $('.navbar-main .collapse');
38
39    // Collapse navigation
40    $navbarCollapse.on('hide.bs.collapse', function () {
41        var $this = $(this);
42        $this.addClass('collapsing-out');
43        $('html, body').css('overflow', 'initial');
44    });
45
46    $navbarCollapse.on('hidden.bs.collapse', function () {
47        var $this = $(this);
48        $this.removeClass('collapsing-out');
49    });
50
51    $navbarCollapse.on('shown.bs.collapse', function () {
52        $('html, body').css('overflow', 'hidden');
53    });
54
55    $('.navbar-main .dropdown').on('hide.bs.dropdown', function () {
56        var $this = $(this).find('.dropdown-menu');
57
58        $this.addClass('close');
59
60        setTimeout(function () {
61            $this.removeClass('close');
62        }, 200);
63
64    });
65
66    $(document).on('click', '.mega-dropdown', function (e) {
67        e.stopPropagation();
68    });
69
70    $(document).on('click', '.navbar-nav > .dropdown', function (e) {
71        e.stopPropagation();
72    });
73
74    $('.dropdown-submenu > .dropdown-toggle').click(function (e) {
75        e.preventDefault();
76        $(this).parent('.dropdown-submenu').toggleClass('show');
77    });
78
79    // Headroom - show/hide navbar on scroll
80    if ($('.headroom')[0]) {
81        var headroom = new Headroom(document.querySelector("#navbar-main"), {
82            offset: 0,
83            tolerance: {
84                up: 1,
85                down: 0
86            },
87        });
88        headroom.init();
89    }
90
91    // Background images for sections
92    $('[data-background]').each(function () {
93        $(this).css('background-image', 'url(' + $(this).attr('data-background') + ')');
94    });
95
96    $('[data-background-color]').each(function () {
97        $(this).css('background-color', $(this).attr('data-background-color'));
98    });
99
100    $('[data-color]').each(function () {
101        $(this).css('color', $(this).attr('data-color'));
102    });
103
104    // Datepicker
105    $('.datepicker')[0] && $('.datepicker').each(function () {
106        $('.datepicker').datepicker({
107            disableTouchKeyboard: true,
108            autoclose: false
109        });
110    });
111
112    // Tooltip
113    $('[data-toggle="tooltip"]').tooltip();
114
115    // Popover
116    $('[data-toggle="popover"]').each(function () {
117        var popoverClass = '';
118        if ($(this).data('color')) {
119            popoverClass = 'popover-' + $(this).data('color');
120        }
121        $(this).popover({
122            trigger: 'focus',
123            template: '<div class="popover ' + popoverClass + '" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>'
124        })
125    });
126
127    // Additional .focus class on form-groups
128    $('.form-control').on('focus blur', function (e) {
129        $(this).parents('.form-group').toggleClass('focused', (e.type === 'focus' || this.value.length > 0));
130    }).trigger('blur');
131
132    var e = document.querySelector('[data-toggle="price"]');
133    "undefined" != typeof CountUp && e && e.addEventListener("change", function(e) {
134        ! function(e) {
135            var t = e.target,
136                d = t.checked,
137                a = t.dataset.target,
138                o = document.querySelectorAll(a);
139            [].forEach.call(o, function(e) {
140                var t = e.dataset.annual,
141                    a = e.dataset.monthly,
142                    o = e.dataset.decimals ? e.dataset.decimals : null,
143                    n = e.dataset.duration ? e.dataset.duration : 1,
144                    r = e.dataset.options ? JSON.parse(e.dataset.options) : null,
145                    l = d ? new CountUp(e, t, a, o, n, r) : new CountUp(e, a, t, o, n, r);
146                l.error ? console.error(l.error) : l.start()
147            })
148        }(e)
149    })
150
151
152    // NoUI Slider
153    if ($(".input-slider-container")[0]) {
154        $('.input-slider-container').each(function () {
155
156            var slider = $(this).find('.input-slider');
157            var sliderId = slider.attr('id');
158            var minValue = slider.data('range-value-min');
159            var maxValue = slider.data('range-value-max');
160
161            var sliderValue = $(this).find('.range-slider-value');
162            var sliderValueId = sliderValue.attr('id');
163            var startValue = sliderValue.data('range-value-low');
164
165            var c = document.getElementById(sliderId),
166                d = document.getElementById(sliderValueId);
167
168            noUiSlider.create(c, {
169                start: [parseInt(startValue)],
170                connect: [true, false],
171                //step: 1000,
172                range: {
173                    'min': [parseInt(minValue)],
174                    'max': [parseInt(maxValue)]
175                }
176            });
177
178            c.noUiSlider.on('update', function (a, b) {
179                d.textContent = a[b];
180            });
181        })
182    }
183
184    $(".progress-bar").each(function () {
185        $(this).waypoint(function () {
186            var progressBar = $(".progress-bar");
187            progressBar.each(function (indx) {
188                $(this).css("width", $(this).attr("aria-valuenow") + "%");
189            });
190            $('.progress-bar').css({
191                animation: "animate-positive 3s",
192                opacity: "1"
193            });
194        }, {
195                triggerOnce: true,
196                offset: '60%'
197            });
198    });
199
200    // lightbox init
201    lightbox.option({
202        'resizeDuration': 200,
203        'wrapAround': true
204    });
205
206    //Owl Carousel
207    $('.testimonial-carousel').owlCarousel({
208        loop: true,
209        margin: 8,
210        nav: false,
211        dots: true,
212        responsive: {
213            0: {
214                items: 1
215            },
216            600: {
217                items: 1
218            },
219            1000: {
220                items: 1
221            }
222        },
223    });
224
225    // When in viewport
226    $('[data-toggle="on-screen"]')[0] && $('[data-toggle="on-screen"]').onScreen({
227        container: window,
228        direction: 'vertical',
229        doIn: function () {
230            //alert();
231        },
232        doOut: function () {
233            // Do something to the matched elements as they get off scren
234        },
235        tolerance: 200,
236        throttle: 50,
237        toggleClass: 'on-screen',
238        debug: false
239    });
240
241    // Scroll to anchor with scroll animation
242    $('[data-toggle="scroll"]').on('click', function (event) {
243        var hash = $(this).attr('href');
244        var offset = $(this).data('offset') ? $(this).data('offset') : 0;
245
246        // Animate scroll to the selected section
247        $('html, body').stop(true, true).animate({
248            scrollTop: $(hash).offset().top - offset
249        }, 600);
250
251        event.preventDefault();
252    });
253
254    //Rotating Cards
255    $(document).on('click', '.card-rotate .btn-rotate', function () {
256        var $rotating_card_container = $(this).closest('.rotating-card-container');
257
258        if ($rotating_card_container.hasClass('hover')) {
259            $rotating_card_container.removeClass('hover');
260        } else {
261            $rotating_card_container.addClass('hover');
262        }
263    });
264
265    //Countdown
266    $('#clock').countdown('2020/10/10').on('update.countdown', function (event) {
267        var $this = $(this).html(event.strftime(''
268            + '<span>%-w</span> week%!w '
269            + '<span>%-d</span> day%!d '
270            + '<span>%H</span> hr '
271            + '<span>%M</span> min '
272            + '<span>%S</span> sec'));
273    });
274
275    //Parallax
276    $('.jarallax').jarallax({
277        speed: 0.2
278    });
279
280    //Smooth scroll
281    var scroll = new SmoothScroll('a[href*="#"]', {
282        speed: 500,
283        speedAsDuration: true
284    });
285
286    // Equalize height to the max of the elements
287    if ($(document).width() >= breakpoints.lg) {
288
289        // object to keep track of id's and jQuery elements
290        var equalize = {
291            uniqueIds: [],
292            elements: []
293        };
294
295        // identify all unique id's
296        $('[data-equalize-height]').each(function () {
297            var id = $(this).attr('data-equalize-height');
298            if (!equalize.uniqueIds.includes(id)) {
299                equalize.uniqueIds.push(id)
300                equalize.elements.push({ id: id, elements: [] });
301            }
302        });
303
304        // add elements in order
305        $('[data-equalize-height]').each(function () {
306            var $el = $(this);
307            var id = $el.attr('data-equalize-height');
308            equalize.elements.map(function (elements) {
309                if (elements.id === id) {
310                    elements.elements.push($el);
311                }
312            });
313        });
314
315        // equalize
316        equalize.elements.map(function (elements) {
317            var elements = elements.elements;
318            if (elements.length) {
319                var maxHeight = 0;
320
321                // determine the larget height
322                elements.map(function ($element) {
323                    maxHeight = maxHeight < $element.outerHeight() ? $element.outerHeight() : maxHeight;
324                });
325
326                // make all elements with the same [data-equalize-height] value
327                // equal the larget height
328                elements.map(function ($element) {
329                    $element.height(maxHeight);
330                })
331            }
332        });
333    }
334
335    // update target element content to match number of characters
336    $('[data-bind-characters-target]').each(function () {
337        var $text = $($(this).attr('data-bind-characters-target'));
338        var maxCharacters = parseInt($(this).attr('maxlength'));
339        $text.text(maxCharacters);
340
341        $(this).on('keyup change', function (e) {
342            var string = $(this).val();
343            var characters = string.length;
344            var charactersRemaining = maxCharacters - characters;
345            $text.text(charactersRemaining);
346        })
347    });
348
349    // copy docs
350    $('.copy-docs').on('click', function () {
351        var $copy = $(this);
352        var htmlEntities = $copy.parents('.nav-wrapper').siblings('.card').find('.tab-pane:last-of-type').html();
353        var htmlDecoded = $('<div/>').html(htmlEntities).text().trim();
354
355        var $temp = $('<textarea>');
356        $('body').append($temp);
357        console.log(htmlDecoded);
358        $temp.val(htmlDecoded).select();
359        document.execCommand('copy');
360        $temp.remove();
361
362        $copy.text('Copied!');
363        $copy.addClass('copied');
364
365        setTimeout(function () {
366            $copy.text('Copy');
367            $copy.removeClass('copied');
368        }, 1000);
369    });
370
371    $('.current-year').text(new Date().getFullYear());
372
373});
374

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.