[MediaWiki-commits] [Gerrit] Convert from show()/hide() to using classes - change (mediawiki...WikiEditor)

2014-05-23 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Convert from show()/hide() to using classes
..


Convert from show()/hide() to using classes

jQuery's show/hide/fadeIn/fadeOut methods makes changes to the
style attributes of elements. That makes them rather hard to override
their visibility, without adding an entire API to the module to do so.

This replaces the default animations with one using classes to control
visibility and only animates the animatable properties using
the style attributes.

Follow-up to: Iadaae3fb9ae1899e12605d653b2688616b8f7c40

Change-Id: I4652ade66c6de864ee3e74b3817ed9b93967ce3d
---
M modules/jquery.wikiEditor.toolbar.css
M modules/jquery.wikiEditor.toolbar.js
2 files changed, 29 insertions(+), 17 deletions(-)

Approvals:
  Mwalker: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/jquery.wikiEditor.toolbar.css 
b/modules/jquery.wikiEditor.toolbar.css
index fe09576..2dad74a 100644
--- a/modules/jquery.wikiEditor.toolbar.css
+++ b/modules/jquery.wikiEditor.toolbar.css
@@ -6,6 +6,11 @@
position: relative;
display: block;
 }
+
+.wikiEditor-ui-toolbar .empty {
+   display: none;
+}
+
 /* Expandable Sections */
 .wikiEditor-ui-toolbar .sections {
float: left;
@@ -14,12 +19,16 @@
height: 0;
 }
 .wikiEditor-ui-toolbar .sections .section {
-   display: none;
float: left;
width: 100%;
border-top: 1px solid #DD;
background-color: #E0EEf7;
 }
+
+.wikiEditor-ui-toolbar .sections .section-hidden {
+   display: none;
+}
+
 .wikiEditor-ui-toolbar {
/* @embed */
background-image: url(images/toolbar/base.png);
diff --git a/modules/jquery.wikiEditor.toolbar.js 
b/modules/jquery.wikiEditor.toolbar.js
index 3b6d4ed..454b42a 100644
--- a/modules/jquery.wikiEditor.toolbar.js
+++ b/modules/jquery.wikiEditor.toolbar.js
@@ -62,7 +62,7 @@
$group.append( 
$.wikiEditor.modules.toolbar.fn.buildTool( context, tool, data[type][tool] ) );
}
if ( $group.children().length ) {
-   $group.show();
+   $group.removeClass( 'empty' );
}
smooth = false;
break;
@@ -136,7 +136,7 @@
// Fix div.section size after adding things; if smooth is true 
uses a smooth
// animation, otherwise just change height (breaking any 
ongoing animation)
var $divSections = context.modules.toolbar.$toolbar.find( 
'div.sections' );
-   var $visibleSection = $divSections.find( '.section:visible' );
+   var $visibleSection = $divSections.find( '.section-visible' );
if ( $visibleSection.size() ) {
if ( smooth ) {
$divSections.animate( { 'height': 
$visibleSection.outerHeight() }, 'fast' );
@@ -189,7 +189,7 @@
if ( group ) {
var $group = 
context.modules.toolbar.$toolbar.find( group );
if ( $group.children().length === 0 ) {
-   $group.hide();
+   $group.addClass( 'empty' );
}
}
}
@@ -292,7 +292,7 @@
}
}
if ( empty ) {
-   $group.hide();
+   $group.addClass( 'empty' );
}
return $group;
},
@@ -604,28 +604,31 @@
var $sections = $( this ).data( 
'context' ).$ui.find( '.sections' );
var $section =
$( this ).data( 'context' 
).$ui.find( '.section-' + $( this ).parent().attr( 'rel' ) );
-   var show = $section.css( 'display' ) 
=== 'none';
+   var show = !$section.hasClass( 
'section-visible' );
$section.parent().find( 
'.section-visible' )
.css( 'position', 'absolute' )
.attr( 'aria-expanded', 'false' 
)
.removeClass( 'section-visible' 
)
-   .fadeOut( 'fast', function () {
-   $( this ).css( 
'position', 'static' );
+   .animate( { opacity: 0 }, 
'fast', 'linear', function () {
+  

[MediaWiki-commits] [Gerrit] Convert from show()/hide() to using classes - change (mediawiki...WikiEditor)

2014-03-23 Thread TheDJ (Code Review)
TheDJ has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/120472

Change subject: Convert from show()/hide() to using classes
..

Convert from show()/hide() to using classes

Follow-up to: Iadaae3fb9ae1899e12605d653b2688616b8f7c40

Change-Id: I4652ade66c6de864ee3e74b3817ed9b93967ce3d
---
M modules/jquery.wikiEditor.toolbar.css
M modules/jquery.wikiEditor.toolbar.js
2 files changed, 10 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikiEditor 
refs/changes/72/120472/1

diff --git a/modules/jquery.wikiEditor.toolbar.css 
b/modules/jquery.wikiEditor.toolbar.css
index 3551bca..a2f04fe 100644
--- a/modules/jquery.wikiEditor.toolbar.css
+++ b/modules/jquery.wikiEditor.toolbar.css
@@ -6,6 +6,11 @@
position: relative;
width: 100%;
 }
+
+.wikiEditor-ui-toolbar .empty {
+   display:none;
+}
+
 /* Expandable Sections */
 .wikiEditor-ui-toolbar .sections {
float: left;
diff --git a/modules/jquery.wikiEditor.toolbar.js 
b/modules/jquery.wikiEditor.toolbar.js
index 884240a..88b1bde 100644
--- a/modules/jquery.wikiEditor.toolbar.js
+++ b/modules/jquery.wikiEditor.toolbar.js
@@ -61,6 +61,9 @@
// Tool
$group.append( 
$.wikiEditor.modules.toolbar.fn.buildTool( context, tool, data[type][tool] ) );
}
+   if ( $group.children().length ) {
+   $group.removeClass( 'empty' );
+   }
smooth = false;
break;
case 'pages':
@@ -186,7 +189,7 @@
if ( group ) {
var $group = 
context.modules.toolbar.$toolbar.find( group );
if ( $group.children().length === 0 ) {
-   $group.hide();
+   $group.addClass( 'empty' );
}
}
}
@@ -295,7 +298,7 @@
}
}
if ( empty ) {
-   $group.hide();
+   $group.addClass( 'empty' );
}
return $group;
},

-- 
To view, visit https://gerrit.wikimedia.org/r/120472
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4652ade66c6de864ee3e74b3817ed9b93967ce3d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikiEditor
Gerrit-Branch: master
Gerrit-Owner: TheDJ hartman.w...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits