r60683 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60682‎ | r60683 | r60684 >
Date:19:51, 5 January 2010
Author:tparscal
Status:ok (Comments)
Tags:
Comment:
Fixed some broken built files. Also added cookies to CollapsibleNav.
Modified paths:
  • /trunk/extensions/UsabilityInitiative/Makefile (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Modules/CollapsibleNav/CollapsibleNav.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Vector.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/Vector/Modules/CollapsibleNav/CollapsibleNav.js
@@ -6,14 +6,26 @@
77 return true;
88 }
99 $j( '#panel' ).addClass( 'collapsible-nav' );
 10+ // Always show the first portal
1011 $j( '#panel > div.portal:first' )
1112 .addClass( 'expanded' )
1213 .find( 'div.body' )
1314 .show();
 15+ // Remember which portals to hide and show
1416 $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+ } );
1627 // Toggle the selected menu's class and expand or collapse the menu
1728 $j( '#panel > div.portal > h5' ).click( function() {
 29+ $j.cookie( 'vector-nav-' + $j(this).parent().attr( 'id' ), $j(this).parent().is( '.collapsed' ) );
1830 $j(this)
1931 .parent()
2032 .toggleClass( 'expanded' )
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php
@@ -12,16 +12,16 @@
1313
1414 static $scripts = array(
1515 'raw' => array(
16 - array( 'src' => 'Modules/CollapsibleNav/CollapsibleNav.js', 'version' => 4 ),
 16+ array( 'src' => 'Modules/CollapsibleNav/CollapsibleNav.js', 'version' => 5 ),
1717 array( 'src' => 'Modules/CollapsibleTabs/CollapsibleTabs.js', 'version' => 6 ),
1818 array( 'src' => 'Modules/EditWarning/EditWarning.js', 'version' => 4 ),
1919 array( 'src' => 'Modules/SimpleSearch/SimpleSearch.js', 'version' => 4 ),
2020 ),
2121 'combined' => array(
22 - array( 'src' => 'Vector.combined.js', 'version' => 10 ),
 22+ array( 'src' => 'Vector.combined.js', 'version' => 11 ),
2323 ),
2424 'minified' => array(
25 - array( 'src' => 'Vector.combined.min.js', 'version' => 10 ),
 25+ array( 'src' => 'Vector.combined.min.js', 'version' => 11 ),
2626 ),
2727 );
2828 static $modules = array(
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js
@@ -2,18 +2,31 @@
33 /* First draft and will be changing greatly */
44
55 mw.addOnloadHook( function() {
6 - if( !wgVectorEnabledModules.collapsibleleftnav )
 6+ if( !wgVectorEnabledModules.collapsibleleftnav ) {
77 return true;
 8+ }
89 $j( '#panel' ).addClass( 'collapsible-nav' );
9 - $j( '#panel > div.portal' ).toggleClass( 'collapsed' );
 10+ // Always show the first portal
1011 $j( '#panel > div.portal:first' )
11 - .toggleClass( 'expanded' )
12 - .toggleClass( 'collapsed' )
 12+ .addClass( 'expanded' )
1313 .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+ } );
1527 // Toggle the selected menu's class and expand or collapse the menu
1628 $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)
1831 .parent()
1932 .toggleClass( 'expanded' )
2033 .toggleClass( 'collapsed' )
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.min.js
@@ -1,6 +1,6 @@
22
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;}
55 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')
66 $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)
77 $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 @@
4040 WikiEditor/Modules/TemplateEditor/TemplateEditor.js
4141
4242 VECTOR_MODULES := \
43 - Vector/Modules/CollapsibleLeftNav/CollapsibleLeftNav.js\
 43+ Vector/Modules/CollapsibleNav/CollapsibleNav.js\
4444 Vector/Modules/CollapsibleTabs/CollapsibleTabs.js\
4545 Vector/Modules/EditWarning/EditWarning.js\
4646 Vector/Modules/SimpleSearch/SimpleSearch.js

Comments

#Comment by Catrope (talk | contribs)   11:39, 6 January 2010

Maybe this could be less wasteful and use one cookie storing a list of open portals rather than having a separate cookie for each portal?

Status & tagging log