PageSourceSearch

https://www.countryschatter.com/wp-content/themes/basemag/scripts/superfish/superfish.js?ver=1.0

js countryschatter.com collected 2026-09-25 01:22:45 UTC 7,711 bytes, 273 lines download raw bytes

vendor: 7,711 bytes, lines 1-273
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 fa-angle-down',
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) {
37				var classes = c.menuClass;
38				if (o.cssArrows) {
39					classes += ' ' + c.menuArrowClass;
40				}
41				$menu.toggleClass(classes);
42			},
43			setPathToCurrent = function ($menu, o) {
44				return $menu.find('li.' + o.pathClass).slice(0, o.pathLevels)
45					.addClass(o.hoverClass + ' ' + c.bcClass)
46						.filter(function () {
47							return ($(this).children(o.popUpSelector).hide().show().length);
48						}).removeClass(o.pathClass);
49			},
50			toggleAnchorClass = function ($li) {
51				$li.children('a').toggleClass(c.anchorClass);
52			},
53			toggleTouchAction = function ($menu) {
54				var msTouchAction = $menu.css('ms-touch-action');
55				var touchAction = $menu.css('touch-action');
56				touchAction = touchAction || msTouchAction;
57				touchAction = (touchAction === 'pan-y') ? 'auto' : 'pan-y';
58				$menu.css({
59					'ms-touch-action': touchAction,
60					'touch-action': touchAction
61				});
62			},
63			applyHandlers = function ($menu, o) {
64				var targets = 'li:has(' + o.popUpSelector + ')';
65				if ($.fn.hoverIntent && !o.disableHI) {
66					$menu.hoverIntent(over, out, targets);
67				}
68				else {
69					$menu
70						.on('mouseenter.superfish', targets, over)
71						.on('mouseleave.superfish', targets, out);
72				}
73				var touchevent = 'MSPointerDown.superfish';
74				if (unprefixedPointerEvents) {
75					touchevent = 'pointerdown.superfish';
76				}
77				if (!ios) {
78					touchevent += ' touchend.superfish';
79				}
80				if (wp7) {
81					touchevent += ' mousedown.superfish';
82				}
83				$menu
84					.on('focusin.superfish', 'li', over)
85					.on('focusout.superfish', 'li', out)
86					.on(touchevent, 'a', o, touchHandler);
87			},
88			touchHandler = function (e) {
89				var $this = $(this),
90					o = getOptions($this),
91					$ul = $this.siblings(e.data.popUpSelector);
92
93				if (o.onHandleTouch.call($ul) === false) {
94					return this;
95				}
96
97				if ($ul.length > 0 && $ul.is(':hidden')) {
98					$this.one('click.superfish', false);
99					if (e.type === 'MSPointerDown' || e.type === 'pointerdown') {
100						$this.trigger('focus');
101					} else {
102						$.proxy(over, $this.parent('li'))();
103					}
104				}
105			},
106			over = function () {
107				var $this = $(this),
108					o = getOptions($this);
109				clearTimeout(o.sfTimer);
110				$this.siblings().superfish('hide').end().superfish('show');
111			},
112			out = function () {
113				var $this = $(this),
114					o = getOptions($this);
115				if (ios) {
116					$.proxy(close, $this, o)();
117				}
118				else {
119					clearTimeout(o.sfTimer);
120					o.sfTimer = setTimeout($.proxy(close, $this, o), o.delay);
121				}
122			},
123			close = function (o) {
124				o.retainPath = ($.inArray(this[0], o.$path) > -1);
125				this.superfish('hide');
126
127				if (!this.parents('.' + o.hoverClass).length) {
128					o.onIdle.call(getMenu(this));
129					if (o.$path.length) {
130						$.proxy(over, o.$path)();
131					}
132				}
133			},
134			getMenu = function ($el) {
135				return $el.closest('.' + c.menuClass);
136			},
137			getOptions = function ($el) {
138				return getMenu($el).data('sf-options');
139			};
140
141		return {
142			// public methods
143			hide: function (instant) {
144				if (this.length) {
145					var $this = this,
146						o = getOptions($this);
147					if (!o) {
148						return this;
149					}
150					var not = (o.retainPath === true) ? o.$path : '',
151						$ul = $this.find('li.' + o.hoverClass).add(this).not(not).removeClass(o.hoverClass).children(o.popUpSelector),
152						speed = o.speedOut;
153
154					if (instant) {
155						$ul.show();
156						speed = 0;
157					}
158					o.retainPath = false;
159
160					if (o.onBeforeHide.call($ul) === false) {
161						return this;
162					}
163
164					$ul.stop(true, true).animate(o.animationOut, speed, function () {
165						var $this = $(this);
166						o.onHide.call($this);
167					});
168				}
169				return this;
170			},
171			show: function () {
172				var o = getOptions(this);
173				if (!o) {
174					return this;
175				}
176				var $this = this.addClass(o.hoverClass),
177					$ul = $this.children(o.popUpSelector);
178
179				if (o.onBeforeShow.call($ul) === false) {
180					return this;
181				}
182
183				$ul.stop(true, true).animate(o.animation, o.speed, function () {
184					o.onShow.call($ul);
185				});
186				return this;
187			},
188			destroy: function () {
189				return this.each(function () {
190					var $this = $(this),
191						o = $this.data('sf-options'),
192						$hasPopUp;
193					if (!o) {
194						return false;
195					}
196					$hasPopUp = $this.find(o.popUpSelector).parent('li');
197					clearTimeout(o.sfTimer);
198					toggleMenuClasses($this, o);
199					toggleAnchorClass($hasPopUp);
200					toggleTouchAction($this);
201					// remove event handlers
202					$this.off('.superfish').off('.hoverIntent');
203					// clear animation's inline display style
204					$hasPopUp.children(o.popUpSelector).attr('style', function (i, style) {
205						return style.replace(/display[^;]+;?/g, '');
206					});
207					// reset 'current' path classes
208					o.$path.removeClass(o.hoverClass + ' ' + c.bcClass).addClass(o.pathClass);
209					$this.find('.' + o.hoverClass).removeClass(o.hoverClass);
210					o.onDestroy.call($this);
211					$this.removeData('sf-options');
212				});
213			},
214			init: function (op) {
215				return this.each(function () {
216					var $this = $(this);
217					if ($this.data('sf-options')) {
218						return false;
219					}
220					var o = $.extend({}, $.fn.superfish.defaults, op),
221						$hasPopUp = $this.find(o.popUpSelector).parent('li');
222					o.$path = setPathToCurrent($this, o);
223
224					$this.data('sf-options', o);
225
226					toggleMenuClasses($this, o);
227					toggleAnchorClass($hasPopUp);
228					toggleTouchAction($this);
229					applyHandlers($this, o);
230
231					$hasPopUp.not('.' + c.bcClass).superfish('hide', true);
232
233					o.onInit.call(this);
234				});
235			}
236		};
237	})();
238
239	$.fn.superfish = function (method, args) {
240		if (methods[method]) {
241			return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
242		}
243		else if (typeof method === 'object' || ! method) {
244			return methods.init.apply(this, arguments);
245		}
246		else {
247			return $.error('Method ' +  method + ' does not exist on jQuery.fn.superfish');
248		}
249	};
250
251	$.fn.superfish.defaults = {
252		popUpSelector: 'ul,.sf-mega', // within menu context
253		hoverClass: 'sfHover',
254		pathClass: 'overrideThisToUse',
255		pathLevels: 1,
256		delay: 800,
257		animation: {opacity: 'show'},
258		animationOut: {opacity: 'hide'},
259		speed: 'normal',
260		speedOut: 'fast',
261		cssArrows: true,
262		disableHI: false,
263		onInit: $.noop,
264		onBeforeShow: $.noop,
265		onShow: $.noop,
266		onBeforeHide: $.noop,
267		onHide: $.noop,
268		onIdle: $.noop,
269		onDestroy: $.noop,
270		onHandleTouch: $.noop
271	};
272
273})(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.