Skip to content

Commit 82c926d

Browse files
committed
Improve naming and styling.
1 parent 4b35656 commit 82c926d

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

superfish.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515

1616
(function($){
17-
$.fn.superfish = function(op){
17+
$.fn.superfish = function(options){
1818
var sf = $.fn.superfish,
1919
c = sf.c,
2020
$arrow = $(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),
@@ -26,11 +26,13 @@
2626
out = function(){
2727
var $$ = $(this), menu = getMenu($$), o = sf.op;
2828
clearTimeout(menu.sfTimer);
29-
menu.sfTimer=setTimeout(function(){
29+
menu.sfTimer = setTimeout(function(){
3030
if ($$.children('.sf-clicked').length == 0){
31-
o.retainPath=($.inArray($$[0],o.$path)>-1);
31+
o.retainPath = ($.inArray($$[0],o.$path)>-1);
3232
$$.hideSuperfishUl();
33-
if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
33+
if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length < 1){
34+
over.call(o.$path);
35+
}
3436
}
3537
},o.delay);
3638
},
@@ -43,8 +45,8 @@
4345

4446
return this.each(function() {
4547
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+
var o= $.extend({},sf.defaults,options);
49+
o.$path = $('li.' + o.pathClass,this).slice(0,o.pathLevels);
4850
var p = o.$path;
4951
for (var l = 0; l < p.length; l++){
5052
p.eq(l).addClass([o.hoverClass,c.bcClass].join(' ')).filter('li:has(ul)').removeClass(o.pathClass);
@@ -54,8 +56,7 @@
5456
$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
5557
if (o.autoArrows) addArrow( $(this).children('a:first-child, span.nolink:first-child') );
5658
})
57-
.not('.'+c.bcClass)
58-
.hideSuperfishUl();
59+
.not('.' + c.bcClass).hideSuperfishUl();
5960

6061
var $a = $('a, span.nolink',this);
6162
$a.each(function(i){
@@ -89,7 +90,7 @@
8990
pathClass: 'overideThisToUse',
9091
pathLevels: 1,
9192
delay: 800,
92-
animation: {opacity:'show'},
93+
animation: {opacity: 'show'},
9394
speed: 'fast',
9495
autoArrows: true,
9596
dropShadows: true,
@@ -101,8 +102,8 @@
101102
};
102103
$.fn.extend({
103104
hideSuperfishUl : function(){
104-
var o = sf.op,
105-
not = (o.retainPath===true) ? o.$path : '';
105+
var o = sf.op;
106+
var not = (o.retainPath === true) ? o.$path : '';
106107
o.retainPath = false;
107108
var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
108109
.children('ul').addClass('sf-hidden');
@@ -111,11 +112,10 @@
111112
},
112113
showSuperfishUl : function(){
113114
var o = sf.op,
114-
sh = sf.c.shadowClass+'-off',
115-
$ul = this.addClass(o.hoverClass)
116-
.children('ul.sf-hidden').hide().removeClass('sf-hidden');
115+
sh = sf.c.shadowClass + '-off',
116+
$ul = this.addClass(o.hoverClass).children('ul.sf-hidden').hide().removeClass('sf-hidden');
117117
o.onBeforeShow.call($ul);
118-
$ul.animate(o.animation,o.speed,function(){ o.onShow.call($ul); });
118+
$ul.animate(o.animation, o.speed, function(){ o.onShow.call($ul); });
119119
return this;
120120
}
121121
});

supersubs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
if ($ULs.length) {
3636
// get the font size of menu.
3737
// .css('fontSize') returns various results cross-browser, so measure an em dash instead
38-
var fontsize = $('<li id="menu-fontsize">&#8212;</li>'),
38+
var fontsize = $('<li id="menu-fontsize">&#8212;</li>');
3939
var size = fontsize.attr('style','padding:0;position:absolute;top:-99999em;width:auto;')
4040
.appendTo($$)[0].clientWidth; //clientWidth is faster than width()
4141
// remove em dash

0 commit comments

Comments
 (0)