Index: trunk/extensions/UsabilityInitiative/Vector/Modules/CollapsibleNav/CollapsibleNav.js |
— | — | @@ -6,14 +6,26 @@ |
7 | 7 | return true; |
8 | 8 | } |
9 | 9 | $j( '#panel' ).addClass( 'collapsible-nav' ); |
| 10 | + // Always show the first portal |
10 | 11 | $j( '#panel > div.portal:first' ) |
11 | 12 | .addClass( 'expanded' ) |
12 | 13 | .find( 'div.body' ) |
13 | 14 | .show(); |
| 15 | + // Remember which portals to hide and show |
14 | 16 | $j( '#panel > div.portal:not(:first)' ) |
15 | | - .addClass( 'collapsed' ); |
| 17 | + .each( function() { |
| 18 | + if ( $j.cookie( 'vector-nav-' + $j(this).attr( 'id' ) ) == 'true' ) { |
| 19 | + $j(this) |
| 20 | + .addClass( 'expanded' ) |
| 21 | + .find( 'div.body' ) |
| 22 | + .show(); |
| 23 | + } else { |
| 24 | + $j(this).addClass( 'collapsed' ); |
| 25 | + } |
| 26 | + } ); |
16 | 27 | // Toggle the selected menu's class and expand or collapse the menu |
17 | 28 | $j( '#panel > div.portal > h5' ).click( function() { |
| 29 | + $j.cookie( 'vector-nav-' + $j(this).parent().attr( 'id' ), $j(this).parent().is( '.collapsed' ) ); |
18 | 30 | $j(this) |
19 | 31 | .parent() |
20 | 32 | .toggleClass( 'expanded' ) |
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php |
— | — | @@ -12,16 +12,16 @@ |
13 | 13 | |
14 | 14 | static $scripts = array( |
15 | 15 | 'raw' => array( |
16 | | - array( 'src' => 'Modules/CollapsibleNav/CollapsibleNav.js', 'version' => 4 ), |
| 16 | + array( 'src' => 'Modules/CollapsibleNav/CollapsibleNav.js', 'version' => 5 ), |
17 | 17 | array( 'src' => 'Modules/CollapsibleTabs/CollapsibleTabs.js', 'version' => 6 ), |
18 | 18 | array( 'src' => 'Modules/EditWarning/EditWarning.js', 'version' => 4 ), |
19 | 19 | array( 'src' => 'Modules/SimpleSearch/SimpleSearch.js', 'version' => 4 ), |
20 | 20 | ), |
21 | 21 | 'combined' => array( |
22 | | - array( 'src' => 'Vector.combined.js', 'version' => 10 ), |
| 22 | + array( 'src' => 'Vector.combined.js', 'version' => 11 ), |
23 | 23 | ), |
24 | 24 | 'minified' => array( |
25 | | - array( 'src' => 'Vector.combined.min.js', 'version' => 10 ), |
| 25 | + array( 'src' => 'Vector.combined.min.js', 'version' => 11 ), |
26 | 26 | ), |
27 | 27 | ); |
28 | 28 | static $modules = array( |
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js |
— | — | @@ -2,18 +2,31 @@ |
3 | 3 | /* First draft and will be changing greatly */ |
4 | 4 | |
5 | 5 | mw.addOnloadHook( function() { |
6 | | - if( !wgVectorEnabledModules.collapsibleleftnav ) |
| 6 | + if( !wgVectorEnabledModules.collapsibleleftnav ) { |
7 | 7 | return true; |
| 8 | + } |
8 | 9 | $j( '#panel' ).addClass( 'collapsible-nav' ); |
9 | | - $j( '#panel > div.portal' ).toggleClass( 'collapsed' ); |
| 10 | + // Always show the first portal |
10 | 11 | $j( '#panel > div.portal:first' ) |
11 | | - .toggleClass( 'expanded' ) |
12 | | - .toggleClass( 'collapsed' ) |
| 12 | + .addClass( 'expanded' ) |
13 | 13 | .find( 'div.body' ) |
14 | | - .slideToggle( 'fast' ); |
| 14 | + .show(); |
| 15 | + // Remember which portals to hide and show |
| 16 | + $j( '#panel > div.portal:not(:first)' ) |
| 17 | + .each( function() { |
| 18 | + if ( $j.cookie( 'vector-nav-' + $j(this).attr( 'id' ) ) == 'true' ) { |
| 19 | + $j(this) |
| 20 | + .addClass( 'expanded' ) |
| 21 | + .find( 'div.body' ) |
| 22 | + .show(); |
| 23 | + } else { |
| 24 | + $j(this).addClass( 'collapsed' ); |
| 25 | + } |
| 26 | + } ); |
15 | 27 | // Toggle the selected menu's class and expand or collapse the menu |
16 | 28 | $j( '#panel > div.portal > h5' ).click( function() { |
17 | | - $j( this ) |
| 29 | + $j.cookie( 'vector-nav-' + $j(this).parent().attr( 'id' ), $j(this).parent().is( '.collapsed' ) ); |
| 30 | + $j(this) |
18 | 31 | .parent() |
19 | 32 | .toggleClass( 'expanded' ) |
20 | 33 | .toggleClass( 'collapsed' ) |
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.min.js |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | |
3 | | -mw.addOnloadHook(function(){if(!wgVectorEnabledModules.collapsibleleftnav) |
4 | | -return true;$j('#panel').addClass('collapsible-nav');$j('#panel > div.portal').toggleClass('collapsed');$j('#panel > div.portal:first').toggleClass('expanded').toggleClass('collapsed').find('div.body').slideToggle('fast');$j('#panel > div.portal > h5').click(function(){$j(this).parent().toggleClass('expanded').toggleClass('collapsed').find('div.body').slideToggle('fast');return false;});});mw.addOnloadHook(function(){if(!wgVectorEnabledModules.collapsibletabs){return true;} |
| 3 | +mw.addOnloadHook(function(){if(!wgVectorEnabledModules.collapsibleleftnav){return true;} |
| 4 | +$j('#panel').addClass('collapsible-nav');$j('#panel > div.portal:first').addClass('expanded').find('div.body').show();$j('#panel > div.portal:not(:first)').each(function(){if($j.cookie('vector-nav-'+$j(this).attr('id'))=='true'){$j(this).addClass('expanded').find('div.body').show();}else{$j(this).addClass('collapsed');}});$j('#panel > div.portal > h5').click(function(){$j.cookie('vector-nav-'+$j(this).parent().attr('id'),$j(this).parent().is('.collapsed'));$j(this).parent().toggleClass('expanded').toggleClass('collapsed').find('div.body').slideToggle('fast');return false;});});mw.addOnloadHook(function(){if(!wgVectorEnabledModules.collapsibletabs){return true;} |
5 | 5 | var rtl=$j('body').is('.rtl');$j.collapsibleTabs.moveToCollapsed=function(ele){var $moving=$j(ele);$j($moving.data('collapsibleTabsSettings').expandedContainer).data('collapsibleTabsSettings').shifting=true;var data=$moving.data('collapsibleTabsSettings');var target=$moving.data('collapsibleTabsSettings').collapsedContainer;$moving.css("position","relative").css((rtl?'left':'right'),0).animate({width:'1px'},"normal",function(){$j(this).hide();$j('<span class="placeholder" style="display:none;"></span>').insertAfter(this);$j(this).remove().prependTo(target).data('collapsibleTabsSettings',data);$j(this).attr('style','display:list-item;');$j($j(ele).data('collapsibleTabsSettings').expandedContainer).data('collapsibleTabsSettings').shifting=false;$j.collapsibleTabs.handleResize();});};$j.collapsibleTabs.moveToExpanded=function(ele){var $moving=$j(ele);$j($moving.data('collapsibleTabsSettings').expandedContainer).data('collapsibleTabsSettings').shifting=true;var data=$moving.data('collapsibleTabsSettings');var $target=$j($moving.data('collapsibleTabsSettings').expandedContainer).find('span.placeholder:first');var expandedWidth=$moving.data('collapsibleTabsSettings').expandedWidth;$moving.css("position","relative").css((rtl?'right':'left'),0).css('width','1px');$target.replaceWith($moving.remove().css('width','1px').data('collapsibleTabsSettings',data).animate({width:expandedWidth+"px"},"normal",function(){$j(this).attr('style','display:block;');$j($moving.data('collapsibleTabsSettings').expandedContainer).data('collapsibleTabsSettings').shifting=false;$j.collapsibleTabs.handleResize();}));};$j('#p-views ul').bind("beforeTabCollapse",function(){if($j('#p-cactions').css('display')=='none') |
6 | 6 | $j("#p-cactions").addClass("filledPortlet").removeClass("emptyPortlet").find('h5').css('width','1px').animate({'width':'26px'},390);}).bind("beforeTabExpand",function(){if($j('#p-cactions li').length==1) |
7 | 7 | $j("#p-cactions h5").animate({'width':'1px'},370,function(){$j(this).attr('style','').parent().addClass("emptyPortlet").removeClass("filledPortlet");});}).collapsibleTabs({expandCondition:function(eleWidth){if(rtl){return($j('#right-navigation').position().left+$j('#right-navigation').width()+1)<($j('#left-navigation').position().left-eleWidth);}else{return($j('#left-navigation').position().left+$j('#left-navigation').width()+1)<($j('#right-navigation').position().left-eleWidth);}},collapseCondition:function(){if(rtl){return($j('#right-navigation').position().left+$j('#right-navigation').width())>$j('#left-navigation').position().left;}else{return($j('#left-navigation').position().left+$j('#left-navigation').width())>$j('#right-navigation').position().left;}}});});mw.addOnloadHook(function(){if(!wgVectorEnabledModules.editwarning){return true;} |
Index: trunk/extensions/UsabilityInitiative/Makefile |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | WikiEditor/Modules/TemplateEditor/TemplateEditor.js |
41 | 41 | |
42 | 42 | VECTOR_MODULES := \ |
43 | | - Vector/Modules/CollapsibleLeftNav/CollapsibleLeftNav.js\ |
| 43 | + Vector/Modules/CollapsibleNav/CollapsibleNav.js\ |
44 | 44 | Vector/Modules/CollapsibleTabs/CollapsibleTabs.js\ |
45 | 45 | Vector/Modules/EditWarning/EditWarning.js\ |
46 | 46 | Vector/Modules/SimpleSearch/SimpleSearch.js |