Workaround image magick issue with greyscale xcf files
[lhc/web/wiklou.git] / skins / vector / collapsibleTabs.js
index 0e49744..e24bea9 100644 (file)
@@ -9,7 +9,7 @@
                        return this;
                }
                // Merge options into the defaults
-               var $settings = $.extend( {}, $.collapsibleTabs.defaults, options );
+               var settings = $.extend( {}, $.collapsibleTabs.defaults, options );
 
                this.each( function () {
                        var $el = $( this );
@@ -17,9 +17,9 @@
                        $.collapsibleTabs.instances = ( $.collapsibleTabs.instances.length === 0 ?
                                $el : $.collapsibleTabs.instances.add( $el ) );
                        // attach the settings to the elements
-                       $el.data( 'collapsibleTabsSettings', $settings );
+                       $el.data( 'collapsibleTabsSettings', settings );
                        // attach data to our collapsible elements
-                       $el.children( $settings.collapsible ).each( function () {
+                       $el.children( settings.collapsible ).each( function () {
                                $.collapsibleTabs.addData( $( this ) );
                        } );
                } );
                $.collapsibleTabs.handleResize();
                return this;
        };
-       /**
-        * Returns the amount of horizontal distance between the two tabs groups
-        * (#left-navigation and #right-navigation), in pixels. If negative, this
-        * means that the tabs overlap, and the value is the width of overlapping
-        * parts.
-        *
-        * Used in default expandCondition and collapseCondition.
-        *
-        * @return {Numeric} distance/overlap in pixels
-        */
-       function calculateTabDistance() {
-               var $leftTab, $rightTab, leftEnd, rightStart;
-
-               // In RTL, #right-navigation is actually on the left and vice versa.
-               // Hooray for descriptive naming.
-               if ( !rtl ) {
-                       $leftTab = $( '#left-navigation' );
-                       $rightTab = $( '#right-navigation' );
-               } else {
-                       $leftTab = $( '#right-navigation' );
-                       $rightTab = $( '#left-navigation' );
-               }
-
-               leftEnd = $leftTab.offset().left + $leftTab.width();
-               rightStart = $rightTab.offset().left;
-
-               return rightStart - leftEnd;
-       }
        $.collapsibleTabs = {
                instances: [],
                boundEvent: null,
                        shifting: false,
                        expandCondition: function ( eleWidth ) {
                                // If there are at least eleWidth + 1 pixels of free space, expand.
-                               // We add 1 because .width() will truncate fractional values
-                               // but .offset() will not.
-                               return calculateTabDistance() >= (eleWidth + 1);
+                               // We add 1 because .width() will truncate fractional values but .offset() will not.
+                               return $.collapsibleTabs.calculateTabDistance() >= eleWidth + 1;
                        },
                        collapseCondition: function () {
                                // If there's an overlap, collapse.
-                               return calculateTabDistance() < 0;
+                               return $.collapsibleTabs.calculateTabDistance() < 0;
                        }
                },
                addData: function ( $collapsible ) {
-                       var $settings = $collapsible.parent().data( 'collapsibleTabsSettings' );
-                       if ( $settings ) {
+                       var settings = $collapsible.parent().data( 'collapsibleTabsSettings' );
+                       if ( settings ) {
                                $collapsible.data( 'collapsibleTabsSettings', {
-                                       expandedContainer: $settings.expandedContainer,
-                                       collapsedContainer: $settings.collapsedContainer,
+                                       expandedContainer: settings.expandedContainer,
+                                       collapsedContainer: settings.collapsedContainer,
                                        expandedWidth: $collapsible.width(),
                                        prevElement: $collapsible.prev()
                                } );
                        }
                },
                getSettings: function ( $collapsible ) {
-                       var $settings = $collapsible.data( 'collapsibleTabsSettings' );
-                       if ( !$settings ) {
+                       var settings = $collapsible.data( 'collapsibleTabsSettings' );
+                       if ( !settings ) {
                                $.collapsibleTabs.addData( $collapsible );
-                               $settings = $collapsible.data( 'collapsibleTabsSettings' );
+                               settings = $collapsible.data( 'collapsibleTabsSettings' );
                        }
-                       return $settings;
+                       return settings;
                },
                handleResize: function () {
                        $.collapsibleTabs.instances.each( function () {
                                        }
                                } )
                        );
+               },
+               /**
+                * Returns the amount of horizontal distance between the two tabs groups
+                * (#left-navigation and #right-navigation), in pixels. If negative, this
+                * means that the tabs overlap, and the value is the width of overlapping
+                * parts.
+                *
+                * Used in default expandCondition and collapseCondition.
+                *
+                * @return {Numeric} distance/overlap in pixels
+                */
+               calculateTabDistance: function () {
+                       var $leftTab, $rightTab, leftEnd, rightStart;
+
+                       // In RTL, #right-navigation is actually on the left and vice versa.
+                       // Hooray for descriptive naming.
+                       if ( !rtl ) {
+                               $leftTab = $( '#left-navigation' );
+                               $rightTab = $( '#right-navigation' );
+                       } else {
+                               $leftTab = $( '#right-navigation' );
+                               $rightTab = $( '#left-navigation' );
+                       }
+
+                       leftEnd = $leftTab.offset().left + $leftTab.width();
+                       rightStart = $rightTab.offset().left;
+
+                       return rightStart - leftEnd;
                }
        };