1jQuery(function($) { 2 // Interval loop 3 $.fn.intervalLoop = function(condition, action, duration, limit) { 4 var counter = 0; 5 var looper = setInterval(function(){ 6 if (counter >= limit || $.fn.checkIfElementExists(condition)) { 7 clearInterval(looper); 8 } else { 9 action(); 10 counter++; 11 } 12 }, duration); 13 }; 14 // Check if element exists 15 $.fn.checkIfElementExists = function(selector) { 16 return $(selector).length; 17 }; 18 19 // Slide fade toggle function 20 $.fn.slideFadeToggle = function(speed, callback) { 21 return this.animate({ 22 opacity: 'toggle', 23 height: 'toggle' 24 }, speed, callback); 25 }; 26 var slickController = { 27 init: function() { 28 var base = this; 29 base._buildSubMenu(); 30 base._detachLogin(); 31 base._moveLogin(); 32 setTimeout(function() { 33 base._moveLogin(); 34 }, 500); 35 }, 36 _buildSubMenu: function() {
37 // Add class to nav items with subnav 38 $('.wsite-menu-default').find('li.wsite-menu-item-wrap').each(function() { 39 var $me = $(this); 40 41 if ($me.children('.wsite-menu-wrap').length > 0) { 42 43 $me.addClass('has-submenu'); 44 $('<span class="icon-caret"></span>').insertAfter($me.children('a.wsite-menu-item')); 45 } 46 }); 47 48 // Add class to subnav items with subnav 49 $('.wsite-menu').find('li.wsite-menu-subitem-wrap').each(function() { 50 var $me = $(this); 51 52 if ($me.children('.wsite-menu-wrap').length > 0) { 53 54 $me.addClass('has-submenu'); 55 $('<span class="icon-caret"></span>').insertAfter($me.children('a.wsite-menu-subitem')); 56 } 57 }); 58 59 // Keep subnav open if submenu item is active 60 $('li.wsite-menu-subitem-wrap.wsite-nav-current').parents('.wsite-menu-wrap').addClass('open'); 61 62 // Subnav toggle 63 $('.has-submenu span.icon-caret').on('click', function() { 64 $(this).toggleClass('open') 65 var $me = $(this); 66 67 if ($me.siblings('.wsite-menu-wrap').hasClass('open')) { 68 $me.siblings('.wsite-menu-wrap').removeClass('open'); 69 } else { 70 $me.siblings('.wsite-menu-wrap').addClass('open'); 71 } 72 }); 73 }, 74 _detachLogin: function() { 75 var loginDetach = $('#member-login').detach(); 76 $('.mobile-nav .wsite-menu-default > li:last-child').after(loginDetach); 77 }, 78 79 _moveLogin: function() { 80 var base = this; 81 if ($(window).width() <= 992) { 82 $.fn.intervalLoop('.mobile-nav #member-login', base._detachLogin, 800, 5); 83 } 84 }, 85 }; 86 87 88 $(document).ready(function() { 89 slickController.init(); 90 }); 91});
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.