PageSourceSearch

https://myoko-nagano.com/wp-content/themes/sixteen/js/superfish.js?ver=7.0.6

js myoko-nagano.com collected 2026-10-02 13:29:51 UTC 5,935 bytes, 207 lines download raw bytes

1
2/*
3 * Superfish v1.5.13 - 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(){
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
26				var close = function(){
27					o.retainPath=($.inArray($$[0],o.$path)>-1);
28					$$.hideSuperfishUl();
29					if (o.$path.length && $$.parents('li.'+o.hoverClass).length<1){
30						o.onIdle.call();
31						$.proxy(over,o.$path,e)();
32					}
33				};
34				if (e.type === 'click'){
35					close();
36				} else {
37					clearTimeout(menu.sfTimer);
38					menu.sfTimer=setTimeout(close,o.delay);
39				}
40			},
41			getMenu = function($child){
42				if ($child.hasClass(c.menuClass)){
43					$.error('Superfish requires you to update to a version of hoverIntent that supports event-delegation, such as this one: https://github.com/joeldbirch/onHoverIntent');
44				}
45				var menu = $child.closest('.'+c.menuClass)[0];
46				sf.op = sf.o[menu.serial];
47				return menu;
48			},
49			applyTouchAction = function($menu){
50       //needed by MS pointer events
51				$menu.css('ms-touch-action','none');
52			},
53			applyHandlers = function($menu){
54				var targets = 'li:has(ul)';
55				if (!sf.op.useClick){
56					if ($.fn.hoverIntent && !sf.op.disableHI){
57						$menu.hoverIntent(over, out, targets);
58					} else {
59						$menu
60							.on('mouseenter', targets, over)
61							.on('mouseleave', targets, out);
62					}
63				}
64				var touchstart = 'MSPointerDown';
65				//Sorry, but avoiding weird glitches with touchstart. iOS doesn't need it, anyway.
66				if ( !navigator.userAgent.toLowerCase().match(/(iphone|ipod|ipad)/) ){
67					touchstart += ' touchstart';
68				}
69				$menu
70					.on('focusin', 'li', over)
71					.on('focusout', 'li', out)
72					.on('click', 'a', clickHandler)
73					.on(touchstart, 'a', touchHandler);
74			},
75			touchHandler = function(e){
76        var $$ = $(this),
77          $ul = $$.siblings('ul');
78        if ($ul.length > 0 && !$ul.is(':visible')){
79          $$.data('follow', false);
80          if (e.type === 'MSPointerDown'){
81						$$.trigger('focus');
82						return false;
83					}
84        }
85      },
86			clickHandler = function(e){
87				var $a = $(this),
88						$submenu = $a.siblings('ul'),
89						follow = ($a.data('follow') === false) ? false : true;
90
91				if ( $submenu.length && (sf.op.useClick || !follow) ){
92					e.preventDefault();
93					if (!$submenu.is(':visible')){
94						$.proxy(over,$a.parent('li'))();
95					} else if (sf.op.useClick && follow) {
96						$.proxy(out,$a.parent('li'),e)();
97					}
98				}
99			},
100			addArrows = function($li,o){
101				if (o.autoArrows) {
102					$li.children('a').each(function() {
103						addArrow( $(this) );
104					});
105				}
106			},
107			addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
108
109		return this.addClass(c.menuClass).each(function() {
110			var s = this.serial = sf.o.length;
111			var o = $.extend({},sf.defaults,op);
112			var $$ = $(this);
113			var $liHasUl = $$.find('li:has(ul)');
114			o.$path = $$.find('li.'+o.pathClass).slice(0,o.pathLevels).each(function(){
115				$(this).addClass(o.hoverClass+' '+c.bcClass)
116					.filter('li:has(ul)').removeClass(o.pathClass);
117			});
118			sf.o[s] = sf.op = o;
119
120			addArrows($liHasUl,o);
121			applyTouchAction($$);
122			applyHandlers($$);
123
124			$liHasUl.not('.'+c.bcClass).children('ul').show().hide();
125
126			o.onInit.call(this);
127
128		});
129	};
130
131	var sf = $.fn.superfish;
132	sf.o = [];
133	sf.op = {};
134
135	sf.c = {
136		bcClass     : 'sf-breadcrumb',
137		menuClass   : 'sf-js-enabled',
138		anchorClass : 'sf-with-ul',
139		arrowClass  : 'sf-sub-indicator'
140	};
141	sf.defaults = {
142		hoverClass	: 'sfHover',
143		pathClass	: 'overideThisToUse',
144		pathLevels	: 1,
145		delay		: 800,
146		animation	: {opacity:'show'},
147		animationOut: {opacity:'hide'},
148		speed		: 'normal',
149		speedOut : 'fast',
150		autoArrows	: true,
151		disableHI	: false,		// true disables hoverIntent detection
152		useClick : false,
153		onInit		: function(){}, // callback functions
154		onBeforeShow: function(){},
155		onShow		: function(){},
156		onHide		: function(){},
157		onIdle		: function(){}
158	};
159	$.fn.extend({
160		hideSuperfishUl : function(){
161			var o = sf.op,
162				$$ = this,
163				not = (o.retainPath===true) ? o.$path : '';
164			o.retainPath = false;
165			$('li.'+o.hoverClass,this).add(this).not(not)
166				.children('ul').stop(true,true).animate(o.animationOut,o.speedOut,function(){
167					$ul = $(this);
168					$ul.parent().removeClass(o.hoverClass);
169					o.onHide.call($ul);
170					if (sf.op.useClick){
171						$$.children('a').data('follow', false);
172					}
173				});
174			return this;
175		},
176		showSuperfishUl : function(){
177			var o = sf.op,
178				$$ = this,
179				$ul = this.children('ul');
180			$$.addClass(o.hoverClass);
181			o.onBeforeShow.call($ul);
182			$ul.stop(true,true).animate(o.animation,o.speed,function(){
183				o.onShow.call($ul);
184				$$.children('a').data('follow', true);
185			});
186
187            //ADDED FOR REVERSE MENU IF WIDER THAN BROWSER WINDOW.
188            // David Cooper, 9/23/11
189            var ww = $(window).width();
190            var subUL = this.children("ul").first();
191            if ( subUL.length > 0 ) {
192                var locUL = this.children("ul").first().offset().left + subUL.width();
193                if (locUL > ww) {
194                    var par = subUL.parent().parent();
195                    if(par.hasClass("sf-menu")){ //1st sub-menu level
196                        subUL.css('left', "-"+(locUL-ww)+"px");
197                    }else{ //2nd sub-menu level
198                        subUL.addClass('reversed').css('left', "-"+(subUL.width()+0)+"px");
199                    }
200                }
201            }
202
203			return this;
204		}
205	});
206
207})(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.