PageSourceSearch

https://www.harmvisserart.nl/wp-content/themes/blacksilver/js/menu/superfish.js?ver=1.0

js harmvisserart.nl collected 2026-10-10 02:08:23 UTC 8,965 bytes, 283 lines download raw bytes

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