PageSourceSearch

https://www.unjiu.org/profiles/panopoly/libraries/superfish/superfish.js?t8r63d

js unjiu.org collected 2026-09-24 18:03:49 UTC 4,404 bytes, 136 lines download raw bytes

1/*
2 * Superfish v1.4.8 - jQuery menu widget
3 * Copyright (c) 2008 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 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
10 */
11/*
12 * This is not the original jQuery Superfish plugin.
13 * Please refer to the README for more information.
14 */
15
16(function($){
17  $.fn.superfish = function(op){
18    var sf = $.fn.superfish,
19      c = sf.c,
20      $arrow = $(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),
21      over = function(){
22        var $$ = $(this), menu = getMenu($$);
23        clearTimeout(menu.sfTimer);
24        $$.showSuperfishUl().siblings().hideSuperfishUl();
25      },
26      out = function(){
27        var $$ = $(this), menu = getMenu($$), o = sf.op;
28        clearTimeout(menu.sfTimer);
29        menu.sfTimer=setTimeout(function(){
30          if ($$.children('.sf-clicked').length == 0){
31            o.retainPath=($.inArray($$[0],o.$path)>-1);
32            $$.hideSuperfishUl();
33            if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
34          }
35        },o.delay);
36      },
37      getMenu = function($menu){
38        var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
39        sf.op = sf.o[menu.serial];
40        return menu;
41      },
42      addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
43
44    return this.each(function() {
45      var s = this.serial = sf.o.length;
46      var o = $.extend({},sf.defaults,op);
47      o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels),
48      p = o.$path;
49      for (var l = 0; l < p.length; l++){
50        p.eq(l).addClass([o.hoverClass,c.bcClass].join(' ')).filter('li:has(ul)').removeClass(o.pathClass);
51      }
52      sf.o[s] = sf.op = o;
53
54      $('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
55        if (o.autoArrows) addArrow( $(this).children('a:first-child, span.nolink:first-child') );
56      })
57      .not('.'+c.bcClass)
58        .hideSuperfishUl();
59
60      var $a = $('a, span.nolink',this);
61      $a.each(function(i){
62        var $li = $a.eq(i).parents('li');
63        $a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
64      });
65      o.onInit.call(this);
66
67    }).each(function() {
68      var menuClasses = [c.menuClass],
69      addShadow = true;
70      if ($.browser !== undefined){
71        if ($.browser.msie && $.browser.version < 7){
72          addShadow = false;
73        }
74      }
75      if (sf.op.dropShadows && addShadow){
76        menuClasses.push(c.shadowClass);
77      }
78      $(this).addClass(menuClasses.join(' '));
79    });
80  };
81
82  var sf = $.fn.superfish;
83  sf.o = [];
84  sf.op = {};
85  sf.IE7fix = function(){
86    var o = sf.op;
87    if ($.browser !== undefined){
88      if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity != undefined) {
89        this.toggleClass(sf.c.shadowClass+'-off');
90      }
91    }
92  };
93  sf.c = {
94    bcClass: 'sf-breadcrumb',
95    menuClass: 'sf-js-enabled',
96    anchorClass: 'sf-with-ul',
97    arrowClass: 'sf-sub-indicator',
98    shadowClass: 'sf-shadow'
99  };
100  sf.defaults = {
101    hoverClass: 'sfHover',
102    pathClass: 'overideThisToUse',
103    pathLevels: 1,
104    delay: 800,
105    animation: {opacity:'show'},
106    speed: 'fast',
107    autoArrows: true,
108    dropShadows: true,
109    disableHI: false, // true disables hoverIntent detection
110    onInit: function(){}, // callback functions
111    onBeforeShow: function(){},
112    onShow: function(){},
113    onHide: function(){}
114  };
115  $.fn.extend({
116    hideSuperfishUl : function(){
117      var o = sf.op,
118        not = (o.retainPath===true) ? o.$path : '';
119      o.retainPath = false;
120      var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
121          .children('ul').addClass('sf-hidden');
122      o.onHide.call($ul);
123      return this;
124    },
125    showSuperfishUl : function(){
126      var o = sf.op,
127        sh = sf.c.shadowClass+'-off',
128        $ul = this.addClass(o.hoverClass)
129          .children('ul.sf-hidden').hide().removeClass('sf-hidden');
130      sf.IE7fix.call($ul);
131      o.onBeforeShow.call($ul);
132      $ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
133      return this;
134    }
135  });
136})(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.