PageSourceSearch

https://www.mtc.es/js/superfish.js

js mtc.es collected 2026-10-02 11:05:20 UTC 3,834 bytes, 240 lines download raw bytes

1
2
3/*
4
5 * Superfish v1.4.8 - jQuery menu widget
6
7 * Copyright (c) 2008 Joel Birch
8
9 *
10
11 * Dual licensed under the MIT and GPL licenses:
12
13 * 	http://www.opensource.org/licenses/mit-license.php
14
15 * 	http://www.gnu.org/licenses/gpl.html
16
17 *
18
19 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
20
21 */
22
23
24
25;(function($){
26
27	$.fn.superfish = function(op){
28
29
30
31		var sf = $.fn.superfish,
32
33			c = sf.c,
34
35			$arrow = $(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),
36
37			over = function(){
38
39				var $$ = $(this), menu = getMenu($$);
40
41				clearTimeout(menu.sfTimer);
42
43				$$.showSuperfishUl().siblings().hideSuperfishUl();
44
45			},
46
47			out = function(){
48
49				var $$ = $(this), menu = getMenu($$), o = sf.op;
50
51				clearTimeout(menu.sfTimer);
52
53				menu.sfTimer=setTimeout(function(){
54
55					o.retainPath=($.inArray($$[0],o.$path)>-1);
56
57					$$.hideSuperfishUl();
58
59					if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
60
61				},o.delay);	
62
63			},
64
65			getMenu = function($menu){
66
67				var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
68
69				sf.op = sf.o[menu.serial];
70
71				return menu;
72
73			},
74
75			addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
76
77			
78
79		return this.each(function() {
80
81			var s = this.serial = sf.o.length;
82
83			var o = $.extend({},sf.defaults,op);
84
85			o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
86
87				$(this).addClass([o.hoverClass,c.bcClass].join(' '))
88
89					.filter('li:has(ul)').removeClass(o.pathClass);
90
91			});
92
93			sf.o[s] = sf.op = o;
94
95			
96
97			$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
98
99				if (o.autoArrows) addArrow( $('>a:first-child',this) );
100
101			})
102
103			.not('.'+c.bcClass)
104
105				.hideSuperfishUl();
106
107			
108
109			var $a = $('a',this);
110
111			$a.each(function(i){
112
113				var $li = $a.eq(i).parents('li');
114
115				$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
116
117			});
118
119			o.onInit.call(this);
120
121			
122
123		}).each(function() {
124
125			var menuClasses = [c.menuClass];
126
127			if (sf.op.dropShadows  && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
128
129			$(this).addClass(menuClasses.join(' '));
130
131		});
132
133	};
134
135
136
137	var sf = $.fn.superfish;
138
139	sf.o = [];
140
141	sf.op = {};
142
143	sf.IE7fix = function(){
144
145		var o = sf.op;
146
147		if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
148
149			this.toggleClass(sf.c.shadowClass+'-off');
150
151		};
152
153	sf.c = {
154
155		bcClass     : 'sf-breadcrumb',
156
157		menuClass   : 'sf-js-enabled',
158
159		anchorClass : 'sf-with-ul',
160
161		arrowClass  : 'sf-sub-indicator',
162
163		shadowClass : 'sf-shadow'
164
165	};
166
167	sf.defaults = {
168
169		hoverClass	: 'sfHover',
170
171		pathClass	: 'overideThisToUse',
172
173		pathLevels	: 1,
174
175		delay		: 1200,
176
177		animation	: {opacity:'show'},
178
179		speed		: 'normal',
180
181		autoArrows	: false,
182
183		dropShadows : true,
184
185		disableHI	: false,		// true disables hoverIntent detection
186
187		onInit		: function(){}, // callback functions
188
189		onBeforeShow: function(){},
190
191		onShow		: function(){},
192
193		onHide		: function(){}
194
195	};
196
197	$.fn.extend({
198
199		hideSuperfishUl : function(){
200
201			var o = sf.op,
202
203				not = (o.retainPath===true) ? o.$path : '';
204
205			o.retainPath = false;
206
207			var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
208
209					.find('>ul').hide().css('visibility','hidden');
210
211			o.onHide.call($ul);
212
213			return this;
214
215		},
216
217		showSuperfishUl : function(){
218
219			var o = sf.op,
220
221				sh = sf.c.shadowClass+'-off',
222
223				$ul = this.addClass(o.hoverClass)
224
225					.find('>ul:hidden').css('visibility','visible');
226
227			sf.IE7fix.call($ul);
228
229			o.onBeforeShow.call($ul);
230
231			$ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
232
233			return this;
234
235		}
236
237	});
238
239
240})(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.