PageSourceSearch

https://calpe.pl/wp-content/themes/mesmerize/assets/js/theme.js?ver=1.2.1

js calpe.pl collected 2026-10-09 01:06:13 UTC 21,405 bytes, 711 lines download raw bytes

1(function ($) {
2    if ("ontouchstart" in window) {
3        document.documentElement.className = document.documentElement.className + " touch-enabled";
4    }
5    if (navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/i)) {
6        document.documentElement.className = document.documentElement.className + " no-parallax";
7    }
8
9    // animation frame interval;
10
11    var reqAnimFrame = (function () {
12        return window.requestAnimationFrame ||
13            window.webkitRequestAnimationFrame ||
14            window.mozRequestAnimationFrame ||
15            window.oRequestAnimationFrame ||
16            window.msRequestAnimationFrame || function (callback, element) {
17                window.setTimeout(callback, 1000 / 60);
18            };
19    })();
20
21
22    window.requestInterval = function (fn, delay, cancelFunction) {
23        if (!window.requestAnimationFrame &&
24            !window.webkitRequestAnimationFrame &&
25            !(window.mozRequestAnimationFrame && window.mozCancelRequestAnimationFrame) && // Firefox 5 ships without cancel support
26            !window.oRequestAnimationFrame &&
27            !window.msRequestAnimationFrame)
28            return window.setInterval(fn, delay);
29
30        var start = new Date().getTime(),
31            handle = {};
32
33
34        function loop() {
35            var current = new Date().getTime(),
36                delta = current - start;
37
38            if (delta >= delay) {
39                fn.call();
40                start = new Date().getTime();
41            }
42
43            handle.value = reqAnimFrame(loop);
44
45            if (delta >= delay && cancelFunction && cancelFunction.call() === true) {
46                clearRequestInterval(handle);
47            }
48        };
49
50        handle.value = reqAnimFrame(loop);
51
52
53        return handle;
54    };
55
56    window.clearRequestInterval = function (handle) {
57        window.cancelAnimationFrame ? window.cancelAnimationFrame(handle.value) :
58            window.webkitCancelAnimationFrame ? window.webkitCancelAnimationFrame(handle.value) :
59                window.webkitCancelRequestAnimationFrame ? window.webkitCancelRequestAnimationFrame(handle.value) : /* Support for legacy API */
60                    window.mozCancelRequestAnimationFrame ? window.mozCancelRequestAnimationFrame(handle.value) :
61                        window.oCancelRequestAnimationFrame ? window.oCancelRequestAnimationFrame(handle.value) :
62                            window.msCancelRequestAnimationFrame ? window.msCancelRequestAnimationFrame(handle.value) :
63                                clearInterval(handle);
64    };
65
66    if (!$.event.special.tap) {
67
68        $.event.special.tap = {
69            setup: function (data, namespaces) {
70                var $elem = $(this);
71                $elem.bind('touchstart', $.event.special.tap.handler)
72                    .bind('touchmove', $.event.special.tap.handler)
73                    .bind('touchend', $.event.special.tap.handler);
74            },
75
76            teardown: function (namespaces) {
77                var $elem = $(this);
78                $elem.unbind('touchstart', $.event.special.tap.handler)
79                    .unbind('touchmove', $.event.special.tap.handler)
80                    .unbind('touchend', $.event.special.tap.handler);
81            },
82
83            handler: function (event) {
84
85                var $elem = $(this);
86                $elem.data(event.type, 1);
87                if (event.type === 'touchend' && !$elem.data('touchmove')) {
88                    event.type = 'tap';
89                    $.event.handle.apply(this, arguments);
90                }
91                else if ($elem.data('touchend')) {
92                    $elem.removeData('touchstart touchmove touchend');
93                }
94            }
95        };
96
97    }
98
99    if (!$.fn.isInView) {
100        $.fn.isInView = function (fullyInView) {
101            var element = this;
102            var pageTop = $(window).scrollTop();
103            var pageBottom = pageTop + $(window).height();
104            var elementTop = $(element).offset().top;
105            var elementBottom = elementTop + $(element).height();
106
107            if (fullyInView === true) {
108                return ((pageTop < elementTop) && (pageBottom > elementBottom));
109            } else {
110                return ((elementTop <= pageBottom) && (elementBottom >= pageTop));
111            }
112        }
113    }
114
115
116    if (!$.throttle) {
117        $.throttle = function (fn, threshhold, scope) {
118            threshhold || (threshhold = 250);
119            var last,
120                deferTimer;
121            return function () {
122                var context = scope || this;
123
124                var now = +new Date,
125                    args = arguments;
126                if (last && now < last + threshhold) {
127                    // hold on to it
128                    clearTimeout(deferTimer);
129                    deferTimer = setTimeout(function () {
130                        last = now;
131                        fn.apply(context, args);
132                    }, threshhold);
133                } else {
134                    last = now;
135                    fn.apply(context, args);
136                }
137            };
138        }
139    }
140
141
142    if (!$.debounce) {
143        $.debounce = function (func, wait, immediate) {
144            var timeout;
145            return function () {
146                var context = this, args = arguments;
147                var later = function () {
148                    timeout = null;
149                    if (!immediate) func.apply(context, args);
150                };
151                var callNow = immediate && !timeout;
152                clearTimeout(timeout);
153                timeout = setTimeout(later, wait);
154                if (callNow) func.apply(context, args);
155            };
156        }
157    }
158
159
160})(jQuery);
161
162
163(function ($) {
164    if (!window.mesmerize_smooth_scroll || !window.mesmerize_smooth_scroll.enabled) {
165        return;
166    }
167
168    var goUp = true;
169    var end = null;
170    var interval = null;
171    var animationInterval = 10; //lower is faster
172    var steps = 10; //lower is faster
173    var distance = 100;
174    var step = 0;
175
176    function handle(delta) {
177
178        delta = Math.sign(delta) * parseInt(Math.min(Math.abs(delta, 10))); // normalize delta
179        if (end === null) {
180            end = $(window).scrollTop();
181        }
182
183        end -= distance * delta;
184        goUp = delta > 0;
185
186        $('body').on('mousedown.wheelscroll', 'a', function (event) {
187            if (interval) {
188                clearRequestInterval(interval);
189                interval = null;
190                end = null;
191                $('body').off('mousedown.wheelscroll');
192            }
193        });
194
195        function updateScroll() {
196            var scrollTop = $(window).scrollTop();
197            step = Math.round((end - scrollTop) / steps);
198            $(window).scrollTop(scrollTop + step);
199        }
200
201        function cancelInterval() {
202            var scrollTop = $(window).scrollTop();
203            if (
204                (scrollTop <= 0 && goUp) || scrollTop >= $(window).prop("scrollHeight") - $(window).height() ||
205                (goUp && step > -1) || (!goUp && step < 1)
206            ) {
207
208                interval = null;
209                end = null;
210                return true;
211            }
212            return false;
213        }
214
215        if (interval === null) {
216            interval = requestInterval(updateScroll, animationInterval, cancelInterval)
217        }
218    }
219
220    function wheel(event) {
221
222        var delta = 0;
223        if (event.wheelDelta) delta = event.wheelDelta / 120;
224        else if (event.detail) delta = -event.detail / 3;
225
226        if (window.scrollY === 0 && delta > 0) { // do nothing when scrolling to top and already there
227            return true;
228        }
229
230        if (((window.innerHeight + window.scrollY) >= document.body.offsetHeight) && delta < 0) { // do nothing when scrolling to bottom and already there
231            return true;
232        }
233
234        handle(delta);
235        if (event.preventDefault) event.preventDefault();
236        event.returnValue = false;
237    }
238
239    $(window).load(function (event) {
240        if (window.addEventListener) window.addEventListener('DOMMouseScroll', wheel, false);
241        window.onmousewheel = document.onmousewheel = wheel;
242    });
243
244})(jQuery);
245
246
247jQuery(document).ready(function ($) {
248
249    if (window.mesmerize_backstretch) {
250
251        window.mesmerize_backstretch.duration = parseInt(window.mesmerize_backstretch.duration);
252        window.mesmerize_backstretch.transitionDuration = parseInt(window.mesmerize_backstretch.transitionDuration);
253
254        var images = mesmerize_backstretch.images;
255
256        if (!images) {
257            return;
258        }
259
260        jQuery('.header-homepage, .header').backstretch(images, mesmerize_backstretch);
261    }
262
263
264    var masonry = $(".post-list.row");
265
266    var images = masonry.find('img');
267    var loadedImages = 0;
268
269    function imageLoaded() {
270        loadedImages++;
271        if (images.length === loadedImages && masonry.data().masonry) {
272            masonry.data().masonry.layout();
273        }
274    }
275
276    images.each(function () {
277        $(this).on('load', imageLoaded);
278    });
279
280
281    var items = $(".post-list.row .post-list-item");
282    var index = items.length - 1;
283    items.each(function () {
284        $(this).css({
285            width: $(this).css('max-width')
286        })
287    });
288    if (masonry.length) {
289        masonry.masonry({
290            itemSelector: '.post-list-item',
291            percentPosition: true,
292            columnWidth: '.' + items.eq(index).attr('data-masonry-width')
293        });
294    }
295
296    if ($.fn.smoothScrollAnchor) {
297        var _$body = $('body');
298        $('.header-homepage-arrow-c .header-homepage-arrow').smoothScrollAnchor({
299            target: _$body.find('[data-id]').length ? _$body.find('[data-id]').first() : _$body.find('.page-content, .content').eq(0),
300            targetSel: _$body.find('[data-id]').length ? '[data-id]:first' : '.page-content, .content',
301            offset: function () {
302                var $fixed = $('.navigation-bar.fixto-fixed');
303                if ($fixed.length) {
304                    return $fixed[0].getBoundingClientRect().height;
305                }
306
307                return 0;
308            }
309        });
310    }
311
312    // logo inside menu ME fix
313    $('.navigation-bar.logo-inside-menu #main_menu > .logo').each(function () {
314        $(this).css('width', $(this).find('.text-logo').outerWidth() + 32);
315    });
316
317});
318
319
320(function ($) {
321
322    function toggleFooter() {
323        var footerTop = footer.offset().top + footer.outerHeight();
324        var pageBottom = pageContent.offset().top + pageContent.height();
325
326        if (footerTop >= pageBottom) {
327            footer.css('visibility', 'visible');
328        } else {
329            footer.css('visibility', '');
330        }
331    }
332
333    function updateFooter() {
334        pageContent.css("margin-bottom", footer.outerHeight() - 1);
335        toggleFooter();
336    }
337
338    var footer = $('.footer.paralax');
339
340    if (footer.length) {
341        if (footer.parents('.no-parallax').length) {
342            footer.css('visibility', 'visible');
343            return;
344        }
345
346        $('.header-wrapper').css('z-index', 1);
347
348        var pageContent = footer.prev();
349        pageContent.addClass('footer-shadow');
350        pageContent.css({
351            'position': 'relative',
352            'z-index': 1
353        });
354
355        jQuery(window).resize(function (e) {
356            updateFooter();
357        });
358
359        jQuery(document).ready(function () {
360            window.setTimeout(function () {
361                updateFooter();
362            }, 100);
363        })
364
365        updateFooter();
366
367        $(window).on('scroll', function () {
368            toggleFooter();
369        });
370    }
371
372
373})(jQuery);
374
375(function ($) {
376
377    var morphed = $("[data-text-effect]");
378    if ($.fn.typed && morphed.length && JSON.parse(mesmerize_morph.header_text_morph)) {
379        morphed.each(function () {
380            $(this).empty();
381            $(this).typed({
382                strings: JSON.parse($(this).attr('data-text-effect')),
383                typeSpeed: parseInt(mesmerize_morph.header_text_morph_speed),
384                loop: true
385            });
386
387        });
388    }
389})(jQuery);
390
391// OffScreen Menu
392
393(function ($) {
394    var $menus = $('.offcanvas_menu');
395    var $offCanvasWrapper = $('#offcanvas-wrapper');
396
397    if ($offCanvasWrapper.length) {
398        $('html').addClass('has-offscreen');
399        $offCanvasWrapper.appendTo('body');
400
401
402        $offCanvasWrapper.on('kube.offcanvas.ready', function () {
403            $offCanvasWrapper.removeClass('force-hide');
404        });
405
406
407        $offCanvasWrapper.on('kube.offcanvas.open', function () {
408            $('html').addClass('offcanvas-opened');
409        });
410
411
412        $offCanvasWrapper.on('kube.offcanvas.close', function () {
413            $('html').removeClass('offcanvas-opened')
414        });
415    }
416
417
418    $menus.each(function () {
419
420        var $menu = $(this);
421
422        $menu.on('mesmerize.open-all', function () {
423            $(this).find('.menu-item-has-children, .page_item_has_children').each(function () {
424                $(this).addClass('open');
425                $(this).children('ul').slideDown(100);
426            });
427        });
428
429        $menu.find('.menu-item-has-children a, .page_item_has_children a').each(function () {
430            if ($(this).children('i.fa.arrow').length === 0) {
431                $(this).append('<i class="fa arrow"></i>');
432
433            }
434        });
435
436        $menu.on('click', '.menu-item-has-children > a, .page_item_has_children > a', function (event) {
437            var $this = $(this);
438            var $li = $this.closest('li');
439            event.stopPropagation();
440
441            if ($li.children('ul').length === 0) {
442                return true;
443            }
444
445            if ($li.hasClass('open')) {
446                if ($this.is('a')) {
447                    return true;
448                }
449                $li.children('ul').slideUp(100, function () {
450                    $li.find('ul').each(function () {
451                        $(this).parent().removeClass('open');
452                        $(this).css('display', 'none');
453                    })
454                });
455            } else {
456                $li.children('ul').slideDown(100);
457            }
458
459            $li.toggleClass('open');
460
461            event.preventDefault();
462
463        });
464
465        $menu.on('click tap', '.mesmerize-menu-cart', function (event) {
466            event.stopPropagation();
467        });
468
469        $menu.on('click tap', '.menu-item-has-children > a > .arrow, .page_item_has_children  > a > .arrow', function (event) {
470            var $this = $(this);
471            var $li = $this.closest('li');
472            event.stopPropagation();
473            event.preventDefault();
474            $li.toggleClass('open');
475
476            if ($li.hasClass('open')) {
477                $li.children('ul').slideDown(100);
478            } else {
479                $li.children('ul').slideUp(100);
480            }
481        });
482
483        if ($.fn.scrollSpy) {
484            $menu.find('a').scrollSpy({
485                onChange: function () {
486                    $menu.find('.current-menu-item,.current_page_item').removeClass('current-menu-item current_page_item');
487                    $(this).closest('li').addClass('current-menu-item');
488                },
489                onLeave: function () {
490                    $(this).closest('li').removeClass('current-menu-item current_page_item');
491                },
492                smoothScrollAnchor: true,
493                offset: function () {
494                    if ($('.navigation-bar.fixto-fixed').length) {
495                        return $('.navigation-bar.fixto-fixed')[0].getBoundingClientRect().height;
496                    }
497
498                    return 0;
499                }
500            });
501        }
502
503    });
504
505
506    if ($.fn.smoothScrollAnchor) {
507        $('#page > .page-content > .content, #page >  .content').find('a[data-cp-link]').filter(function () {
508            var $el = $(this);
509
510            if ($el.is('[role=tab]') || $el.parent().is('[role=tab]')) {
511                return false;
512            }
513
514            return true;
515
516        }).smoothScrollAnchor();
517
518
519        $('#page > .footer').find('a').filter(function () {
520            var $el = $(this);
521
522            if ($el.is('[role=tab]') || $el.parent().is('[role=tab]')) {
523                return false;
524            }
525            return true;
526
527        }).smoothScrollAnchor();
528    }
529})(jQuery);
530
531
532(function ($) {
533
534
535    function updateCounterCircle($el) {
536        var $valueHolder = $el.find('[data-countup]');
537        var val = $valueHolder.text();
538        val = jQuery.map(val.match(/[-]{0,1}[s\d.]*[\d]+/g), function (x) {
539            return x
540        }).join([]);
541
542        var max = $valueHolder.attr('data-max') !== undefined ? $valueHolder.attr('data-max') : 100;
543        var min = $valueHolder.attr('data-min') !== undefined ? $valueHolder.attr('data-min') : 0;
544
545        if (min > max) {
546            var aux = max;
547            max = min;
548            min = aux;
549        }
550
551        if (!val) {
552            val = min;
553        }
554
555        var percentage = val / max * 100;
556
557        var $circle = $el.find('.circle-bar');
558        var r = $circle.attr('r');
559        var c = Math.PI * (r * 2);
560
561        if (percentage < 0) {
562            percentage = 0;
563        }
564        if (percentage > 100) {
565            percentage = 100;
566        }
567        var pct = c * (100 - percentage) / 100;
568        $circle.css({strokeDashoffset: pct});
569
570        $(function () {
571            if (!wp || !wp.customize) {
572                $circle.parent().height($circle.parent().width());
573            }
574        });
575    }
576
577    function initCounterCircle($circle) {
578        updateCounterCircle($circle);
579
580
581        $circle.find('[data-countup]').bind('countup.update', function () {
582            updateCounterCircle($circle);
583        });
584
585        // $circle.find('[data-countup]').bind('DOMSubtreeModified', updateCircleOnDOMSubtreeModified);
586
587        $circle.data('doCircle', function () {
588            updateCounterCircle($circle);
589        });
590    }
591
592    function initCountUP($self, force) {
593        var min = $self.attr('data-min') !== undefined ? $self.attr('data-min') : 0,
594            stopAt = $self.attr('data-stop'),
595            max = $self.attr('data-max') !== undefined ? $self.attr('data-max') : 100,
596            prefix = $self.attr('data-prefix') || "",
597            suffix = $self.attr('data-suffix') || "",
598            duration = $self.attr('data-duration') || 2000,
599            decimals = $self.attr('data-decimals') || 0;
600
601        if (stopAt !== undefined) {
602            max = stopAt;
603        }
604
605        var formattedMax = '';
606
607        try {
608            var counter = new CountUp($self[0], parseInt(min), parseInt(max), parseInt(decimals), parseInt(duration) / 1000, {
609                prefix: prefix,
610                suffix: suffix,
611                onUpdate: function (value) {
612                    $self.trigger('countup.update', [value]);
613                }
614            });
615
616            formattedMax = counter.options.formattingFn(parseInt(max));
617        } catch (e) {
618            console.error('invalid countup args', {
619                min: min,
620                max: max,
621                decimals: decimals,
622                duration: duration,
623                suffix: suffix,
624                prefix: prefix
625            });
626        }
627
628        $self.data('countup', counter);
629
630
631        $self.attr('data-max-computed', formattedMax);
632
633        if (force) {
634            $self.data('countup').reset();
635        }
636
637        if ($self.isInView(true) || force) {
638            $self.data('countup').start();
639        }
640
641        $self.data('restartCountUp', function () {
642            initCountUP($self);
643        })
644    }
645
646
647    $('.circle-counter').each(function () {
648        initCounterCircle($(this));
649    });
650
651    var $countUPs = $('[data-countup]');
652
653    $countUPs.each(function () {
654        var $self = $(this);
655        initCountUP($self);
656    });
657
658    $(window).on('scroll', function () {
659        $countUPs.each(function () {
660            var $self = $(this);
661
662            if ($self.isInView(true) && !$self.data('one')) {
663                $self.data('countup').start();
664                $self.data('one', true);
665            } else {
666                // $self.data('countup').reset();
667            }
668
669        });
670    });
671
672    $(function () {
673        if (!wp || !wp.customize) {
674            $(window).on('resize', function () {
675                $('.circle-counter .circle-svg').each(function () {
676                    $(this).height($(this).width());
677                });
678
679            });
680        }
681    });
682
683
684    // customizer binding
685
686    if (parent.CP_Customizer) {
687        parent.CP_Customizer.addModule(function (CP_Customizer) {
688            CP_Customizer.hooks.addAction('after_node_insert', function ($node) {
689                if ($node.is('[data-countup]')) {
690
691                    if ($node.closest('.circle-counter').length) {
692                        initCounterCircle($node.closest('.circle-counter'));
693                    }
694
695                    initCountUP($node, true);
696                }
697
698                $node.find('[data-countup]').each(function () {
699
700                    if ($(this).closest('.circle-counter').length) {
701                        initCounterCircle($(this).closest('.circle-counter'));
702                    }
703
704                    initCountUP($(this), true);
705                })
706            });
707        });
708    }
709
710})(jQuery);
711

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.