PageSourceSearch

https://pharmamex.com.mx/includes/javascript/superfish/superfish.js

js pharmamex.com.mx collected 2026-10-04 02:39:47 UTC 4,558 bytes, 165 lines download raw bytes

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