PageSourceSearch

https://rakinfo.ae/js/superfish/superfish.js

js rakinfo.ae collected 2026-10-02 22:04:12 UTC 4,651 bytes, 171 lines download raw bytes

1
2/*
3 * Superfish v1.5.7 - jQuery menu widget
4 * Copyright (c) 2013 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
12;(function($){
13	$.fn.superfish = function(op){
14
15		var sf = $.fn.superfish,
16			c = sf.c,
17			$arrow = $('<span class="'+c.arrowClass+'"> &#187;</span>'),
18			over = function(e){
19				var $$ = $(this), menu = getMenu($$);
20				clearTimeout(menu.sfTimer);
21				$$.showSuperfishUl().siblings().hideSuperfishUl();
22			},
23			out = function(e){
24				var $$ = $(this), menu = getMenu($$), o = sf.op;
25				var close = function(){
26					o.retainPath=($.inArray($$[0],o.$path)>-1);
27					$$.hideSuperfishUl();
28					if (o.$path.length && $$.parents('li.'+o.hoverClass).length<1){
29						o.onIdle.call();
30						$.proxy(over,o.$path,e)();
31					}
32				};
33				if (e.type !== 'mouseleave' && e.type !== 'focusout'){
34					close();
35				} else {
36					clearTimeout(menu.sfTimer);
37					menu.sfTimer=setTimeout(close,o.delay);
38				}
39			},
40			getMenu = function($child){
41				if ($child.hasClass(c.menuClass)){
42					$.error('Superfish requires you to update to a version of hoverIntent that supports event-delegation, such as this one: https://github.com/joeldbirch/onHoverIntent');
43				}
44				var menu = $child.closest('.'+c.menuClass)[0];
45				sf.op = sf.o[menu.serial];
46				return menu;
47			},
48			applyHandlers = function($menu){
49				var targets = 'li:has(ul)';
50				if (!sf.op.useClick){
51					if ($.fn.hoverIntent && !sf.op.disableHI){
52						$menu.hoverIntent(over, out, targets);
53					} else {
54						$menu
55							.on('mouseenter', targets, over)
56							.on('mouseleave', targets, out);
57					}
58				}
59				$menu
60					.on('focusin', targets, over)
61					.on('focusout', targets, out)
62					.on('click', 'a', clickHandler)
63					.on('touchstart', 'a', touchHandler);
64			},
65			touchHandler = function(){
66				var $$ = $(this);
67				if (!$$.next('ul').is(':visible')){
68					$(this).data('follow', false);
69				}
70			},
71			clickHandler = function(e){
72				var $a = $(this),
73						$submenu = $a.next('ul'),
74						follow = ($a.data('follow') === false) ? false : true;
75
76				if ( $submenu.length && (sf.op.useClick || !follow) ){
77					e.preventDefault();
78					if (!$submenu.is(':visible')){
79						$.proxy(over,$a.parent(),e)();
80					} else if (sf.op.useClick && follow) {
81						$.proxy(out,$a.parent(),e)();
82					}
83				}
84			},
85			addArrows = function($li,o){
86				if (o.autoArrows) {
87					$li.children('a').each(function() {
88						addArrow( $(this) );
89					});
90				}
91			},
92			addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
93			
94		return this.addClass(c.menuClass).each(function() {
95			var s = this.serial = sf.o.length;
96			var o = $.extend({},sf.defaults,op);
97			var $$ = $(this);
98			var $liHasUl = $$.find('li:has(ul)');
99			o.$path = $$.find('li.'+o.pathClass).slice(0,o.pathLevels).each(function(){
100				$(this).addClass(o.hoverClass+' '+c.bcClass)
101					.filter('li:has(ul)').removeClass(o.pathClass);
102			});
103			sf.o[s] = sf.op = o;
104			
105			addArrows($liHasUl,o);
106			applyHandlers($$);
107
108			$liHasUl.not('.'+c.bcClass).hideSuperfishUl();
109			
110			o.onInit.call(this);
111			
112		});
113	};
114
115	var sf = $.fn.superfish;
116	sf.o = [];
117	sf.op = {};
118
119	sf.c = {
120		bcClass     : 'sf-breadcrumb',
121		menuClass   : 'sf-js-enabled',
122		anchorClass : 'sf-with-ul',
123		arrowClass  : 'sf-sub-indicator'
124	};
125	sf.defaults = {
126		hoverClass	: 'sfHover',
127		pathClass	: 'overideThisToUse',
128		pathLevels	: 1,
129		delay		: 800,
130		animation	: {opacity:'show'},
131		animationOut: {opacity:'hide'},
132		speed		: 'normal',
133		speedOut : 'fast',
134		autoArrows	: true,
135		disableHI	: false,		// true disables hoverIntent detection
136		useClick : false,
137		onInit		: function(){}, // callback functions
138		onBeforeShow: function(){},
139		onShow		: function(){},
140		onHide		: function(){},
141		onIdle		: function(){}
142	};
143	$.fn.extend({
144		hideSuperfishUl : function(){
145			var o = sf.op,
146				$$ = this,
147				not = (o.retainPath===true) ? o.$path : '';
148			o.retainPath = false;
149			var $ul = $('li.'+o.hoverClass,this).add(this).not(not)
150					.find('>ul').stop().animate(o.animationOut,o.speedOut,function(){
151						$ul = $(this);
152						$ul.css('visibility','hidden').parent().removeClass(o.hoverClass);
153						o.onHide.call($ul);
154					});
155			return this;
156		},
157		showSuperfishUl : function(){
158			var o = sf.op,
159				$$ = this,
160				$ul = this.addClass(o.hoverClass)
161					.find('>ul:hidden').css('visibility','visible');
162			o.onBeforeShow.call($ul);
163			$ul.stop().animate(o.animation,o.speed,function(){
164				o.onShow.call($ul);
165				$$.children('a').data('follow', true);
166			});
167			return this;
168		}
169	});
170
171})(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.