r57912 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57911‎ | r57912 | r57913 >
Date:20:30, 19 October 2009
Author:adam
Status:deferred
Tags:
Comment:
Adding animation to the collapsible tabs. Tested in FF3.5 and Safari 4 on mac
Modified paths:
  • /trunk/extensions/UsabilityInitiative/CollapsibleTabs/CollapsibleTabs.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/CollapsibleTabs/CollapsibleTabs.js
@@ -1,6 +1,6 @@
22 js2AddOnloadHook( function() {
33
4 - /* ANIMATION NOT READY FOR PRIME TIME
 4+ //Overloading the moveToCollapsed function to animate the transition
55 $j.collapsibleTabs.moveToCollapsed = function( ele ) {
66 $moving = $j(ele);
77 $j($moving.data('collapsibleTabsSettings').expandedContainer).data('collapsibleTabsSettings').shifting = true;
@@ -9,15 +9,16 @@
1010 target = $moving.data('collapsibleTabsSettings').collapsedContainer;
1111 // $moving.hide(500);
1212 $moving.css("position", "relative").css('right',0);
13 - $moving.animate({width: '0px'},"normal",function(){
 13+ $moving.animate({width: '1px'},"normal",function(){
1414 //$j(this).remove().prependTo(target).data('collapsibleTabsSettings', data).show();
 15+ $j(this).hide();
1516 $j(this).remove().prependTo(target).data('collapsibleTabsSettings', data);
16 - $j(this).css("position", "static").css('right','auto').css("width", "auto");
 17+ $j(this).attr('style', '');
1718 $j($j(ele).data('collapsibleTabsSettings').expandedContainer).data('collapsibleTabsSettings').shifting = false;
1819 });
19 - //$moving.remove().prependTo(target).data('collapsibleTabsSettings', data);
2020 };
2121
 22+ // Overloading the moveToExpanded function to animate the transition
2223 $j.collapsibleTabs.moveToExpanded = function( ele ) {
2324 $moving = $j(ele);
2425 $j($moving.data('collapsibleTabsSettings').expandedContainer).data('collapsibleTabsSettings').shifting = true;
@@ -25,22 +26,26 @@
2627 // remove this element from where it's at and put it in the dropdown menu
2728 target = $moving.data('collapsibleTabsSettings').prevElement;
2829 expandedWidth = $moving.data('collapsibleTabsSettings').expandedWidth;
29 - $moving.css("position", "relative").css('right',0).css('width','0px');
30 - $moving.remove().insertAfter(target).data('collapsibleTabsSettings', data)
 30+ $moving.css("position", "relative").css('left',0).css('width','1px');
 31+ $moving.remove().css('width','1px').insertAfter(target).data('collapsibleTabsSettings', data)
3132 .animate({width: expandedWidth+"px"}, "normal", function(){
32 - //$j(this).remove().prependTo(target).data('collapsibleTabsSettings', data).show();
33 - $j(this).css("position", "static").css('right','auto');
 33+ $j(this).attr('style', '');
3434 $j($moving.data('collapsibleTabsSettings').expandedContainer).data('collapsibleTabsSettings').shifting = false;
3535
3636 });
3737 };
38 - */
39 - if($j("#p-cactions li").length==0) $j("#p-cactions").removeClass("emptyPortlet").addClass("filledPortlet");
40 - $j('#p-views ul').collapsibleTabs().bind("beforeTabCollapse", function(){
41 - $j("#p-cactions").removeClass("emptyPortlet").addClass("filledPortlet");
 38+
 39+ // Bind callback functions to animate our drop down menu in and out
 40+ // and then call the collapsibleTabs function on the menu
 41+ $j('#p-views ul').bind("beforeTabCollapse", function(){
 42+ if($j('#p-cactions').css('display')=='none')
 43+ $j("#p-cactions").addClass("filledPortlet").removeClass("emptyPortlet")
 44+ .find('h5').css('width','1px').animate({'width':'26px'}, 390);
4245 }).bind("beforeTabExpand", function(){
43 - if($j("#p-cactions li.collapsible").length==1)
44 - $j("#p-cactions").removeClass("filledPortlet").addClass("emptyPortlet");
45 - });
 46+ if($j('#p-cactions li').length==1)
 47+ $j("#p-cactions h5").animate({'width':'1px'},370, function(){
 48+ $j(this).attr('style','').parent().addClass("emptyPortlet").removeClass("filledPortlet");
 49+ });
 50+ }).collapsibleTabs();
4651
4752 });
\ No newline at end of file

Follow-up revisions

RevisionCommit summaryAuthorDate
r57913Bump style version for r57912catrope20:43, 19 October 2009

Status & tagging log