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