PageSourceSearch

https://capiremov.org/wp-content/themes/viral-pro/js/superfish.js?ver=1.3.4

js capiremov.org collected 2026-10-02 05:48:50 UTC 10,115 bytes, 253 lines download raw bytes

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