PageSourceSearch

https://www.coredump.ch/wp-content/themes/themetrust-weston/js/superfish.js?ver=1.7.5

js coredump.ch collected 2026-09-24 09:19:57 UTC 7,548 bytes, 276 lines download raw bytes

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

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.