PageSourceSearch

https://worlddieselservices.com/wp-content/themes/marketo/assets/js/main.js?ver=1790493980

js worlddieselservices.com collected 2026-09-27 07:27:37 UTC 25,981 bytes, 712 lines download raw bytes

1(function ($) {
2    "use strict";
3
4    /*------------------------------------------------------------------
5     [Table of contents]
6
7     mega navigation menu init
8     back to top
9     twitter api init
10     map popups
11     single banner slider
12     xs tab slider
13     xs tab slider 6 col
14     xs deal of the day
15     xs product slider 1
16     xs product slider 2
17     xs product slider 3
18     deal of the day
19     product slider 4
20     product slider 5
21     product slider 6
22     product slider 7
23     organic product slider 8
24     organic product slider 9
25     organic product slider 10
26     product slider 11
27     product slider 12
28     product slider 13
29     seven column slider
30     xs progress
31     input number increase
32     echo init
33     pulse effect
34     countdown timer
35     ajax chimp init
36     xs popover
37     number percentage
38     number counter up
39
40     -------------------------------------------------------------------*/
41
42    /*==========================================================
43     4. custom input type select function
44     ======================================================================*/
45
46    $.fn.mySelect = function (options) {
47        let $this = $(this),
48            numberOfOptions = $(this).children('option');
49
50        $this.addClass('select-hidden');
51        $this.wrap('<div class="select"></div>');
52        $this.after('<div class="select-styled"></div>');
53
54        let styledSelect = $this.next('.select-styled');
55        styledSelect.text($this.children('option').eq(0).text());
56
57        let list = $('<ul />', {
58            'class': 'select-options'
59        }).insertAfter(styledSelect);
60
61        for (let i = 0; i < numberOfOptions.length; i++) {
62            $('<li />', {
63                text: $this.children('option').eq(i).text(),
64                rel: $this.children('option').eq(i).val(),
65                class: $(numberOfOptions[i]).attr('class')
66            }).appendTo(list);
67        }
68
69        let listItems = list.children('li');
70
71        styledSelect.on('click', function (e) {
72            e.stopPropagation();
73            $('.select-styled.active').not(this).each(function () {
74                $(this).removeClass('active').next('.select-options').fadeIn();
75            });
76            $(this).toggleClass('active').next('.select-options').toggle();
77            $(this).parent().toggleClass('focus');
78        });
79
80        listItems.on('click', function (e) {
81            e.stopPropagation();
82            styledSelect.text($(this).text()).removeClass('active');
83            $this.val($(this).attr('rel'));
84            list.hide();
85            if ($(this).parent().parent().hasClass('focus')) {
86                $(this).parent().parent().removeClass('focus');
87            }
88        });
89
90        $(document).on('click', function () {
91            styledSelect.removeClass('active');
92            list.hide();
93        });
94    }
95
96    if ($('.xs-category-select').length > 0) {
97        $('.xs-category-select').mySelect();
98    }
99    if ($('.serach-form').length > 0) {
100        var filed = $('.serach-form');
101        filed.each(function () {
102            $(filed).on('focus', function () {
103                $(this).parent().addClass('focus');
104            })
105            $(filed).on('blur', function () {
106                $(this).parent().removeClass('focus');
107            })
108        })
109    }
110    if ($('.xs-category-select2').length > 0) {
111        $('.xs-category-select2').mySelect();
112    }
113
114    $.fn.myOwl = function (options) {
115
116        var settings = $.extend({
117            items: 1,
118            dots: false,
119            loop: false,
120            mouseDrag: true,
121            touchDrag: true,
122            nav: false,
123            autoplay: true,
124            navText: ['', ''],
125            margin: 0,
126            stagePadding: 0,
127            autoplayTimeout: 5000,
128            autoplayHoverPause: true,
129            animateOut: 'fadeOut',
130            animateIn: 'fadeIn',
131            navRewind: false,
132            responsive: {}
133        }, options);
134
135        return this.owlCarousel({
136            items: settings.items,
137            loop: settings.loop,
138            mouseDrag: settings.mouseDrag,
139            touchDrag: settings.touchDrag,
140            nav: settings.nav,
141            navText: settings.navText,
142            dots: settings.dots,
143            margin: settings.margin,
144            stagePadding: settings.stagePadding,
145            autoplay: settings.autoplay,
146            autoplayTimeout: settings.autoplayTimeout,
147            autoplayHoverPause: settings.autoplayHoverPause,
148            animateOut: settings.animateOut,
149            animateIn: settings.animateIn,
150            responsive: settings.responsive,
151            navRewind: settings.navRewind,
152            onTranslate: function () {
153                echo.render();
154            }
155        });
156    };
157
158
159
160    // menu vertical open and close when cross break point
161    function menuVertical() {
162        var window_width = $(window).width(),
163            breakPoint = 991,
164            dropDonw_tigger = $('.v-menu-is-active .xs-dropdown-trigger'),
165            dropdown = $('.v-menu-is-active .cd-dropdown'),
166            activeClass = 'dropdown-is-active';
167
168        if (window_width <= breakPoint) {
169            if (dropDonw_tigger.hasClass(activeClass)) {
170                dropDonw_tigger.removeClass(activeClass);
171            }
172            if (dropdown.hasClass(activeClass)) {
173                dropdown.removeClass(activeClass);
174            }
175        } else {
176            dropDonw_tigger.addClass(activeClass);
177            dropdown.addClass(activeClass);
178        }
179    }
180
181    function innerPageBreadcumb() {
182        let promotion = $('.xs-promotion'),
183            transparentHeader = $('.header-transparent'),
184            totalHeight = Math.floor(promotion.outerHeight(true) + transparentHeader.outerHeight(true));
185
186        $('.header-transparent + .xs-breadcumb').css('margin-top', totalHeight);
187
188        $('.header-transparent ~ .page .xs-transparent').css('margin-top', totalHeight);
189        $('.header-transparent + .xs-breadcumb + .page .xs-transparent').css('margin-top', 0);
190
191    }
192
193
194
195    function mobileMenu() {
196        let header = $('.xs-header');
197        if ($(window).width() <= 991) {
198            $(header).addClass('mobile-menu')
199        } else {
200            if ($(header).hasClass('mobile-menu')) {
201                $(header).removeClass('mobile-menu')
202            }
203        }
204    }
205    var firstState = 'large';
206    function headerRemove() {
207        // var winW = $( window ).width();
208        // if ( winW <= 991 ) {
209        //     firstState = 'small';
210        //     $( '.xs-header' ).remove();
211        //     $( '.display-4' ).remove()
212        // }
213        // if ( winW >= 992 ) {
214        //     if ( $( '.xs-header' ).length < 1 && firstState == 'small' && $( '.display-4' ).length < 1 ) {
215        //         $( 'body' ).prepend( '<p class="text-center display-4">Please Reload Your browser. If you would like to see nav bar.</p>' );
216        //     }
217        // }
218    }
219
220    // nav cover add remoe
221    let navCover = () => {
222        $(window).width() <= 1023 ? $('.nav-cover').remove() : $('.xs-header').append('<div class="nav-cover"></div>');
223    };
224
225
226    $(window).on('load', function () {
227        // menu vertical open and close when cross break point
228        menuVertical();
229
230
231        mobileMenu();
232
233        headerRemove();
234
235        // nav cover init
236		navCover();
237
238        innerPageBreadcumb();
239        if ($('.dokan-widget-area').length > 0) {
240            console.log('test');
241            $('.dokan-widget-area').addClass('sidebar');
242        }
243
244
245        /* banner slider verison 5 push bootstrap markup */
246        $('.xs-banner-slider-5 .owl-dots').wrap('<div class="container container-fullwidth"><div class="row"><div class="col-md-9 offset-md-3"></div></div></div>');
247
248        if ($('.marketo-xs-header-5').length > 0) {
249            if ($('.xs-header').hasClass('marketo-xs-header-5')) {
250                $('body').addClass('xs-header-5');
251            } else {
252                $('body').removeClass('xs-header-5');
253            }
254        }
255    }); // END load Function
256
257    $(document).ready(function () {
258        // menu vertical open and close when cross break point
259        menuVertical();
260
261        innerPageBreadcumb();
262
263
264        mobileMenu();
265
266        headerRemove();
267
268        /*Product Timer*/
269        $('.xs-countdown-timer[data-countdown]').each(function () {
270            var $this = $(this),
271                finalDate = $(this).data('countdown');
272            $this.countdown(finalDate, function (event) {
273                var $this = $(this).html(event.strftime(' '
274                    + '<div class="xs-timer-container"><span class="timer-count">%-D </span><span class="timer-title">' + xs_product_timers.xs_date + '</span></div>'
275                    + '<div class="xs-timer-container"><span class="timer-count">%H </span><span class="timer-title">' + xs_product_timers.xs_hours + '</span></div>'
276                    + '<div class="xs-timer-container"><span class="timer-count">%M </span><span class="timer-title">' + xs_product_timers.xs_minutes + '</span></div>'
277                    + '<div class="xs-timer-container"><span class="timer-count">%S </span><span class="timer-title">' + xs_product_timers.xs_secods + '</span></div>'));
278            });
279        });
280
281        /*==========================================================
282         mega navigation menu init
283         ======================================================================*/
284        if ($('.xs-menus').length > 0) {
285            $('.xs-menus').xs_nav({
286                mobileBreakpoint: 992,
287            });
288        }
289        $('.xs-menus').find('.elementor-swiper-button-prev, .elementor-swiper-button-next').on('click', function (e) {
290            e.stopPropagation();
291        });
292        if ($('.nav-hidden-menu').length > 0) {
293            $('.nav-hidden-menu').xs_nav({
294                hidden: true
295            });
296            $(".btn-show").on('click', function () {
297                $(".nav-hidden-menu").data("xs_nav").toggleOffcanvas();
298            });
299        }
300
301        /*==========================================================
302         back to top
303         ======================================================================*/
304        $(document).on('click', '.xs-back-to-top', function (event) {
305            event.preventDefault();
306            /* Act on the event */
307
308            $('html, body').animate({
309                scrollTop: 0,
310            }, 1000);
311        });
312
313        //This is for myaccount center or
314        $('.u-columns.col2-set').append('<p class="form-separetor account-form-or">' + xs_product_timers.xs_acc_or + '</p>');
315
316
317        /*==========================================================
318         xs progress
319         ======================================================================*/
320        if ($('.xs-progress').length > 0) {
321            $('.xs-progress').each(function () {
322                $(this).find('.progress-bar').css({
323                    width: $(this).find('.progress-bar').attr('aria-valuenow') + '%',
324                });
325            });
326        }
327
328        $('.rate-graph').each(function () {
329            if ($(this).find('.rate-graph-bar').attr('data-percent') <= 100) {
330                $(this).find('.rate-graph-bar').css({
331                    width: $(this).find('.rate-graph-bar').attr('data-percent') + '%',
332                });
333            } else {
334                $(this).find('.rate-graph-bar').css({
335                    width: 100 + '%',
336                });
337            }
338        });
339
340        /*=============================================================
341         input number increase
342         =========================================================================*/
343        if (!String.prototype.getDecimals) {
344            String.prototype.getDecimals = function () {
345                var num = this,
346                    match = ('' + num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
347                if (!match) {
348                    return 0;
349                }
350                return Math.max(0, (match[1] ? match[1].length : 0) - (match[2] ? +match[2] : 0));
351            }
352        }
353        $(document).on('click', '.plus, .minus', function () {
354            // Get values
355            var $qty = $(this).closest('.quantity').find('.qty'),
356                currentVal = parseFloat($qty.val()),
357                max = parseFloat($qty.attr('max')),
358                min = parseFloat($qty.attr('min')),
359                step = $qty.attr('step');
360
361            // Format values
362            if (!currentVal || currentVal === '' || currentVal === 'NaN')
363                currentVal = 0;
364            if (max === '' || max === 'NaN')
365                max = '';
366            if (min === '' || min === 'NaN')
367                min = 0;
368            if (step === 'any' || step === '' || step === undefined || parseFloat(step) === 'NaN')
369                step = 1;
370
371            // Change the value
372            if ($(this).is('.plus')) {
373                if (max && (currentVal >= max)) {
374                    $qty.val(max);
375                } else {
376                    $qty.val((currentVal + parseFloat(step)).toFixed(step.getDecimals()));
377                }
378            } else {
379                if (min && (currentVal <= min)) {
380                    $qty.val(min);
381                } else if (currentVal > 0) {
382                    $qty.val((currentVal - parseFloat(step)).toFixed(step.getDecimals()));
383                }
384            }
385
386            // Trigger change event
387            $qty.trigger('change');
388        });
389
390        /*==========================================================
391         echo init
392         ======================================================================*/
393        echo.init({
394            offset: 100,
395            throttle: 100,
396            unload: false,
397        });
398
399        if ($('.xs-nav-tab li a').length > 0) {
400            $('.xs-nav-tab li a').on('click', function () {
401                echo.render();
402            });
403        }
404
405        /*==========================================================
406         ajax chimp init
407         ======================================================================*/
408        if ($('.xs-newsletter').length > 0) {
409            var mailchimp_url = $('.xs-newsletter').data('link');
410            $('.xs-newsletter').ajaxChimp({
411                url: mailchimp_url
412            });
413
414        }
415
416        /*==========================================================
417         xs popover
418         ======================================================================*/
419        if ($('.btn[data-toggle="popover"]').length > 0) {
420            // popover init
421            $('.btn[data-toggle="popover"]').popover();
422            // popover add class
423            $('.btn[data-toggle="popover"]').on('click', function (e) {
424                e.preventDefault();
425                if ($(this).hasClass('is-active')) {
426                    $(this).removeClass('is-active');
427                } else {
428                    $(this).addClass('is-active')
429                }
430            });
431        }
432
433        /*==========================================================
434         number percentage
435         =======================================================================*/
436        var number_percentage = $(".number-percentage");
437
438        function animateProgressBar() {
439            number_percentage.each(function () {
440                $(this).animateNumbers($(this).attr("data-value"), true, parseInt($(this).attr("data-animation-duration"), 10));
441            });
442        }
443
444        if ($('.waypoint-tigger').length > 0) {
445            var waypoint = new Waypoint({
446                element: document.getElementsByClassName('waypoint-tigger'),
447                handler: function (direction) {
448                    animateProgressBar();
449                },
450                offset: '50%'
451
452            });
453        }
454
455        /*==========================================================
456         number counter up
457         =======================================================================*/
458        $.fn.animateNumbers = function (stop, commas, duration, ease) {
459            return this.each(function () {
460                var $this = $(this);
461                var start = parseInt($this.text().replace(/,/g, ""), 10);
462                commas = (commas === undefined) ? true : commas;
463                $({
464                    value: start
465                }).animate({
466                    value: stop
467                }, {
468                        duration: duration == undefined ? 500 : duration,
469                        easing: ease == undefined ? "swing" : ease,
470                        step: function () {
471                            $this.text(Math.floor(this.value));
472                            if (commas) {
473                                $this.text($this.text().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,"));
474                            }
475                        },
476                        complete: function () {
477                            if (parseInt($this.text(), 10) !== stop) {
478                                $this.text(stop);
479                                if (commas) {
480                                    $this.text($this.text().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,"));
481                                }
482                            }
483                        }
484                    });
485            });
486        };
487
488        $('.tigger-icon').on('click', function (event) {
489            event.preventDefault();
490            /* Act on the event */
491            var this_item = $('.xs-social-tigger');
492            if (this_item.hasClass('active')) {
493                this_item.removeClass('active');
494            } else {
495                this_item.addClass('active');
496            }
497        });
498
499        /*=============================================================
500         sync slider
501         =========================================================================*/
502
503        if (($('.sync-slider-preview').length > 0) && ($('.sync-slider-thumb').length > 0)) {
504            var sync1 = $(".sync-slider-preview"),
505                sync2 = $(".sync-slider-thumb"),
506                slidesPerPage = 3,
507                syncedSecondary = true;
508            sync1.owlCarousel({
509                items: 1,
510                slideSpeed: 2000,
511                nav: false,
512                autoplay: true,
513                dots: false,
514                loop: true,
515                responsiveRefreshRate: 200,
516                navText: [''],
517            }).on('changed.owl.carousel', syncPosition);
518            sync2
519                .on('initialized.owl.carousel', function () {
520                    sync2.find(".owl-item").eq(0).addClass("current");
521                })
522                .owlCarousel({
523                    items: slidesPerPage,
524                    dots: false,
525                    nav: false,
526                    smartSpeed: 200,
527                    slideSpeed: 500,
528                    margin: 30,
529                    slideBy: slidesPerPage, //alternatively you can slide by 1, this way the active slide will stick to the first item in the second carousel
530                    responsiveRefreshRate: 100,
531                    responsive: {
532                        // breakpoint from 0 up
533                        0: {
534                            items: 2,
535                        },
536                        1024: {
537                            items: 3,
538                        }
539                    }
540                }).on('changed.owl.carousel', syncPosition2);
541
542            function syncPosition(el) {
543                //if you set loop to false, you have to restore this next line
544                //var current = el.item.index;
545
546                //if you disable loop you have to comment this block
547                var count = el.item.count - 1;
548                var current = Math.round(el.item.index - (el.item.count / 2) - .5);
549                if (current < 0) {
550                    current = count;
551                }
552                if (current > count) {
553                    current = 0;
554                }
555
556                //end block
557
558                sync2
559                    .find(".owl-item")
560                    .removeClass("current")
561                    .eq(current)
562                    .addClass("current");
563                var onscreen = sync2.find('.owl-item.active').length - 1;
564                var start = sync2.find('.owl-item.active').first().index();
565                var end = sync2.find('.owl-item.active').last().index();
566                if (current > end) {
567                    sync2.data('owl.carousel').to(current, 100, true);
568                }
569                if (current < start) {
570                    sync2.data('owl.carousel').to(current - onscreen, 100, true);
571                }
572            }
573
574            function syncPosition2(el) {
575                if (syncedSecondary) {
576                    var number = el.item.index;
577                    sync1.data('owl.carousel').to(number, 100, true);
578                }
579            }
580
581            sync2.on("click", ".owl-item", function (e) {
582                e.preventDefault();
583                var number = $(this).index();
584                sync1.data('owl.carousel').to(number, 300, true);
585            });
586        }
587
588        $('.offset-cart-menu').on('click', function (e) {
589            e.preventDefault();
590            $('.xs-sidebar-group').addClass('isActive');
591        });
592        $('.close-side-widget').on('click', function (e) {
593            e.preventDefault();
594            $('.xs-sidebar-group').removeClass('isActive');
595        });
596
597        $('.add_to_wishlist').on('click', function (e) {
598            $(this).parent().addClass("feid-in");
599        });
600
601        $('.xs-overlay').on('click', function () {
602            $('.xs-sidebar-group').removeClass('isActive');
603        });
604
605        $('.xs-sidebar-group').on('click', function (e) {
606            e.stopPropagation()
607        });
608
609        $('.navsearch-button').on('click', function (e) {
610            e.preventDefault();
611
612            if (!($('.navsearch-form')).is(":visible")) {
613                $(this).find('.xs-search-icon').removeClass('icon-search').addClass('icon-search-minus');
614            } else {
615                $(this).find('.xs-search-icon').removeClass('icon-search-minus').addClass('icon-search');
616            }
617            $(this).parent().parent().find('.navsearch-form').slideToggle(300);
618        });
619
620        $(document).on('click', 'body', function (e) {
621            $('.ajax-search-result').remove();
622        })
623        $(document).on('click', '.ajax-search-result, .xs-navbar-search', function (e) {
624            e.stopPropagation();
625        })
626        $('.xs-dropdown-trigger').on('click', function (e) {
627			e.stopPropagation();
628		});
629        $('body').on('click', '.nav-cover.dropdown-is-active', function () {
630            if ($('.nav-cover').hasClass('dropdown-is-active')) {
631				$('.nav-cover').removeClass('dropdown-is-active')
632				$('.xs-dropdown-trigger').removeClass('dropdown-is-active');
633				$('.cd-dropdown').removeClass('dropdown-is-active');
634			}
635        })
636        /*==========================================================
637                49. vertical menu dropdown tigger on click overlay active init
638        ======================================================================*/
639        if ($(window).width() >= 1024) {
640            if ($('.xs-dropdown-trigger').length > 0) {
641                $('.xs-dropdown-trigger').on('click', function () {
642                    if ($('.nav-cover').hasClass('dropdown-is-active')) {
643                        $('.nav-cover').removeClass('dropdown-is-active');
644                    } else {
645                        $('.nav-cover').addClass('dropdown-is-active');
646                    }
647                });
648            }
649        }
650
651        if ($('.elementskit-navbar-nav-default .ekit-menu-badge-arrow').length > 0) {
652            $('.elementskit-navbar-nav-default .ekit-menu-badge-arrow').each(function () {
653                var top_color = $(this).attr("style");
654                var left_color = top_color.replace("border-top-color:", "");
655                $(this).css({
656                    "border-left-color": left_color
657                })
658            });
659        }
660
661    }); // end ready function
662
663    $(window).on('scroll', function () {
664
665    }); // END Scroll Function
666
667    $(window).on('resize', function () {
668
669        innerPageBreadcumb();
670
671        // menu vertical open and close when cross break point
672        menuVertical();
673
674
675        mobileMenu();
676
677        headerRemove()
678    }); // End Resize
679
680    // shop filter
681    var xs_notic_wrapper = $('.post-type-archive-product .woocommerce-notices-wrapper');
682    xs_notic_wrapper.remove();
683    $('.post-type-archive-product .xs-shop-notice').append(xs_notic_wrapper);
684    var ordaring = $('.post-type-archive-product .before-default-sorting');
685    ordaring.remove();
686    $('.post-type-archive-product .woocommerce-ordering').prepend(ordaring);
687
688    //  shop page list view
689    $(document).on('click', '#list-tab', function () {
690        $(this).parents('.woocommerce-products-header').siblings('.feature-product-v4').addClass('list-veiw-enable');
691    });
692    $(document).on('click', '#grid-tab', function () {
693        $(this).parents('.woocommerce-products-header').siblings('.feature-product-v4').removeClass('list-veiw-enable');
694    });
695
696    // Dokan geolocation
697
698    var gdform = $('.dokan-geolocation-location-filters');
699    var gdmap = $('.dokan-geolocation-locations-map-top');
700    var shopParent = $('.woocommerce-products-header');
701
702    if(gdform.length > 0 || gdmap.length > 0 ){
703        if(shopParent.length >0 ){
704            shopParent.addClass('xs-dokan-geolocation-enable');
705            var topm1 = gdform.outerHeight();
706            var topm2 = gdmap.outerHeight();
707            var totalMagin = topm1 + topm2 + 100 +'px';
708            shopParent.css('margin-top', totalMagin);
709        }
710    }
711
712})(jQuery);

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.