Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Modules/CollapsibleTabs/CollapsibleTabs.js |
— | — | @@ -9,11 +9,19 @@ |
10 | 10 | // Overloading the moveToCollapsed function to animate the transition |
11 | 11 | $j.collapsibleTabs.moveToCollapsed = function( ele ) { |
12 | 12 | 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 ) { |
14 | 18 | return; |
15 | 19 | } |
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 | + |
18 | 26 | // Remove the element from where it's at and put it in the dropdown menu |
19 | 27 | var target = data.collapsedContainer; |
20 | 28 | $moving.css( "position", "relative" ) |
— | — | @@ -24,8 +32,18 @@ |
25 | 33 | $j( '<span class="placeholder" style="display:none;"></span>' ).insertAfter( this ); |
26 | 34 | $j( this ).remove().prependTo( target ).data( 'collapsibleTabsSettings', data ); |
27 | 35 | $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; |
30 | 48 | $j.collapsibleTabs.handleResize(); |
31 | 49 | } ); |
32 | 50 | }; |
— | — | @@ -33,11 +51,18 @@ |
34 | 52 | // Overloading the moveToExpanded function to animate the transition |
35 | 53 | $j.collapsibleTabs.moveToExpanded = function( ele ) { |
36 | 54 | 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 ) { |
38 | 59 | return; |
39 | 60 | } |
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 | + |
42 | 67 | // grab the next appearing placeholder so we can use it for replacing |
43 | 68 | var $target = $j( data.expandedContainer ).find( 'span.placeholder:first' ); |
44 | 69 | var expandedWidth = data.expandedWidth; |
— | — | @@ -45,7 +70,18 @@ |
46 | 71 | $target.replaceWith( $moving.remove().css( 'width', '1px' ).data( 'collapsibleTabsSettings', data ) |
47 | 72 | .animate( { width: expandedWidth+"px" }, "normal", function() { |
48 | 73 | $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; |
50 | 86 | .shifting = false; |
51 | 87 | $j.collapsibleTabs.handleResize(); |
52 | 88 | } ) ); |
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Vector.combined.js |
— | — | @@ -228,11 +228,19 @@ |
229 | 229 | // Overloading the moveToCollapsed function to animate the transition |
230 | 230 | $j.collapsibleTabs.moveToCollapsed = function( ele ) { |
231 | 231 | 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 ) { |
233 | 237 | return; |
234 | 238 | } |
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 | + |
237 | 245 | // Remove the element from where it's at and put it in the dropdown menu |
238 | 246 | var target = data.collapsedContainer; |
239 | 247 | $moving.css( "position", "relative" ) |
— | — | @@ -243,8 +251,18 @@ |
244 | 252 | $j( '<span class="placeholder" style="display:none;"></span>' ).insertAfter( this ); |
245 | 253 | $j( this ).remove().prependTo( target ).data( 'collapsibleTabsSettings', data ); |
246 | 254 | $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; |
249 | 267 | $j.collapsibleTabs.handleResize(); |
250 | 268 | } ); |
251 | 269 | }; |
— | — | @@ -252,11 +270,18 @@ |
253 | 271 | // Overloading the moveToExpanded function to animate the transition |
254 | 272 | $j.collapsibleTabs.moveToExpanded = function( ele ) { |
255 | 273 | 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 ) { |
257 | 278 | return; |
258 | 279 | } |
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 | + |
261 | 286 | // grab the next appearing placeholder so we can use it for replacing |
262 | 287 | var $target = $j( data.expandedContainer ).find( 'span.placeholder:first' ); |
263 | 288 | var expandedWidth = data.expandedWidth; |
— | — | @@ -264,7 +289,18 @@ |
265 | 290 | $target.replaceWith( $moving.remove().css( 'width', '1px' ).data( 'collapsibleTabsSettings', data ) |
266 | 291 | .animate( { width: expandedWidth+"px" }, "normal", function() { |
267 | 292 | $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; |
269 | 305 | .shifting = false; |
270 | 306 | $j.collapsibleTabs.handleResize(); |
271 | 307 | } ) ); |
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Vector.combined.min.js |
— | — | @@ -12,9 +12,15 @@ |
13 | 13 | $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');} |
14 | 14 | 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');} |
15 | 15 | 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') |
19 | 25 | $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) |
20 | 26 | $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;} |
21 | 27 | $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();} |