PageSourceSearch

https://dabblemag.com/wp-content/themes/genesis/lib/js/menu/superfish_ver-1.7.5.js

js dabblemag.com collected 2026-09-26 15:11:56 UTC 7,933 bytes, 273 lines download raw bytes

1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{
2let window = _____WB$wombat$assign$function_____("window");
3let self = _____WB$wombat$assign$function_____("self");
4let document = _____WB$wombat$assign$function_____("document");
5let location = _____WB$wombat$assign$function_____("location");
6let top = _____WB$wombat$assign$function_____("top");
7let parent = _____WB$wombat$assign$function_____("parent");
8let frames = _____WB$wombat$assign$function_____("frames");
9let opens = _____WB$wombat$assign$function_____("opens");
10/*
11 * jQuery Superfish Menu Plugin
12 * Copyright (c) 2013 Joel Birch
13 *
14 * Dual licensed under the MIT and GPL licenses:
15 *	http://www.opensource.org/licenses/mit-license.php
16 *	http://www.gnu.org/licenses/gpl.html
17 */
18
19(function ($, w) {
20	"use strict";
21
22	var methods = (function () {
23		// private properties and methods go here
24		var c = {
25				bcClass: 'sf-breadcrumb',
26				menuClass: 'sf-js-enabled',
27				anchorClass: 'sf-with-ul',
28				menuArrowClass: 'sf-arrows'
29			},
30			ios = (function () {
31				var ios = /iPhone|iPad|iPod/i.test(navigator.userAgent);
32				if (ios) {
33					// iOS clicks only bubble as far as body children
34					$(w).load(function () {
35						$('body').children().on('click', $.noop);
36					});
37				}
38				return ios;
39			})(),
40			wp7 = (function () {
41				var style = document.documentElement.style;
42				return ('behavior' in style && 'fill' in style && /iemobile/i.test(navigator.userAgent));
43			})(),
44			unprefixedPointerEvents = (function () {
45				return (!!w.PointerEvent);
46			})(),
47			toggleMenuClasses = function ($menu, o) {
48				var classes = c.menuClass;
49				if (o.cssArrows) {
50					classes += ' ' + c.menuArrowClass;
51				}
52				$menu.toggleClass(classes);
53			},
54			setPathToCurrent = function ($menu, o) {
55				return $menu.find('li.' + o.pathClass).slice(0, o.pathLevels)
56					.addClass(o.hoverClass + ' ' + c.bcClass)
57						.filter(function () {
58							return ($(this).children(o.popUpSelector).hide().show().length);
59						}).removeClass(o.pathClass);
60			},
61			toggleAnchorClass = function ($li) {
62				$li.children('a').toggleClass(c.anchorClass);
63			},
64			toggleTouchAction = function ($menu) {
65				var msTouchAction = $menu.css('ms-touch-action');
66				var touchAction = $menu.css('touch-action');
67				touchAction = touchAction || msTouchAction;
68				touchAction = (touchAction === 'pan-y') ? 'auto' : 'pan-y';
69				$menu.css({
70					'ms-touch-action': touchAction,
71					'touch-action': touchAction
72				});
73			},
74			applyHandlers = function ($menu, o) {
75				var targets = 'li:has(' + o.popUpSelector + ')';
76				if ($.fn.hoverIntent && !o.disableHI) {
77					$menu.hoverIntent(over, out, targets);
78				}
79				else {
80					$menu
81						.on('mouseenter.superfish', targets, over)
82						.on('mouseleave.superfish', targets, out);
83				}
84				var touchevent = 'MSPointerDown.superfish';
85				if (unprefixedPointerEvents) {
86					touchevent = 'pointerdown.superfish';
87				}
88				if (!ios) {
89					touchevent += ' touchend.superfish';
90				}
91				if (wp7) {
92					touchevent += ' mousedown.superfish';
93				}
94				$menu
95					.on('focusin.superfish', 'li', over)
96					.on('focusout.superfish', 'li', out)
97					.on(touchevent, 'a', o, touchHandler);
98			},
99			touchHandler = function (e) {
100				var $this = $(this),
101					$ul = $this.siblings(e.data.popUpSelector);
102
103				if ($ul.length > 0 && $ul.is(':hidden')) {
104					$this.one('click.superfish', false);
105					if (e.type === 'MSPointerDown' || e.type === 'pointerdown') {
106						$this.trigger('focus');
107					} else {
108						$.proxy(over, $this.parent('li'))();
109					}
110				}
111			},
112			over = function () {
113				var $this = $(this),
114					o = getOptions($this);
115				clearTimeout(o.sfTimer);
116				$this.siblings().superfish('hide').end().superfish('show');
117			},
118			out = function () {
119				var $this = $(this),
120					o = getOptions($this);
121				if (ios) {
122					$.proxy(close, $this, o)();
123				}
124				else {
125					clearTimeout(o.sfTimer);
126					o.sfTimer = setTimeout($.proxy(close, $this, o), o.delay);
127				}
128			},
129			close = function (o) {
130				o.retainPath = ($.inArray(this[0], o.$path) > -1);
131				this.superfish('hide');
132
133				if (!this.parents('.' + o.hoverClass).length) {
134					o.onIdle.call(getMenu(this));
135					if (o.$path.length) {
136						$.proxy(over, o.$path)();
137					}
138				}
139			},
140			getMenu = function ($el) {
141				return $el.closest('.' + c.menuClass);
142			},
143			getOptions = function ($el) {
144				return getMenu($el).data('sf-options');
145			};
146
147		return {
148			// public methods
149			hide: function (instant) {
150				if (this.length) {
151					var $this = this,
152						o = getOptions($this);
153					if (!o) {
154						return this;
155					}
156					var not = (o.retainPath === true) ? o.$path : '',
157						$ul = $this.find('li.' + o.hoverClass).add(this).not(not).removeClass(o.hoverClass).children(o.popUpSelector),
158						speed = o.speedOut;
159
160					if (instant) {
161						$ul.show();
162						speed = 0;
163					}
164					o.retainPath = false;
vendor: 2,862 bytes, lines 165-273
165					o.onBeforeHide.call($ul);
166					$ul.stop(true, true).animate(o.animationOut, speed, function () {
167						var $this = $(this);
168						o.onHide.call($this);
169					});
170				}
171				return this;
172			},
173			show: function () {
174				var o = getOptions(this);
175				if (!o) {
176					return this;
177				}
178				var $this = this.addClass(o.hoverClass),
179					$ul = $this.children(o.popUpSelector);
180
181				o.onBeforeShow.call($ul);
182				$ul.stop(true, true).animate(o.animation, o.speed, function () {
183					o.onShow.call($ul);
184				});
185				return this;
186			},
187			destroy: function () {
188				return this.each(function () {
189					var $this = $(this),
190						o = $this.data('sf-options'),
191						$hasPopUp;
192					if (!o) {
193						return false;
194					}
195					$hasPopUp = $this.find(o.popUpSelector).parent('li');
196					clearTimeout(o.sfTimer);
197					toggleMenuClasses($this, o);
198					toggleAnchorClass($hasPopUp);
199					toggleTouchAction($this);
200					// remove event handlers
201					$this.off('.superfish').off('.hoverIntent');
202					// clear animation's inline display style
203					$hasPopUp.children(o.popUpSelector).attr('style', function (i, style) {
204						return style.replace(/display[^;]+;?/g, '');
205					});
206					// reset 'current' path classes
207					o.$path.removeClass(o.hoverClass + ' ' + c.bcClass).addClass(o.pathClass);
208					$this.find('.' + o.hoverClass).removeClass(o.hoverClass);
209					o.onDestroy.call($this);
210					$this.removeData('sf-options');
211				});
212			},
213			init: function (op) {
214				return this.each(function () {
215					var $this = $(this);
216					if ($this.data('sf-options')) {
217						return false;
218					}
219					var o = $.extend({}, $.fn.superfish.defaults, op),
220						$hasPopUp = $this.find(o.popUpSelector).parent('li');
221					o.$path = setPathToCurrent($this, o);
222
223					$this.data('sf-options', o);
224
225					toggleMenuClasses($this, o);
226					toggleAnchorClass($hasPopUp);
227					toggleTouchAction($this);
228					applyHandlers($this, o);
229
230					$hasPopUp.not('.' + c.bcClass).superfish('hide', true);
231
232					o.onInit.call(this);
233				});
234			}
235		};
236	})();
237
238	$.fn.superfish = function (method, args) {
239		if (methods[method]) {
240			return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
241		}
242		else if (typeof method === 'object' || ! method) {
243			return methods.init.apply(this, arguments);
244		}
245		else {
246			return $.error('Method ' +  method + ' does not exist on jQuery.fn.superfish');
247		}
248	};
249
250	$.fn.superfish.defaults = {
251		popUpSelector: 'ul,.sf-mega', // within menu context
252		hoverClass: 'sfHover',
253		pathClass: 'overrideThisToUse',
254		pathLevels: 1,
255		delay: 800,
256		animation: {opacity: 'show'},
257		animationOut: {opacity: 'hide'},
258		speed: 'normal',
259		speedOut: 'fast',
260		cssArrows: true,
261		disableHI: false,
262		onInit: $.noop,
263		onBeforeShow: $.noop,
264		onShow: $.noop,
265		onBeforeHide: $.noop,
266		onHide: $.noop,
267		onIdle: $.noop,
268		onDestroy: $.noop
269	};
270
271})(jQuery, window);
272
273}

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.