PageSourceSearch

https://thedowtheory.com/wp-content/themes/dowtheory/js/app.js

js thedowtheory.com collected 2026-10-03 22:07:31 UTC 10,372 bytes, 284 lines download raw bytes

1(function($) {
2
3    // Animation JS
4   /* new WOW({
5        animateClass: 'animated',
6        offset: 10,
7        callback: function(e) {}
8    }).init();*/
9    $(document).on('click', '.serach-icon a, #search-close', function(e) {
10        e.preventDefault();
11        e.stopPropagation();
12        $(document).find('#search-wrap').toggleClass('active');
13    });
14    if ($('.banner-silde-wrap').length) {
15        $('.banner-silde-wrap').slick({
16            dots: false,
17            infinite: true,
18            speed: 1500,
19            slidesToShow: 1,
20            arrows: false,
21            fade: false,
22            autoplay: true,
23            autoplaySpeed: 4000
24        });
25    }
26    if ($('[data-verticle-slider]').length) {
27        $('[data-verticle-slider]').slick({
28            dots: false,
29            infinite: true,
30            loop: true,
31            slidesToShow: 1,
32            slidesToScroll: 1,
33            arrows: false,
34            vertical: true,
35            verticalSwiping: true,
36            pauseOnHover:true,
37            speed: 7000,
38            autoplay: true,
39            autoplaySpeed: 0,
40            cssEase: 'linear',
41            centerMode: true,
42            centerPadding: '100px',
43            responsive: [{
44                    breakpoint: 992,
45                    settings: {
46                        slidesToShow: 1,
47                        slidesToScroll: 1,
48                        dots: true
49                    },
50                }
51            ]
52        });
53    }
54    if ($('[data-fade-slider]').length) {
55        $('[data-fade-slider]').slick({
56            dots: true,
57            infinite: true,
58            speed: 300,
59            slidesToShow: 1,
60            arrows: false,
61            fade: true,
62            autoplay: true,
63            autoplaySpeed: 3500
64        });
65        if ($('[data-fade-slider] .slick-dots').length) {
66            $('[data-fade-slider] .slick-dots').prepend('<button class="slick-prev slick-arrow" aria-label="Previous" type="button" style="">Previous</button>');
67            $('[data-fade-slider] .slick-dots').append('<button class="slick-next slick-arrow" aria-label="Previous" type="button" style="">Next</button>');
68        }
69        $(document).on('click', '.slick-prev', function(e) {
70            $('[data-fade-slider]').slick('slickPrev');
71        });
72        $(document).on('click', '.slick-next', function(e) {
73            $('[data-fade-slider]').slick('slickNext');
74        });
75    }
76    function isOnScreen(elem) {
77        // if the element doesn't exist, abort
78        if( elem.length == 0 ) {
79            return;
80        }
81        var $window = jQuery(window)
82        var viewport_top = $window.scrollTop()
83        var viewport_height = $window.height()
84        viewport_height = (viewport_height/3)*2;
85        var viewport_bottom = viewport_top + viewport_height - 10
86        var $elem = jQuery(elem)
87        var top = $elem.offset().top
88        var height = $elem.height()
89        var bottom = top + height
90    
91        return (top >= viewport_top && top < viewport_bottom) ||
92        (bottom > viewport_top && bottom <= viewport_bottom) ||
93        (height > viewport_height && top <= viewport_top && bottom >= viewport_bottom)
94    }
95    function CounterClock (){
96        if($('.count')){
97            var $window = jQuery(window);        
98            $('.count').each(function(){
99                $barPosition = $(this).offset().top;
100                $comparePos = $window.scrollTop() + ($window.height() - 40);
101                if( ($barPosition  <= $comparePos) && !$(this).hasClass('animate-done') ){
102                    $(this).prop('Counter',0).animate({
103                        Counter: $(this).data('count')
104                    }, {
105                        duration: 3000,
106                        easing: 'swing',
107                        step: function (now) {
108                            $(this).text(Math.ceil(now));
109                        },
110                        done: function(p) {
111                            $(this).addClass('animate-done');
112                        },
113                    });
114                }
115            });
116        }
117    }
118
119    var scrollOffset = document.getElementById("top").offsetHeight;
120    var navbar = document.getElementById("top");
121    var footer = document.getElementById("footer");
122    var bannerLogo = document.getElementById("banner-scroll-logo");
123    var slideDuration = 350;
124    var c, currentScrollTop = 0;
125
126    function stickyMenu() {
127        var sticky = navbar.offsetTop;
128        var logoVisible = bannerLogo ? (bannerLogo.offsetTop + bannerLogo.height) : 0;
129
130        if ($('#wpadminbar') && $('#wpadminbar').css("position") === 'fixed') {
131            sticky = sticky - $('#wpadminbar').innerHeight();
132        }
133        if (window.pageYOffset > sticky) {
134            navbar.classList.add("sticky");
135        } else {
136            navbar.classList.remove("sticky");
137        }
138        
139        if (window.pageYOffset > logoVisible) {
140            navbar.classList.add("logo-visible");
141        } else {
142            navbar.classList.remove("logo-visible");
143        }
144
145    }
146
147    stickyMenu();
148    CounterClock();
149    window.onscroll = function () {
150        stickyMenu();
151        CounterClock();
152        var a = $(window).scrollTop();
153        var b = navbar.offsetHeight;
154        currentScrollTop = a;
155
156        if (c < currentScrollTop && a > b + b) {
157            navbar.classList.add('header--hidden');
158        } else if (c > currentScrollTop && !(a <= b)) {
159            navbar.classList.remove('header--hidden');
160        }
161
162        c = currentScrollTop;
163
164        if (a) {
165            navbar.classList.add('header--scrolled');
166        } else {
167            navbar.classList.remove('header--scrolled');
168        }
169
170
171    };
172    window.onload = function () {
173        $('body').addClass('page-loaded');
174    };
175    // Menu Filter JS
176    $(document).on('click', '[dropdown-toggle]', function (e) {
177        e.preventDefault();
178        $(this).toggleClass('active');
179        $(this).next('[dropdown-toggle-content]').first().slideToggle();
180    });
181    $(document).on('click', '[data-filter-block]', function (e) {
182        e.preventDefault();
183        var updateText = $(this).text();
184        $('[data-filter-block]').not($(this)).removeClass('active');
185        $(this).addClass('active');
186        var targerContainer = $(this).closest('[data-filter-row]').find('[data-filter-container]').first();
187        var targetDisplay = $(this).data('filter-block');
188        targerContainer.find('.menu-group-item ').not($(targetDisplay)).removeClass('active').fadeOut();
189        $(targetDisplay).addClass('active').fadeIn();
190        if ($('[dropdown-toggle]').is(":visible")) {
191            $(this).closest('[dropdown-menu]').find('[dropdown-toggle]').first().html('<span>' + updateText + '</span>');
192            $(this).closest('[dropdown-menu]').find('[dropdown-toggle]').removeClass('active');
193            $(this).closest('[dropdown-toggle-content]').removeClass('active').slideUp(350);
194        }
195    });
196
197    // Submenu  Menu
198    $(".primary-menu-wrap .menu-item-has-children").each(function () {
199        $(this).find('a').first().after('<span class="drop-arrow" data-submenu-toggle><span class="down-arrow"></span></span>');
200    });
201    $(document).on('click', '[data-submenu-toggle]', function (e) {
202        e.preventDefault();
203        var sbMenu = $(this).closest('li').find('.sub-menu').first();
204        var sbMenuParent = $(this).closest('ul');
205        var sbMenuParentLi = $(this).parent();
206        sbMenuParent.find('[data-submenu-toggle]').not($(this)).removeClass('active');
207        sbMenuParent.find('.sub-menu').not(sbMenu).slideUp().removeClass('sub-menu-toggle');
208        sbMenuParent.find('.menu-item-has-children').not(sbMenuParentLi).removeClass('active-sub-menu');
209
210        sbMenu.toggleClass('sub-menu-toggle');
211        $(sbMenu).slideToggle();
212        $(this).toggleClass('active');
213        sbMenuParentLi.toggleClass('active-sub-menu');
214    });
215
216    // Mobile Menu
217    $('a[href="#menu"],#nav-icon, .mobile-menu-overlay, #mobile-menu-close > button,#nav-icon-close').on('click', function (e) {
218        e.preventDefault();
219        e.stopPropagation();
220        $('#header-Navigation').toggleClass('active').fadeToggle();
221        $('html').toggleClass('has-mobile-menu');
222    });
223
224
225    // scroll to top
226    if ($('#back-to-top').length) {
227        var scrollTrigger = 100, // px
228            backToTop = function() {
229                var scrollTop = $(window).scrollTop();
230                if (scrollTop > scrollTrigger) {
231                    $('#back-to-top').fadeIn();
232                } else {
233                    $('#back-to-top').fadeOut();
234                }
235            };
236        backToTop();
237        $('#back-to-top').on('click', function(e) {
238            e.preventDefault();
239            $('html,body').animate({
240                scrollTop: 0
241            }, 700);
242        });
243    }
244    
245    // // Window Load
246    // window.onload = function() {
247    //     stickyMenu();
248    // };
249    // Window Scroll Method
250    window.onscroll = function() {
251        stickyMenu();
252        if ($('#back-to-top').length) {
253            backToTop();
254        }
255    };
256    // Window Resize
257    $(window).resize(function() {
258        scrollOffset = document.getElementById("top").offsetHeight;
259        stickyMenu();
260    });
261    // Page scroll JS
262
263    
264    if (window.location.hash) {
265        $('#header-Navigation').removeClass('active');
266        $('html').removeClass('has-mobile-menu');
267        var hash = window.location.hash.substring(1);
268        setTimeout(function() {
269            $('html,body').animate({
270                scrollTop: $('#' + hash).offset().top - scrollOffset
271            }, 1500);
272        }, 100);
273    }
274    $("a[href*='#']").on('click', function (e) {
275        var id = $(this).attr("href");
276        var result1 = id.split('#');
277        if (result1.length >= 2 && $('#' + result1[1]).length) {
278            $('html,body').animate({
279                scrollTop: $('#' + result1[1]).offset().top
280            }, 1500);
281            return false;
282        }
283    });
284})(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.