PageSourceSearch

https://www.6400fannin.com/files/theme/custom.js?1563824644

js 6400fannin.com collected 2026-10-08 07:12:38 UTC 6,377 bytes, 223 lines download raw bytes

1jQuery(function($) {
2
3    // Fixed nav
4    $.fn.checkHeaderPositioning = function(scrollEl, scrollClass) {
5        var $me = $(this);
6
7        if (!$me.length) {
8          return;
9        }
10
11        if($(scrollEl).scrollTop() > 50) {
12            $me.addClass(scrollClass);
13        } else if($(scrollEl).scrollTop() === 0) {
14            $me.removeClass(scrollClass);
15        }
16    };
17
18  // Mobile sidebars
19  $.fn.expandableSidebar = function(expandedClass) {
20    var $me = this;
21
22    $me.on('click', function() {
23      if(!$me.hasClass(expandedClass)) {
24        $me.addClass(expandedClass);
25      } else {
26        $me.removeClass(expandedClass);
27      }
28    });
29  }
30
31  // Interval loop
32  $.fn.intervalLoop = function(condition, action, duration, limit) {
33    var counter = 0;
34    var looper = setInterval(function(){
35      if (counter >= limit || $.fn.checkIfElementExists(condition)) {
36        clearInterval(looper);
37      } else {
38        action();
39        counter++;
40      }
41    }, duration);
42  }
43
44  // Check if element exists
45  $.fn.checkIfElementExists = function(selector) {
46    return $(selector).length;
47  }
48
49  var birdseyeController = {
50    init: function(opts) {
51      var base = this;
52
53      $('body').checkHeaderPositioning(window, 'affix');
54
55      // Add classes to elements
56      base._addClasses();
57
58      if(!$('body').hasClass('wsite-editor') && $('#wsite-nav-cart-a').length) {
59        $('#wsite-nav-cart-a').html($('#wsite-nav-cart-a').html().replace(/[()]/g, ''));
60      }
61
62      setTimeout(function(){
63        base._checkCartItems();
64        base._attachEvents();
65        if($('#wsite-nav-cart-a').length) {
66          $('#wsite-nav-cart-a').html($('#wsite-nav-cart-a').html().replace(/[()]/g, ''));
67        }
68      }, 1000);
69    },
70
71    _addClasses: function() {
72      var base = this;
73
74      // Add fade in class to nav + logo + banner
75        $('body').addClass('fade-in');
76
77      // Add class to nav items with subnav
78      $('.wsite-menu-default').find('li.wsite-menu-item-wrap').each(function(){
79        var $me = $(this);
80
81        if($me.children('.wsite-menu-wrap').length > 0) {
82          $me.addClass('has-submenu');
83          $('<span class="icon-caret"></span>').insertAfter($me.children('a.wsite-menu-item'));
84        }
85      });
86
87      // Add class to subnav items with subnav
88      $('.wsite-menu').find('li.wsite-menu-subitem-wrap').each(function(){
89        var $me = $(this);
90
91        if($me.children('.wsite-menu-wrap').length > 0) {
92          $me.addClass('has-submenu');
93          $('<span class="icon-caret"></span>').insertAfter($me.children('a.wsite-menu-subitem'));
94        }
95      });
96
97        // Keep subnav open if submenu item is active
98        if ($(window).width() < 1024) {
99          $('li.wsite-menu-subitem-wrap.wsite-nav-current').parents('.wsite-menu-wrap').addClass('open');
100        }
101
102      // Add placeholder text to inputs
103      $('.wsite-form-sublabel').each(function(){
104        var sublabel = $(this).text();
105        $(this).prev('.wsite-form-input').attr('placeholder', sublabel);
106      });
107    },
108
109    _checkCartItems: function() {
110      var base = this;
111      if($('#wsite-mini-cart').find('li.wsite-product-item').length > 0) {
112        $('body').addClass('cart-full');
113      } else {
114        $('body').removeClass('cart-full');
115      }
116    },
117
118    _moveLogin: function() {
119      var login = $('#member-login').clone(true);
120      $('.mobile-nav .wsite-menu-default > li:last-child').after(login);
121    },
122
123    _moveFlyout: function() {
124      var maxheight = $(window).height() - $('.birdseye-header').outerHeight();
125      var anchor = true;
126
127      $('#wsite-menus .wsite-menu-wrap').each(function() {
128        if ($(this).outerHeight() > maxheight) {
129          anchor = false;
130        }
131      });
132
133      if (anchor) {
134        var move = $("#wsite-menus").detach();
135        $(".birdseye-header").append(move);
136      }
137    },
138
139    _moveCart: function() {
140      var move = $("#wsite-mini-cart").detach();
141      $(".birdseye-header").append(move);
142    },
143
144    _attachEvents: function() {
145      var base = this;
146
147        $('label.hamburger').on('click', function() {
148            if (!$('body').hasClass('nav-open')) {
149                $('body').addClass('nav-open');
150            } else {
151                $('body').removeClass('nav-open');
152            }
153        });
154
155        // Move cart + login
156        $.fn.intervalLoop('.mobile-nav #member-login', base._moveLogin, 800, 5);
157
158        // Move Flyout
159        $.fn.intervalLoop('.birdseye-header #wsite-menus', base._moveFlyout, 300, 8);
160
161        // Move Cart
162        $.fn.intervalLoop('.birdseye-header #wsite-mini-cart', base._moveCart, 300, 8);
163
164        // Check Cart
165
166        $.fn.intervalLoop('body.cart-full', base._checkCartItems, 300, 10);
167
168        // Window scroll
169
170        // Fixed header
171        $(window).on('scroll', function() {
172          $('body').checkHeaderPositioning(window, 'affix');
173        });
174
175        // Subnav toggle
176        $('li.has-submenu span.icon-caret').on('click', function() {
177            var $me = $(this);
178
179            if($me.siblings('.wsite-menu-wrap').hasClass('open')) {
180                $me.siblings('.wsite-menu-wrap').removeClass('open');
181            } else {
182                $me.siblings('.wsite-menu-wrap').addClass('open');
183            }
184        });
185
186      // Store category dropdown
187      $('.wsite-com-sidebar').expandableSidebar('sidebar-expanded');
188
189      // Search filters dropdown
190      $('#wsite-search-sidebar').expandableSidebar('sidebar-expanded');
191
192      // Init fancybox swipe on mobile
193      if ('ontouchstart' in window) {
194        $('body').on('click', 'a.w-fancybox', function() {
195          base._initSwipeGallery();
196        });
197      }
198    },
199
200    _initSwipeGallery: function() {
201      var base = this;
202
203      setTimeout(function(){
204        var touchGallery = document.getElementsByClassName('fancybox-wrap')[0];
205        var mc = new Hammer(touchGallery);
206        mc.on("panleft panright", function(ev) {
207          if (ev.type == "panleft") {
208            $("a.fancybox-next").trigger("click");
209          } else if (ev.type == "panright") {
210            $("a.fancybox-prev").trigger("click");
211          }
212          base._initSwipeGallery();
213        });
214      }, 500);
215    }
216  }
217
218  $(document).ready(function(){
219    birdseyeController.init();
220  });
221});
222
223setTimeout(function() {$("#fadein").addClass("load");}, 7500);

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.