PageSourceSearch

https://aspergianpride.com/wp-content/themes/spicepress/js/menu/menu.js?ver=6.5.3

js aspergianpride.com collected 2026-09-25 01:33:42 UTC 11,772 bytes, 269 lines download raw bytes

1/* ---------------------------------------------- /*
2 * Preloader
3 /* ---------------------------------------------- */
4(function(){
5
6    jQuery(document).ready(function() {
7
8      
9        /* ---------------------------------------------- /*
10         * Scroll top
11         /* ---------------------------------------------- */
12    
13        jQuery(window).scroll(function() {
14            if (jQuery(this).scrollTop() > 100) {
15                jQuery('.scroll-up').fadeIn();
16            } else {
17                jQuery('.scroll-up').fadeOut();
18            }
19        });
20
21        
22        jQuery('.scroll-up').click(function () {
23            jQuery("html, body").animate({
24                scrollTop: 0
25            }, 700);
26            return false;
27        });
28    
29
30        /* ---------------------------------------------- /*
31         * Initialization General Scripts for all pages
32         /* ---------------------------------------------- */
33
34        var homeSection = jQuery('.home-section'),
35            navbar      = jQuery('.navbar-custom'),
36            navHeight   = navbar.height(),
37           // worksgrid   = jQuery('#works-grid'),
38            width       = Math.max(jQuery(window).width(), window.innerWidth),
39            mobileTest  = false;
40
41        if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
42            mobileTest = true;
43        }
44        document.onload = my_function();
45        spicepress_buildHomeSection(homeSection);
46        spicepress_navbarAnimation(navbar, homeSection, navHeight);
47        spicepress_navbarSubmenu(width);
48        spicepress_hoverDropdown(width, mobileTest);
49
50        jQuery(window).resize(function() {
51            var width = Math.max(jQuery(window).width(), window.innerWidth);
52            spicepress_buildHomeSection(homeSection);
53            spicepress_hoverDropdown(width, mobileTest);
54        });
55
56        function my_function () {
57    jQuery('.dropdown-menu').parent().addClass('dropdown');
58    jQuery('li.dropdown').find('a:first').addClass('dropdown-toggle');
59//    jQuery('li.dropdown').find('a:first').after( "<button type='button' class='btn btn-default dropdown-toggle' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'><i class='fa fa-angle-down'></i></button>" );
60    }
61
62
63
64       /* ---------------------------------------------- /*
65         * Home section height
66         /* ---------------------------------------------- */
67
68        function spicepress_buildHomeSection(homeSection) {
69            if (homeSection.length > 0) {
70                if (homeSection.hasClass('home-full-height')) {
71                    homeSection.height(jQuery(window).height());
72                } else {
73                    homeSection.height(jQuery(window).height() * 0.85);
74                }
75            }
76        }
77
78
79        /* ---------------------------------------------- /*
80         * Transparent navbar animation
81         /* ---------------------------------------------- */
82
83        function spicepress_navbarAnimation(navbar, homeSection, navHeight) {
84            var topScroll = jQuery(window).scrollTop();
85            if (navbar.length > 0 && homeSection.length > 0) {
86                if(topScroll >= navHeight) {
87                    navbar.removeClass('navbar-transparent');
88                } else {
89                    navbar.addClass('navbar-transparent');
90                }
91            }
92        }
93        /* ---------------------------------------------- /*
94         * Navbar submenu
95         /* ---------------------------------------------- */
96
97        function spicepress_navbarSubmenu(width) {
98            if (width > breakpoint_settings.menu_breakpoint) {
99                jQuery('.navbar-custom .navbar-nav > li.dropdown').hover(function() {
100                    var MenuLeftOffset  = jQuery('.dropdown-menu', jQuery(this)).offset().left;
101                    var Menu1LevelWidth = jQuery('.dropdown-menu', jQuery(this)).width();
102                    if (width - MenuLeftOffset < Menu1LevelWidth * 2) {
103                        jQuery(this).children('.dropdown-menu').addClass('leftauto');
104                    } else {
105                        jQuery(this).children('.dropdown-menu').removeClass('leftauto');
106                    }
107                    if (jQuery('.dropdown', jQuery(this)).length > 0) {
108                        var Menu2LevelWidth = jQuery('.dropdown-menu', jQuery(this)).width();
109                        if (width - MenuLeftOffset - Menu1LevelWidth < Menu2LevelWidth) {
110                            jQuery(this).children('.dropdown-menu').addClass('left-side');
111                        } else {
112                            jQuery(this).children('.dropdown-menu').removeClass('left-side');
113                        }
114                    }
115                });
116
117                 jQuery('.navbar-custom .navbar-nav > li.dropdown a.dropdown-toggle').focus(function() {
118                    var MenuLeftOffsets  = jQuery('.dropdown-menu', jQuery(this).parent()).offset().left;
119                    var Menu1LevelWidth = jQuery('.dropdown-menu', jQuery(this).parent()).width();
120                    if (width - MenuLeftOffsets < Menu1LevelWidth * 2) {
121                        jQuery(this).parent().children('.dropdown-menu').addClass('leftauto');
122                    } else {
123                        jQuery(this).parent().children('.dropdown-menu').removeClass('leftauto');
124                    }
125                    if (jQuery('.dropdown', jQuery(this).parent()).length > 0) {
126                        var Menu2LevelWidth = jQuery('.dropdown-menu', jQuery(this).parent()).width();
127                        if (width - MenuLeftOffsets - Menu1LevelWidth < Menu2LevelWidth) {
128                            jQuery(this).parent().children('.dropdown-menu').addClass('left-side');
129                        } else {
130                            jQuery(this).parent().children('.dropdown-menu').removeClass('left-side');
131                        }
132                    }
133                });
134            }
135        }
136
137        /* ---------------------------------------------- /*
138         * Navbar hover dropdown on desctop
139         /* ---------------------------------------------- */
140
141        function spicepress_hoverDropdown(width, mobileTest) {
142            if ((width > breakpoint_settings.menu_breakpoint) && (mobileTest !== true)) {
143                jQuery('.navbar-custom').removeClass('open');
144                var delay = 0;
145                var setTimeoutConst;
146                jQuery('.navbar-custom .navbar-nav > li.dropdown, .navbar-custom li.dropdown > ul > li.dropdown').hover(function() {
147                        var jQuerythis = jQuery(this);
148                        setTimeoutConst = setTimeout(function() {
149                            jQuerythis.addClass('open');
150                            jQuerythis.find('.dropdown-toggle').addClass('disabled');
151                        }, delay);
152                    },
153                    function() {
154                        clearTimeout(setTimeoutConst);
155                        jQuery(this).removeClass('open');
156                        jQuery(this).find('.dropdown-toggle').removeClass('disabled');
157                    });
158            } else {
159                jQuery('.navbar-custom .navbar-nav > li.dropdown, .navbar-custom li.dropdown > ul > li.dropdown').unbind('mouseenter mouseleave');
160                jQuery('.navbar-custom [data-toggle=dropdown]').not('.binded').addClass('binded').on('click', function(event) {
161                    event.preventDefault();
162                    event.stopPropagation();
163                    jQuery(this).parent().siblings().removeClass('open');
164                    jQuery(this).parent().siblings().find('[data-toggle=dropdown]').parent().removeClass('open');
165                    jQuery(this).parent().toggleClass('open');
166                });
167            }
168        }
169
170        /* ---------------------------------------------- /*
171         * Navbar collapse on click
172         /* ---------------------------------------------- */
173
174        jQuery(document).on('click','.navbar-collapse.in',function(e) {
175            if( jQuery(e.target).is('a') && jQuery(e.target).attr('class') != 'dropdown-toggle' ) {
176                jQuery(this).collapse('hide');
177            }
178        });
179
180
181        if( jQuery(window).width() > breakpoint_settings.menu_breakpoint) {
182           jQuery('.nav li.dropdown').hover(function() {
183            if( jQuery(window).width() > 1100) {
184                jQuery('.dropdown-menu').removeAttr("style");
185              }
186               jQuery(this).addClass('open');
187
188           }, function() {
189               jQuery(this).removeClass('open');
190           }); 
191           jQuery('.nav li.dropdown-submenu').hover(function() {
192               jQuery(this).addClass('open');
193           }, function() {
194               jQuery(this).removeClass('open');
195           }); 
196        }
197        
198        
199        jQuery('li.dropdown').find('.fa-angle-down').each(function(){
200            jQuery(this).on('click', function(){
201                if( jQuery(window).width() < breakpoint_settings.menu_breakpoint) {
202                    jQuery(this).parent().next().slideToggle();
203                }
204                return false;
205            });
206        });
207
208         /* ---------------------------------------------- /*
209         * Navbar focus dropdown on desktop
210         /* ---------------------------------------------- */
211        const topLevelLinks = Array.prototype.slice.call(document.querySelectorAll(".navbar-custom .navbar-nav > li.dropdown a.dropdown-toggle"), 0);
212          topLevelLinks.forEach(function(link){
213             return link.addEventListener('focus', function(e) {
214                this.parentElement.classList.add('open')
215                e.preventDefault();
216               
217                var div_list = e.target.parentElement.querySelectorAll( ".open" );
218                var div_array = Array.prototype.slice.call(div_list);
219                  div_array.forEach(function(e){
220                   return e.classList.remove( "open" ) 
221                });
222              })             
223
224            })
225
226            jQuery('li a').focus(function() { 
227              jQuery(this).parent().siblings().removeClass('open');
228              jQuery(this).parent().siblings().find(".open").removeClass('open');
229         });
230     
231            jQuery('a,input').bind('focus', function() {
232             if(!jQuery(this).closest(".menu-item").length ) {
233                topLevelLinks.forEach(function(link){
234                return link.parentElement.classList.remove('open')
235            })
236            }
237        })
238
239        if(jQuery(window).width() >= breakpoint_settings.menu_breakpoint){
240        //For header fix
241        jQuery(window).bind('scroll', function () {
242            if (jQuery(window).scrollTop() > 100) {
243                jQuery('.navbar-overlapped.navbar-custom').addClass('stiky-header');
244            } else {
245                jQuery('.navbar-overlapped.navbar-custom').removeClass('stiky-header');
246            }
247        });
248    
249    }    
250    
251    
252            jQuery('li.dropdown').find('.caret').each(function(){
253            jQuery(this).on('click', function(){
254                if( jQuery(window).width() <= breakpoint_settings.menu_breakpoint) {
255                  jQuery('li.dropdown,li.dropdown-submenu').removeClass('open');
256                  jQuery(this).parent().next().slideToggle();
257                }
258             return false;
259            });
260        });
261
262        jQuery('a,input').bind('focus', function() {
263            if(!jQuery(this).closest(".menu-item").length && ( jQuery(window).width() <= breakpoint_settings.menu_breakpoint) ) {
264               jQuery('.navbar-collapse').removeClass('in');
265            }
266        })
267    
268    });
269})(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.