From 08cd6c97989e3485ae30ec895b2fd7e6d7a3d007 Mon Sep 17 00:00:00 2001 From: ewinslow Date: Tue, 9 Nov 2010 00:50:31 +0000 Subject: jslinted ui.js git-svn-id: http://code.elgg.org/elgg/trunk@7263 36083f99-b078-4883-b0ff-0f9b5a30f544 --- js/lib/ui.js | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'js/lib') diff --git a/js/lib/ui.js b/js/lib/ui.js index 4a9c64e70..c079abda2 100644 --- a/js/lib/ui.js +++ b/js/lib/ui.js @@ -43,7 +43,7 @@ elgg.ui.toggleCollapsibleBox = function () { var root = this, zIndex = 5000; function getSubnav(ele) { - if (ele.nodeName.toLowerCase() == 'li') { + if (ele.nodeName.toLowerCase() === 'li') { var subnav = $('> ul', ele); return subnav.length ? subnav[0] : null; } else { @@ -52,7 +52,7 @@ elgg.ui.toggleCollapsibleBox = function () { } function getActuator(ele) { - if (ele.nodeName.toLowerCase() == 'ul') { + if (ele.nodeName.toLowerCase() === 'ul') { return $(ele).parents('li')[0]; } else { return ele; @@ -74,17 +74,19 @@ elgg.ui.toggleCollapsibleBox = function () { } function show() { - var subnav = getSubnav(this); + var subnav = getSubnav(this), li; + if (!subnav) { return; } $.data(subnav, 'cancelHide', true); - $(subnav).css({zIndex: zIndex++}).slideDown(options.speed); + $(subnav).css({zIndex: zIndex}).slideDown(options.speed); + zIndex++; - if (this.nodeName.toLowerCase() == 'ul') { - var li = getActuator(this); + if (this.nodeName.toLowerCase() === 'ul') { + li = getActuator(this); $(li).addClass('hover'); $('> a', li).addClass('hover'); } @@ -92,8 +94,14 @@ elgg.ui.toggleCollapsibleBox = function () { $('ul, li', this).hover(show, hide); $('li', this).hover( - function() { $(this).addClass('hover'); $('> a', this).addClass('hover'); }, - function() { $(this).removeClass('hover'); $('> a', this).removeClass('hover'); } + function () { + $(this).addClass('hover'); + $('> a', this).addClass('hover'); + }, + function () { + $(this).removeClass('hover'); + $('> a', this).removeClass('hover'); + } ); }); @@ -102,8 +110,8 @@ elgg.ui.toggleCollapsibleBox = function () { //Make delimited list $.fn.makeDelimitedList = function(elementAttribute) { - var delimitedListArray = []; - var listDelimiter = "::"; + var delimitedListArray = [], + listDelimiter = "::"; // Loop over each element in the stack and add the elementAttribute to the array this.each(function(e) { @@ -114,7 +122,7 @@ elgg.ui.toggleCollapsibleBox = function () { ); // Return value list by joining the array - return(delimitedListArray.join(listDelimiter)); + return delimitedListArray.join(listDelimiter); }; })(jQuery); -- cgit v1.2.3