r76471 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76470‎ | r76471 | r76472 >
Date:21:11, 10 November 2010
Author:catrope
Status:ok
Tags:
Comment:
1.16wmf4: More live hacking, hoping to really fix it this time
Modified paths:
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Modules/CollapsibleTabs/CollapsibleTabs.js (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Vector.combined.js (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Vector.combined.min.js (modified) (history)

Diff [purge]

Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Modules/CollapsibleTabs/CollapsibleTabs.js
@@ -9,11 +9,19 @@
1010 // Overloading the moveToCollapsed function to animate the transition
1111 $j.collapsibleTabs.moveToCollapsed = function( ele ) {
1212 var $moving = $j( ele );
13 - if ( $moving.size() == 0 ) {
 13+
 14+ //$j.collapsibleTabs.getSettings( $j( $j.collapsibleTabs.getSettings( $moving ).expandedContainer ) ).shifting = true;
 15+ // Do the above, except with guards for JS errors
 16+ var data = $j.collapsibleTabs.getSettings( $moving );
 17+ if ( !data ) {
1418 return;
1519 }
16 - $j.collapsibleTabs.getSettings( $j( $j.collapsibleTabs.getSettings( $moving ).expandedContainer ) ).shifting = true;
17 - var data = $j.collapsibleTabs.getSettings( $moving );
 20+ var expContainerSettings = $j.collapsibleTabs.getSettings( $j( data.expandedContainer ) );
 21+ if ( !expContainerSettings ) {
 22+ return;
 23+ }
 24+ expContainerSettings.shifting = true;
 25+
1826 // Remove the element from where it's at and put it in the dropdown menu
1927 var target = data.collapsedContainer;
2028 $moving.css( "position", "relative" )
@@ -24,8 +32,18 @@
2533 $j( '<span class="placeholder" style="display:none;"></span>' ).insertAfter( this );
2634 $j( this ).remove().prependTo( target ).data( 'collapsibleTabsSettings', data );
2735 $j( this ).attr( 'style', 'display:list-item;' );
28 - $j.collapsibleTabs.getSettings( $j( $j.collapsibleTabs.getSettings( $j( ele ) ).expandedContainer ) )
29 - .shifting = false;
 36+ //$j.collapsibleTabs.getSettings( $j( $j.collapsibleTabs.getSettings( $j( ele ) ).expandedContainer ) )
 37+ // .shifting = false;
 38+ // Do the above, except with guards for JS errors
 39+ var data = $j.collapsibleTabs.getSettings( $j( ele ) );
 40+ if ( !data ) {
 41+ return;
 42+ }
 43+ var expContainerSettings = $j.collapsibleTabs.getSettings( $j( data.expandedContainer ) );
 44+ if ( !expContainerSettings ) {
 45+ return;
 46+ }
 47+ expContainerSettings.shifting = false;
3048 $j.collapsibleTabs.handleResize();
3149 } );
3250 };
@@ -33,11 +51,18 @@
3452 // Overloading the moveToExpanded function to animate the transition
3553 $j.collapsibleTabs.moveToExpanded = function( ele ) {
3654 var $moving = $j( ele );
37 - if ( $moving.size() == 0 ) {
 55+ //$j.collapsibleTabs.getSettings( $j( $j.collapsibleTabs.getSettings( $moving ).expandedContainer ) ).shifting = true;
 56+ // Do the above, except with guards for JS errors
 57+ var data = $j.collapsibleTabs.getSettings( $moving );
 58+ if ( !data ) {
3859 return;
3960 }
40 - $j.collapsibleTabs.getSettings( $j( $j.collapsibleTabs.getSettings( $moving ).expandedContainer ) ).shifting = true;
41 - var data = $j.collapsibleTabs.getSettings( $moving );
 61+ var expContainerSettings = $j.collapsibleTabs.getSettings( $j( data.expandedContainer ) );
 62+ if ( !expContainerSettings ) {
 63+ return;
 64+ }
 65+ expContainerSettings.shifting = true;
 66+
4267 // grab the next appearing placeholder so we can use it for replacing
4368 var $target = $j( data.expandedContainer ).find( 'span.placeholder:first' );
4469 var expandedWidth = data.expandedWidth;
@@ -45,7 +70,18 @@
4671 $target.replaceWith( $moving.remove().css( 'width', '1px' ).data( 'collapsibleTabsSettings', data )
4772 .animate( { width: expandedWidth+"px" }, "normal", function() {
4873 $j( this ).attr( 'style', 'display:block;' );
49 - $j.collapsibleTabs.getSettings( $j( $j.collapsibleTabs.getSettings( $moving ).expandedContainer ) )
 74+ //$j.collapsibleTabs.getSettings( $j( $j.collapsibleTabs.getSettings( $j( ele ) ).expandedContainer ) )
 75+ // .shifting = false;
 76+ // Do the above, except with guards for JS errors
 77+ var data = $j.collapsibleTabs.getSettings( $j( ele ) );
 78+ if ( !data ) {
 79+ return;
 80+ }
 81+ var expContainerSettings = $j.collapsibleTabs.getSettings( $j( data.expandedContainer ) );
 82+ if ( !expContainerSettings ) {
 83+ return;
 84+ }
 85+ expContainerSettings.shifting = false;
5086 .shifting = false;
5187 $j.collapsibleTabs.handleResize();
5288 } ) );
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Vector.combined.js
@@ -228,11 +228,19 @@
229229 // Overloading the moveToCollapsed function to animate the transition
230230 $j.collapsibleTabs.moveToCollapsed = function( ele ) {
231231 var $moving = $j( ele );
232 - if ( $moving.size() == 0 ) {
 232+
 233+ //$j.collapsibleTabs.getSettings( $j( $j.collapsibleTabs.getSettings( $moving ).expandedContainer ) ).shifting = true;
 234+ // Do the above, except with guards for JS errors
 235+ var data = $j.collapsibleTabs.getSettings( $moving );
 236+ if ( !data ) {
233237 return;
234238 }
235 - $j.collapsibleTabs.getSettings( $j( $j.collapsibleTabs.getSettings( $moving ).expandedContainer ) ).shifting = true;
236 - var data = $j.collapsibleTabs.getSettings( $moving );
 239+ var expContainerSettings = $j.collapsibleTabs.getSettings( $j( data.expandedContainer ) );
 240+ if ( !expContainerSettings ) {
 241+ return;
 242+ }
 243+ expContainerSettings.shifting = true;
 244+
237245 // Remove the element from where it's at and put it in the dropdown menu
238246 var target = data.collapsedContainer;
239247 $moving.css( "position", "relative" )
@@ -243,8 +251,18 @@
244252 $j( '<span class="placeholder" style="display:none;"></span>' ).insertAfter( this );
245253 $j( this ).remove().prependTo( target ).data( 'collapsibleTabsSettings', data );
246254 $j( this ).attr( 'style', 'display:list-item;' );
247 - $j.collapsibleTabs.getSettings( $j( $j.collapsibleTabs.getSettings( $j( ele ) ).expandedContainer ) )
248 - .shifting = false;
 255+ //$j.collapsibleTabs.getSettings( $j( $j.collapsibleTabs.getSettings( $j( ele ) ).expandedContainer ) )
 256+ // .shifting = false;
 257+ // Do the above, except with guards for JS errors
 258+ var data = $j.collapsibleTabs.getSettings( $j( ele ) );
 259+ if ( !data ) {
 260+ return;
 261+ }
 262+ var expContainerSettings = $j.collapsibleTabs.getSettings( $j( data.expandedContainer ) );
 263+ if ( !expContainerSettings ) {
 264+ return;
 265+ }
 266+ expContainerSettings.shifting = false;
249267 $j.collapsibleTabs.handleResize();
250268 } );
251269 };
@@ -252,11 +270,18 @@
253271 // Overloading the moveToExpanded function to animate the transition
254272 $j.collapsibleTabs.moveToExpanded = function( ele ) {
255273 var $moving = $j( ele );
256 - if ( $moving.size() == 0 ) {
 274+ //$j.collapsibleTabs.getSettings( $j( $j.collapsibleTabs.getSettings( $moving ).expandedContainer ) ).shifting = true;
 275+ // Do the above, except with guards for JS errors
 276+ var data = $j.collapsibleTabs.getSettings( $moving );
 277+ if ( !data ) {
257278 return;
258279 }
259 - $j.collapsibleTabs.getSettings( $j( $j.collapsibleTabs.getSettings( $moving ).expandedContainer ) ).shifting = true;
260 - var data = $j.collapsibleTabs.getSettings( $moving );
 280+ var expContainerSettings = $j.collapsibleTabs.getSettings( $j( data.expandedContainer ) );
 281+ if ( !expContainerSettings ) {
 282+ return;
 283+ }
 284+ expContainerSettings.shifting = true;
 285+
261286 // grab the next appearing placeholder so we can use it for replacing
262287 var $target = $j( data.expandedContainer ).find( 'span.placeholder:first' );
263288 var expandedWidth = data.expandedWidth;
@@ -264,7 +289,18 @@
265290 $target.replaceWith( $moving.remove().css( 'width', '1px' ).data( 'collapsibleTabsSettings', data )
266291 .animate( { width: expandedWidth+"px" }, "normal", function() {
267292 $j( this ).attr( 'style', 'display:block;' );
268 - $j.collapsibleTabs.getSettings( $j( $j.collapsibleTabs.getSettings( $moving ).expandedContainer ) )
 293+ //$j.collapsibleTabs.getSettings( $j( $j.collapsibleTabs.getSettings( $j( ele ) ).expandedContainer ) )
 294+ // .shifting = false;
 295+ // Do the above, except with guards for JS errors
 296+ var data = $j.collapsibleTabs.getSettings( $j( ele ) );
 297+ if ( !data ) {
 298+ return;
 299+ }
 300+ var expContainerSettings = $j.collapsibleTabs.getSettings( $j( data.expandedContainer ) );
 301+ if ( !expContainerSettings ) {
 302+ return;
 303+ }
 304+ expContainerSettings.shifting = false;
269305 .shifting = false;
270306 $j.collapsibleTabs.handleResize();
271307 } ) );
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Vector.combined.min.js
@@ -12,9 +12,15 @@
1313 $j('#mw-panel > div.portal:first').addClass('first persistent');$j('#mw-panel').addClass('collapsible-nav');$j('#mw-panel > div.portal:not(.persistent)').each(function(i){var id=$j(this).attr('id');var state=$j.cookie('vector-nav-'+id);if(state=='true'||(state==null&&i<1)||(state==null&&version==1&&id=='p-lang')){$j(this).addClass('expanded').find('div.body').show();}else{$j(this).addClass('collapsed');}
1414 if(state!=null){$j.cookie('vector-nav-'+$j(this).attr('id'),state,{'expires':30,'path':'/'});}});function toggle($element){$j.cookie('vector-nav-'+$element.parent().attr('id'),$element.parent().is('.collapsed'),{'expires':30,'path':'/'});$element.parent().toggleClass('expanded').toggleClass('collapsed').find('div.body').slideToggle('fast');}
1515 var $headings=$j('#mw-panel > div.portal:not(.persistent) > h5');var tabIndex=mw.usability.getMaxTabIndex()+1;$j('#searchInput').attr('tabindex',tabIndex++);$headings.each(function(){$j(this).attr('tabindex',tabIndex++);});$headings.keydown(function(event){if(event.which==13||event.which==32){toggle($j(this));}}).mousedown(function(){toggle($j(this));$j(this).blur();return false;});});$j(document).ready(function(){if(!wgVectorEnabledModules.collapsibletabs){return true;}
16 -var rtl=$j('body').is('.rtl');$j.collapsibleTabs.moveToCollapsed=function(ele){var $moving=$j(ele);if($moving.size()==0){return;}
17 -$j.collapsibleTabs.getSettings($j($j.collapsibleTabs.getSettings($moving).expandedContainer)).shifting=true;var data=$j.collapsibleTabs.getSettings($moving);var target=data.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.collapsibleTabs.getSettings($j($j.collapsibleTabs.getSettings($j(ele)).expandedContainer)).shifting=false;$j.collapsibleTabs.handleResize();});};$j.collapsibleTabs.moveToExpanded=function(ele){var $moving=$j(ele);if($moving.size()==0){return;}
18 -$j.collapsibleTabs.getSettings($j($j.collapsibleTabs.getSettings($moving).expandedContainer)).shifting=true;var data=$j.collapsibleTabs.getSettings($moving);var $target=$j(data.expandedContainer).find('span.placeholder:first');var expandedWidth=data.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.collapsibleTabs.getSettings($j($j.collapsibleTabs.getSettings($moving).expandedContainer)).shifting=false;$j.collapsibleTabs.handleResize();}));};$j('#p-views ul').bind("beforeTabCollapse",function(){if($j('#p-cactions').css('display')=='none')
 16+var rtl=$j('body').is('.rtl');$j.collapsibleTabs.moveToCollapsed=function(ele){var $moving=$j(ele);var data=$j.collapsibleTabs.getSettings($moving);if(!data){return;}
 17+var expContainerSettings=$j.collapsibleTabs.getSettings($j(data.expandedContainer));if(!expContainerSettings){return;}
 18+expContainerSettings.shifting=true;var target=data.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;');var data=$j.collapsibleTabs.getSettings($j(ele));if(!data){return;}
 19+var expContainerSettings=$j.collapsibleTabs.getSettings($j(data.expandedContainer));if(!expContainerSettings){return;}
 20+expContainerSettings.shifting=false;$j.collapsibleTabs.handleResize();});};$j.collapsibleTabs.moveToExpanded=function(ele){var $moving=$j(ele);var data=$j.collapsibleTabs.getSettings($moving);if(!data){return;}
 21+var expContainerSettings=$j.collapsibleTabs.getSettings($j(data.expandedContainer));if(!expContainerSettings){return;}
 22+expContainerSettings.shifting=true;var $target=$j(data.expandedContainer).find('span.placeholder:first');var expandedWidth=data.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;');var data=$j.collapsibleTabs.getSettings($j(ele));if(!data){return;}
 23+var expContainerSettings=$j.collapsibleTabs.getSettings($j(data.expandedContainer));if(!expContainerSettings){return;}
 24+expContainerSettings.shifting=false;.shifting=false;$j.collapsibleTabs.handleResize();}));};$j('#p-views ul').bind("beforeTabCollapse",function(){if($j('#p-cactions').css('display')=='none')
1925 $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)
2026 $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;}}});});$j(document).ready(function(){if(!wgVectorEnabledModules.editwarning||$j('#wpTextbox1').size()==0){return true;}
2127 $j('#wpTextbox1, #wpSummary').each(function(){$j(this).data('origtext',$j(this).val());});var fallbackWindowOnBeforeUnload=window.onbeforeunload;var ourWindowOnBeforeUnload=function(){var fallbackResult=undefined;var retval=undefined;var thisFunc=arguments.callee;if(fallbackWindowOnBeforeUnload){fallbackResult=fallbackWindowOnBeforeUnload();}

Follow-up revisions

RevisionCommit summaryAuthorDate
r76474Fix parse error in r76471catrope21:23, 10 November 2010
r76628Merge live hacks from 1.16wmf4: r76467, r76469, r76471, r76474catrope16:32, 13 November 2010

Status & tagging log