1/* 2 * Superfish v1.4.8 - jQuery menu widget 3 * Copyright (c) 2008 Joel Birch 4 * 5 * Dual licensed under the MIT and GPL licenses: 6 * http://www.opensource.org/licenses/mit-license.php 7 * http://www.gnu.org/licenses/gpl.html 8 */ 9/* 10 * This is not the original jQuery Superfish plugin. 11 * Please refer to the README for more information. 12 */ 13 14(function($){ 15 $.fn.superfish = function(superfish_options){ 16 const cssClasses = sf.cssClasses; 17 const $arrow = $(`<span class="${cssClasses.arrowClass}"> »</span>`); 18 19 const over = function(){ 20 const $$ = $(this); 21 const menu = getMenu($$); 22 clearTimeout(menu.sfTimer); 23 $$.showSuperfishUl().siblings().hideSuperfishUl(); 24 }; 25 26 const out = function(){ 27 const $$ = $(this); 28 const menu = getMenu($$); 29 const options = sf.options; 30 31 clearTimeout(menu.sfTimer); 32 menu.sfTimer = setTimeout(function(){ 33 if ($$.children('.sf-clicked').length === 0){ 34 options.retainPath = ($.inArray($$[0], options.$path) > -1); 35 $$.hideSuperfishUl(); 36 if (options.$path.length && $$.parents(`li.${cssClasse
36s.hoverClass}`).length < 1){ 37 over.call(options.$path); 38 } 39 } 40 }, options.delay); 41 }; 42 43 const getMenu = function($menu){ 44 const menu = $menu.parents(`ul.${cssClasses.menuClass}:first`)[0]; 45 sf.options = sf.optionsList[menu.serial]; 46 return menu; 47 }; 48 49 const addArrow = function($a){ 50 $a.addClass(cssClasses.anchorClass).append($arrow.clone()); 51 }; 52 53 return this.each(function() { 54 const s = this.serial = sf.optionsList.length; 55 const options = $.extend({}, sf.defaults, superfish_options); 56 options.$path = $(`li.${options.pathClass}`, this).slice(0, options.pathLevels); 57 const path = options.$path; 58 for (let l = 0; l < path.length; l++){ 59 path.eq(l).addClass(`${cssClasses.hoverClass} ${cssClasses.bcClass}`).filter('li:has(ul)').removeClass(options.pathClass); 60 } 61 sf.optionsList[s] = sf.options = options; 62 63 $('li:has(ul)', this)[($.fn.hoverIntent && !options.disableHI) ? 'hoverIntent' : 'hover'](over, out).each(function() { 64 if (options.autoArrows) { 65 addArrow( $(this).children('a:first-child, span.nolink:first-child') ); 66 } 67 }) 68 .not('.' + cssClasses.bcClass).hideSuperfishUl(); 69 70 const $a = $('a, span.nolink', this); 71 $a.each(function(i){ 72 const $li = $a.eq(i).parents('li'); 73 $a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);}); 74 }); 75 options.onInit.call(this); 76 77 }).each(function() { 78 const menuClasses = [cssClasses.menuClass]; 79 if (sf.options.dropShadows){ 80 menuClasses.push(cssClasses.shadowClass); 81 } 82 $(this).addClass(menuClasses.join(' ')); 83 }); 84 }; 85 86 const sf = $.fn.superfish; 87 sf.optionsList = []; 88 sf.options = {}; 89 90 sf.cssClasses = { 91 bcClass: 'sf-breadcrumb', 92 menuClass: 'sf-js-enabled', 93 anchorClass: 'sf-with-ul', 94 arrowClass: 'sf-sub-indicator', 95 shadowClass: 'sf-shadow', 96 hiddenClass: 'sf-hidden', 97 hoverClass: 'sfHover' 98 }; 99 100 sf.defaults = { 101 pathClass: 'overideThisToUse', 102 pathLevels: 1, 103 delay: 800, 104 animation: {opacity: 'show'}, 105 speed: 'fast', 106 autoArrows: true, 107 dropShadows: true, 108 disableHI: false, // true disables hoverIntent detection 109 onInit: function(){}, // callback functions 110 onBeforeShow: function(){}, 111 onShow: function(){}, 112 onHide: function(){} 113 }; 114 115 $.fn.extend({ 116 hideSuperfishUl : function(){ 117 const options = sf.options; 118 const not = options.retainPath === true ? options.$path : ''; 119 options.retainPath = false; 120 const $ul = $(`li.${sf.cssClasses.hoverClass}`, this).add(this).not(not).removeClass(sf.cssClasses.hoverClass) 121 .children('ul').addClass(sf.cssClasses.hiddenClass); 122 options.onHide.call($ul); 123 return this; 124 }, 125 showSuperfishUl : function(){ 126 this.removeClass(sf.cssClasses.hiddenClass); 127 const options = sf.options; 128 const $ul = this.addClass(sf.cssClasses.hoverClass).children(`ul.${sf.cssClasses.hiddenClass}`).hide().removeClass(sf.cssClasses.hiddenClass); 129 options.onBeforeShow.call($ul); 130 $ul.animate(options.animation, options.speed, function(){ options.onShow.call($ul); }); 131 return this; 132 } 133 }); 134 135})(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.