1var Idium = Idium || {}; 2 3Idium.DropdownMenus = (function ($) { 4 "use strict"; 5 6 var $menu; 7 8 var settings = { 9 slideDownSpeed: 300, 10 slideUpSpeed: 100, 11 closedClass: 'fa-angle-down', 12 activeClass: 'fa-angle-up', 13 hover: false 14 }; 15 16 var click = function (e) { 17 e.preventDefault(); 18 19 var $this = $(this); 20 21 if ($this.hasClass(settings.activeClass)) { 22 close($this); 23 } else { 24 open($this); 25 } 26 }; 27 28 var open = function ($el) { 29 $el 30 .removeClass(settings.closedClass) 31 .addClass(settings.activeClass) 32 .closest('li').addClass('active-drop') 33 .children('ul').stop().slideDown(settings.slideDownSpeed); 34 35 closeOthers($el); 36 }; 37 38 var close = function ($el) { 39 $el 40 .removeClass(settings.activeClass) 41 .addClass(settings.closedClass) 42 .closest('li').children('ul').stop().slideUp(settings.slideUpSpeed, function(){ 43 $el.closest('li').removeClass('active-drop'); 44 }); 45 }; 46 47 var closeOthers = function ($el) { 48 close($el.closest('li').siblings('li').find('.caret')); 49 }; 50 51 var mouseOver = function (e) { 52 var $this = $(this).find('.caret'); 53 open($this); 54 }; 55 56 var mouseOut = function () { 57 var $this = $(this).find('.caret'); 58 close($this); 59 }; 60 61 var keyDown = function (e) { 62 var keyMap = { 63 37 : 'left', 64 39 : 'right' 65 }; 66 67 if (keyMap[e.which] == 'left' || keyMap[e.which] == 'right') { 68 var $this = $(this).children('.caret'); 69 70 if ($this.hasClass(settings.activeClass)) { 71 close($this); 72 } else { 73 open($this); 74 } 75 } 76 }; 77 78 return { 79 init: function (selector, customSettings) { 80 settings = $.extend({}, settings, customSettings); 81 $menu = $(selector); 82 $menu.find('.caret').on('click.idium', click); 83 $menu.find('a').on('keydown.idium', keyDown); 84 if (settings.hover) { 85 $menu.children('ul').children('li.dropdown').hover(mouseOver, mouseOut); 86 } 87 } 88 } 89}); 90 91Idium.MainMenu = Idium.DropdownMenus(jQuery).init('.header__main-nav', {hover: true}); 92Idium.MobileMenu = Idium.DropdownMenus(jQuery).init('.mobile-navigation'); 93 94jQuery(window).load(function () { 95 jQuery('[data-a11y-toggle=search-popup]').click(function (e) { 96 var $el = jQuery(this); 97 var $form = jQuery('#' + $el.data('a11y-toggle')); 98 setTimeout(function () { 99 $form.find('.search-form__input').focus(); 100 }); 101 }); 102});
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.