1// Superfish Drop-Down Menus ---------------> 2 3 4/* 5 * Superfish v1.4.8 - jQuery menu widget 6 * Copyright (c) 2008 Joel Birch 7 * 8 * Dual licensed under the MIT and GPL licenses: 9 * http://www.opensource.org/licenses/mit-license.php 10 * http://www.gnu.org/licenses/gpl.html 11 * 12 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt 13 */ 14 15jQuery(function($){ 16$(document).ready(function(){ 17 18(function($){ 19 $.fn.superfish = function(op){ 20 21 var sf = $.fn.superfish, 22 c = sf.c, 23 $arrow = $(['<span class="',c.arrowClass,'"></span>'].join('')), 24 over = function(){ 25 var $$ = $(this), menu = getMenu($$); 26 clearTimeout(menu.sfTimer); 27 $$.showSuperfishUl().siblings().hideSuperfishUl(); 28 }, 29 out = function(){ 30 var $$ = $(this), menu = getMenu($$), o = sf.op; 31 clearTimeout(menu.sfTimer); 32 menu.sfTimer=setTimeout(function(){ 33 o.retainPath=($.inArray($$[0],o.$path)>-1); 34 $$.hideSuperfishUl(); 35 if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);} 36 },o.delay); 37 }, 38 getMenu = function($menu){ 39 var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0]; 40 sf.op = sf.o[menu.serial]; 41 return menu; 42 }, 43 addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); }; 44 45 return this.each(function() { 46 var s = this.serial = sf.o.length; 47 var o = $.extend({},sf.defaults,op); 48 o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){ 49 $(this).addClass([o.hoverClass,c.bcClass].join(' ')) 50 .filter('li:has(ul)').removeClass(o.pathClass); 51 }); 52 sf.o[s] = sf.op = o; 53 54 $('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() { 55 if (o.autoArrows) addArrow( $('>a:first-child',this) ); 56 }) 57 .not('.'+c.bcClass) 58 .hideSuperfishUl(); 59 60 var $a = $('a',this); 61 $a.each(function(i){ 62 var $li = $a.eq(i).parents('li'); 63 $a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);}); 64 }); 65 o.onInit.call(this); 66 67 }).each(function() { 68 var menuClasses = [c.menuClass]; 69 if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass); 70 $(this).addClass(menuClasses.join(' ')); 71 }); 72 }; 73 74 var sf = $.fn.superfish; 75 sf.o = []; 76 sf.op = {}; 77 sf.IE7fix = function(){ 78 var o = sf.op; 79 if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined) 80 this.toggleClass(sf.c.shadowClass+'-off'); 81 }; 82 sf.c = { 83 bcClass : 'sf-breadcrumb', 84 menuClass : 'sf-js-enabled', 85 anchorClass : 'sf-with-ul', 86 arrowClass : 'sf-sub-indicator', 87 shadowClass : 'sf-shadow' 88 }; 89 sf.defaults = { 90 hoverClass : 'sfHover', 91 pathClass : 'overideThisToUse', 92 pathLevels : 1, 93 delay : 350, 94 animation : {height:'show', opacity:'show'}, 95 easing: 'easeOutExpo', 96 speed : '350', 97 autoArrows : false, 98 dropShadows : false, 99 disableHI : false, // true disables hoverIntent detection 100 onInit : function(){}, // callback functions 101 onBeforeShow: function(){}, 102 onShow : function(){}, 103 onHide : function(){} 104 }; 105 $.fn.extend({ 106 hideSuperfishUl : function(){ 107 var o = sf.op, 108 not = (o.retainPath===true) ? o.$path : ''; 109 o.retainPath = false; 110 var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass) 111 .find('>ul').hide().css('visibility','hidden'); 112 o.onHide.call($ul); 113 return this; 114 }, 115 showSuperfishUl : function(){ 116 var o = sf.op, 117 sh = sf.c.shadowClass+'-off', 118 $ul = this.addClass(o.hoverClass) 119 .find('>ul:hidden').css('visibility','visible'); 120 sf.IE7fix.call($ul); 121 o.onBeforeShow.call($ul); 122 123 $ul.animate(o.animation,o.speed,o.easing,function() 124{ sf.IE7fix.call($ul); o.onShow.call($ul); }); 125 return this; 126 127 } 128 }); 129 130})(jQuery); 131 132// initialise plugins 133 134jQuery(function($){ 135 $('ul.sf-menu-primary').superfish({ 136 easing: 'easeOutExpo', 137 delay: 350, // one second delay on mouseout 138 animation: {height:'show', opacity:'show'}, // fade-in and slide-down animation 139 speed: '350', // faster animation speed 140 autoArrows: false, // disable generation of arrow mark-up 141 dropShadows: false // disable drop shadows 142 143}); 144}); 145 146 147 148 149 150}); 151});
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.