From 1bcd45c31533f1b47c60a77fc71a4b98ce7620c0 Mon Sep 17 00:00:00 2001 From: ewinslow Date: Tue, 9 Nov 2010 00:54:12 +0000 Subject: jslinted ui.widgets.js git-svn-id: http://code.elgg.org/elgg/trunk@7264 36083f99-b078-4883-b0ff-0f9b5a30f544 --- js/lib/ui.widgets.js | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'js') diff --git a/js/lib/ui.widgets.js b/js/lib/ui.widgets.js index 1e3163709..bce5aea0f 100644 --- a/js/lib/ui.widgets.js +++ b/js/lib/ui.widgets.js @@ -24,13 +24,13 @@ elgg.ui.widgets.init = function() { opacity: 0.9, appendTo: 'body', connectWith: els, - stop: function(e,ui) { + stop: function(e, ui) { // refresh list before updating hidden fields with new widget order $(this).sortable("refresh"); - var widgetNamesLeft = outputWidgetList('#leftcolumn_widgets'); - var widgetNamesMiddle = outputWidgetList('#middlecolumn_widgets'); - var widgetNamesRight = outputWidgetList('#rightcolumn_widgets'); + var widgetNamesLeft = elgg.ui.widgets.outputList('#leftcolumn_widgets'), + widgetNamesMiddle = elgg.ui.widgets.outputList('#middlecolumn_widgets'), + widgetNamesRight = elgg.ui.widgets.outputList('#rightcolumn_widgets'); $('#debugField1').val(widgetNamesLeft); $('#debugField2').val(widgetNamesMiddle); @@ -44,15 +44,14 @@ elgg.ui.widgets.init = function() { //List active widgets for each page column elgg.ui.widgets.outputList = function(forElement) { - return( $("input[name='handler'], input[name='guid']", forElement ).makeDelimitedList("value") ); + return $("input[name='handler'], input[name='guid']", forElement).makeDelimitedList("value"); }; //Read each widgets collapsed/expanded state from cookie and apply elgg.ui.widgets.state = function(forWidget) { - var thisWidgetState = elgg.session.cookie(forWidget); - if (thisWidgetState == 'collapsed') { + if (thisWidgetState === 'collapsed') { forWidget = "#" + forWidget; $(forWidget).find("div.collapsable_box_content").hide(); $(forWidget).find("a.toggle_box_contents").html('+'); @@ -64,17 +63,17 @@ elgg.ui.widgets.state = function(forWidget) { elgg.ui.widgets.moreinfo = function() { $("img.more_info").hover(function(e) { var widgetdescription = $("input[name='description']", this.parentNode.parentNode.parentNode).val(); - $("body").append("

"+ widgetdescription +"

"); + $("body").append("

" + widgetdescription + "

"); if (e.pageX < 900) { $("#widget_moreinfo") - .css("top",(e.pageY + 10) + "px") - .css("left",(e.pageX + 10) + "px") + .css("top", (e.pageY + 10) + "px") + .css("left", (e.pageX + 10) + "px") .fadeIn("medium"); } else { $("#widget_moreinfo") - .css("top",(e.pageY + 10) + "px") - .css("left",(e.pageX - 210) + "px") + .css("top", (e.pageY + 10) + "px") + .css("left", (e.pageX - 210) + "px") .fadeIn("medium"); } }, function() { @@ -84,15 +83,17 @@ elgg.ui.widgets.moreinfo = function() { //Toggle widgets contents and save to a cookie elgg.ui.widgets.toggleContent = function(e) { - var targetContent = $('div.collapsable_box_content', this.parentNode.parentNode); - if (targetContent.css('display') == 'none') { + var thisWidgetName, + targetContent = $('div.collapsable_box_content', this.parentNode.parentNode); + + if (targetContent.css('display') === 'none') { targetContent.slideDown(400); $(this).html('-'); $(this.parentNode).children(".toggle_box_edit_panel").fadeIn('medium'); // set cookie for widget panel open-state - var thisWidgetName = $(this.parentNode.parentNode.parentNode).attr('id'); - $.cookie(thisWidgetName, 'expanded', { expires: 365 }); + thisWidgetName = $(this.parentNode.parentNode.parentNode).attr('id'); + elgg.session.cookie(thisWidgetName, 'expanded', {expires: 365 }); } else { targetContent.slideUp(400); @@ -102,8 +103,8 @@ elgg.ui.widgets.toggleContent = function(e) { $(this.parentNode.parentNode).children(".collapsable_box_editpanel").hide(); // set cookie for widget panel closed-state - var thisWidgetName = $(this.parentNode.parentNode.parentNode).attr('id'); - $.cookie(thisWidgetName, 'collapsed', { expires: 365 }); + thisWidgetName = $(this.parentNode.parentNode.parentNode).attr('id'); + elgg.session.cookie(thisWidgetName, 'collapsed', { expires: 365 }); } return false; }; -- cgit v1.2.3