PageSourceSearch

https://www.joomconnect.com/templates/kallyas/addons/superfish_responsive/superfish_menu.js

js joomconnect.com collected 2026-10-03 23:37:54 UTC 9,959 bytes, 180 lines download raw bytes

1/**
2 * hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+
3 * <http://cherne.net/brian/resources/jquery.hoverIntent.html>
4 *
5 * @param  f  onMouseOver function || An object with configuration options
6 * @param  g  onMouseOut function  || Nothing (use configuration options object)
7 * @author    Brian Cherne brian(at)cherne(dot)net
8
9(function(a){a.fn.hoverIntent=function(b,c){var d={sensitivity:7,interval:100,timeout:0};d=a.extend(d,c?{over:b,out:c}:b);var e,f,g,h;var i=function(a){e=a.pageX;f=a.pageY};var j=function(b,c){c.hoverIntent_t=clearTimeout(c.hoverIntent_t);if(Math.abs(g-e)+Math.abs(h-f)<d.sensitivity){a(c).unbind("mousemove",i);c.hoverIntent_s=1;return d.over.apply(c,[b])}else{g=e;h=f;c.hoverIntent_t=setTimeout(function(){j(b,c)},d.interval)}};var k=function(a,b){b.hoverIntent_t=clearTimeout(b.hoverIntent_t);b.hoverIntent_s=0;return d.out.apply(b,[a])};var l=function(b){var c=jQuery.extend({},b);var e=this;if(e.hoverIntent_t){e.hoverIntent_t=clearTimeout(e.hoverIntent_t)}if(b.type=="mouseenter"){g=c.pageX;h=c.pageY;a(e).bind("mousemove",i);if(e.hoverIntent_s!=1){e.hoverIntent_t=setTimeout(function(){j(c,e)},d.interval)}}else{a(e).unbind("mousemove",i);if(e.hoverIntent_s==1){e.hoverIntent_t=setTimeout(function(){k(c,e)},d.timeout)}}};return this.bind("mouseenter",l).bind("mouseleave",l)}})(jQuery);
10 */
11/*
12 * Superfish v1.4.8 - jQuery menu widget
13 * Copyright (c) 2008 Joel Birch
14 *
15 * Dual licensed under the MIT and GPL licenses:
16 * 	http://www.opensource.org/licenses/mit-license.php
17 * 	http://www.gnu.org/licenses/gpl.html
18 *
19 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
20 */
21
22/*
23 * Superfish v1.4.8 - jQuery menu widget
24 * Copyright (c) 2008 Joel Birch
25 *
26 * Dual licensed under the MIT and GPL licenses:
27 *  http://www.opensource.org/licenses/mit-license.php
28 *  http://www.gnu.org/licenses/gpl.html
29 *
30 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
31 */
32 
33;(function($){
34    $.fn.superfish = function(op){
35 
36        var sf = $.fn.superfish,
37            c = sf.c,
38            $arrow = $(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),
39            over = function(){
40                var $$ = $(this), menu = getMenu($$);
41                clearTimeout(menu.sfTimer);
42                $$.showSuperfishUl().siblings().hideSuperfishUl();
43            },
44            out = function(){
45                var $$ = $(this), menu = getMenu($$), o = sf.op;
46                clearTimeout(menu.sfTimer);
47                menu.sfTimer=setTimeout(function(){
48                    o.retainPath=($.inArray($$[0],o.$path)>-1);
49                    $$.hideSuperfishUl();
50                    if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
51                },o.delay); 
52            },
53            getMenu = function($menu){
54                var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
55                sf.op = sf.o[menu.serial];
56                return menu;
57            },
58            addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
59             
60        return this.each(function() {
61            var s = this.serial = sf.o.length;
62            var o = $.extend({},sf.defaults,op);
63            o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
64                $(this).addClass([o.hoverClass,c.bcClass].join(' '))
65                    .filter('li:has(ul)').removeClass(o.pathClass);
66            });
67            sf.o[s] = sf.op = o;
68             
69            $('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
70                if (o.autoArrows) addArrow( $('>a:first-child',this) );
71            })
72            .not('.'+c.bcClass)
73                .hideSuperfishUl();
74             
75            var $a = $('a',this);
76            $a.each(function(i){
77                var $li = $a.eq(i).parents('li');
78                $a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
79            });
80            o.onInit.call(this);
81             
82        }).each(function() {
83            var menuClasses = [c.menuClass];
84            if (sf.op.dropShadows  && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
85            $(this).addClass(menuClasses.join(' '));
86        });
87    };
88 
89    var sf = $.fn.superfish;
90    sf.o = [];
91    sf.op = {};
92    sf.IE7fix = function(){
93        var o = sf.op;
94        if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
95            this.toggleClass(sf.c.shadowClass+'-off');
96        };
97    sf.c = {
98        bcClass     : 'sf-breadcrumb',
99        menuClass   : 'sf-js-enabled',
100        anchorClass : 'sf-with-ul',
101        arrowClass  : 'sf-sub-indicator',
102        shadowClass : 'sf-shadow'
103    };
104    sf.defaults = {
105        hoverClass  : 'sfHover',
106        pathClass   : 'overideThisToUse',
107        pathLevels  : 1,
108        delay       : 800,
109        animation   : {opacity:'show'},
110        speed       : 'normal',
111        autoArrows  : true,
112        dropShadows : true,
113        disableHI   : false,        // true disables hoverIntent detection
114        onInit      : function(){}, // callback functions
115        onBeforeShow: function(){},
116        onShow      : function(){},
117        onHide      : function(){}
118    };
119    $.fn.extend({
120        hideSuperfishUl : function(){
121            var o = sf.op,
122                not = (o.retainPath===true) ? o.$path : '';
123            o.retainPath = false;
124            var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
125                    .find('>ul').hide().css('visibility','hidden');
126            o.onHide.call($ul);
127            return this;
128        },
129        showSuperfishUl : function(){
130            var o = sf.op,
131                sh = sf.c.shadowClass+'-off',
132                $ul = this.addClass(o.hoverClass)
133                    .find('>ul:hidden').css('visibility','visible');
134            sf.IE7fix.call($ul);
135            o.onBeforeShow.call($ul);
136            $ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
137			
138			//ADDED FOR REVERSE MENU IF WIDER THAN BROWSER WINDOW.
139			// David Cooper, 9/23/11
140			var ww = $(window).width();
141			var subUL = this.children("ul").first();
142            var locUL = subUL.offset().left + subUL.width();
143            if (locUL > ww) { 
144                var par = subUL.parent().parent();
145                if(par.hasClass("sf-menu")){ //1st sub-menu level
146                    subUL.css('left', "-"+(locUL-ww)+"px");
147                }else{ //2nd sub-menu level
148                    subUL.addClass('reversed').css('left', "-"+(subUL.width()+15)+"px"); 
149                }
150            } 
151			
152            return this;
153        }
154    });
155 
156})(jQuery);
157
158/*
159 * Supersubs v0.2b - jQuery plugin
160 * Copyright (c) 2008 Joel Birch
161 *
162 * Dual licensed under the MIT and GPL licenses:
163 *  http://www.opensource.org/licenses/mit-license.php
164 *  http://www.gnu.org/licenses/gpl.html
165 *
166 *
167 * This plugin automatically adjusts submenu widths of suckerfish-style menus to that of
168 * their longest list item children. If you use this, please expect bugs and report them
169 * to the jQuery Google Group with the word 'Superfish' in the subject line.
170 *
171 */
172;(function(a){a.fn.supersubs=function(b){var c=a.extend({},a.fn.supersubs.defaults,b);return this.each(function(){var b=a(this);var d=a.meta?a.extend({},c,b.data()):c;var e=a('<li id="menu-fontsize">&#8212;</li>').css({padding:0,position:"absolute",top:"-999em",width:"auto"}).appendTo(b).width();a("#menu-fontsize").remove();$ULs=b.find("ul");$ULs.each(function(b){var c=$ULs.eq(b);var f=c.children();var g=f.children("a");var h=f.css("white-space","nowrap").css("float");var i=c.add(f).add(g).css({"float":"none",width:"auto"}).end().end()[0].clientWidth/e;i+=d.extraWidth;if(i>d.maxWidth){i=d.maxWidth}else if(i<d.minWidth){i=d.minWidth}i+="em";c.css("width",i);f.css({"float":h,width:"100%","white-space":"normal"}).each(function(){var b=a(">ul",this);var c=b.css("left")!==undefined?"left":"right";b.css(c,i)})})})};a.fn.supersubs.defaults={minWidth:9,maxWidth:25,extraWidth:0}})(jQuery);
173
174/*
175 * https://github.com/mattkersley/Responsive-Menu
176 */
177(function(a){var b=0;a.fn.mobileMenu=function(c){function e(a){return a.is("ul, ol")}function f(){return a(window).width()<d.switchWidth}function g(c){if(c.attr("id")){return a("#mobileMenu_"+c.attr("id")).length>0}else{b++;c.attr("id","mm"+b);return a("#mobileMenu_mm"+b).length>0}}
177function h(a){if(a.val()!==null){document.location.href=a.val()}}function j(b){b.css("display","none");a("#mobileMenu_"+b.attr("id")).show()}function k(b){b.css("display","");a("#mobileMenu_"+b.attr("id")).hide()}function l(b){if(e(b)){var c='<select id="mobileMenu_'+b.attr("id")+'" class="mobileMenu">';c+='<option value="">'+d.topOptionText+"</option>";b.find("li").each(function(){var b="";var e=a(this).parents("ul, ol").length;for(i=1;i<e;i++){b+=d.indentString}var f=a(this).find("a:first-child").attr("href");var g=b+a(this).clone().children("ul, ol").remove().end().text();c+='<option value="'+f+'">'+g+"</option>"});c+="</select>";b.parent().append(c);a("#mobileMenu_"+b.attr("id")).change(function(){h(a(this))});j(b)}else{alert("mobileMenu will only work with UL or OL elements!")}}function m(a){if(f()&&!g(a)){l(a)}else if(f()&&g(a)){j(a)}else if(!f()&&g(a)){k(a)}}var d={switchWidth:768,topOptionText:"Select a page",indentString:"   "};return this.each(function(){if(c){a.extend(d,c)}var b=a(this);a(window).resize(function(){m(b);});m(b);
178var pathName = a(location).attr('pathname'), pathHref = a(location).attr('href'), pathArray = pathHref.split('/'), pathInd = a(pathArray).last()[0], path = pathName.replace('index.php',''), pathFin = path+''+pathInd;
179a('.mobileMenu option[value="' + pathFin + '"]').attr('selected', 'selected');})}
180})(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.