Skip to content

Commit

Permalink
Updated distribution to version 1.11.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Semantic-Pusher-Robot committed Mar 6, 2015
1 parent 1a8dded commit 6190e5f
Show file tree
Hide file tree
Showing 136 changed files with 617 additions and 402 deletions.
4 changes: 2 additions & 2 deletions components/accordion.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* # Semantic UI 1.11.0 - Accordion
* # Semantic UI 1.11.2 - Accordion
* http://github.com/semantic-org/semantic-ui/
*
*
Expand Down Expand Up @@ -144,7 +144,7 @@
transition: background 0.2s ease, color 0.2s ease;
}
.ui.styled.accordion > .title:first-child,
.ui.styled.accordion > .accordion .title:first-child {
.ui.styled.accordion .accordion .title:first-child {
border-top: none;
}

Expand Down
100 changes: 60 additions & 40 deletions components/accordion.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* # Semantic UI 1.11.0 - Accordion
* # Semantic UI 1.11.2 - Accordion
* http://github.com/semantic-org/semantic-ui/
*
*
Expand Down Expand Up @@ -61,10 +61,8 @@ $.fn.accordion = function(parameters) {
module = {

initialize: function() {
module.debug('Initializing accordion with bound events', $module);
$module
.on('click' + eventNamespace, selector.title, module.event.click)
;
module.debug('Initializing', $module);
module.bind.events();
module.observeChanges();
module.instantiate();
},
Expand All @@ -77,12 +75,10 @@ $.fn.accordion = function(parameters) {
},

destroy: function() {
module.debug('Destroying previous accordion for', $module);
module.debug('Destroying previous instance', $module);
$module
.removeData(moduleNamespace)
;
$title
.off(eventNamespace)
.removeData(moduleNamespace)
;
},

Expand All @@ -105,6 +101,14 @@ $.fn.accordion = function(parameters) {
}
},

bind: {
events: function() {
module.debug('Binding delegated events');
$module
.on('click' + eventNamespace, selector.trigger, module.event.click)
;
}
},

event: {
click: function() {
Expand All @@ -117,13 +121,16 @@ $.fn.accordion = function(parameters) {
$activeTitle = (query !== undefined)
? (typeof query === 'number')
? $title.eq(query)
: $(query)
: $(this),
: $(query).closest(selector.title)
: $(this).closest(selector.title),
$activeContent = $activeTitle.next($content),
contentIsOpen = $activeContent.is(':visible')
isAnimating = $activeContent.hasClass(className.animating),
isActive = $activeContent.hasClass(className.active),
isOpen = (isActive && !isAnimating),
isOpening = (!isActive && isAnimating)
;
module.debug('Toggling visibility of content', $activeTitle);
if(contentIsOpen) {
if(isOpen || isOpening) {
if(settings.collapsible) {
module.close.call($activeTitle);
}
Expand All @@ -132,7 +139,7 @@ $.fn.accordion = function(parameters) {
}
}
else {
module.open.call($activeTitle);
module.open.call($activeTitle);
}
},

Expand All @@ -141,47 +148,51 @@ $.fn.accordion = function(parameters) {
$activeTitle = (query !== undefined)
? (typeof query === 'number')
? $title.eq(query)
: $(query)
: $(this),
$activeContent = $activeTitle.next($content),
currentlyAnimating = $activeContent.is(':animated'),
currentlyActive = $activeContent.hasClass(className.active)
: $(query).closest(selector.title)
: $(this).closest(selector.title),
$activeContent = $activeTitle.next($content),
isAnimating = $activeContent.hasClass(className.animating),
isActive = $activeContent.hasClass(className.active),
isUnopen = (!isActive && !isAnimating)
;
if(!currentlyAnimating && !currentlyActive) {
if(isUnopen) {
module.debug('Opening accordion content', $activeTitle);
if(settings.exclusive) {
module.closeOthers.call($activeTitle);
}
$activeTitle
.addClass(className.active)
;
$activeContent.addClass(className.animating);
if(settings.animateChildren) {
if($.fn.transition !== undefined && $module.transition('is supported')) {
$activeContent
.children()
.transition({
animation : 'fade in',
animation : 'fade in',
queue : false,
useFailSafe : true,
debug : settings.debug,
verbose : settings.verbose,
duration : settings.duration
debug : settings.debug,
verbose : settings.verbose,
duration : settings.duration
})
;
}
else {
$activeContent
.children()
.stop()
.stop(true)
.animate({
opacity: 1
}, settings.duration, module.resetOpacity)
;
}
}
$activeContent
.stop()
.stop(true)
.slideDown(settings.duration, settings.easing, function() {
$activeContent
.removeClass(className.animating)
.addClass(className.active)
;
module.reset.display.call(this);
Expand All @@ -197,26 +208,29 @@ $.fn.accordion = function(parameters) {
$activeTitle = (query !== undefined)
? (typeof query === 'number')
? $title.eq(query)
: $(query)
: $(this),
: $(query).closest(selector.title)
: $(this).closest(selector.title),
$activeContent = $activeTitle.next($content),
isActive = $activeContent.hasClass(className.active)
isAnimating = $activeContent.hasClass(className.animating),
isActive = $activeContent.hasClass(className.active),
isOpening = (!isActive && isAnimating),
isClosing = (isActive && isAnimating)
;
if(isActive) {
if((isActive || isOpening) && !isClosing) {
module.debug('Closing accordion content', $activeContent);
$activeTitle
.removeClass(className.active)
;
$activeContent
.removeClass(className.active)
.show()
.addClass(className.animating)
;
if(settings.animateChildren) {
if($.fn.transition !== undefined && $module.transition('is supported')) {
$activeContent
.children()
.transition({
animation : 'fade out',
queue : false,
useFailSafe : true,
debug : settings.debug,
verbose : settings.verbose,
Expand All @@ -227,16 +241,20 @@ $.fn.accordion = function(parameters) {
else {
$activeContent
.children()
.stop()
.stop(true)
.animate({
opacity: 0
}, settings.duration, module.resetOpacity)
;
}
}
$activeContent
.stop()
.stop(true)
.slideUp(settings.duration, settings.easing, function() {
$activeContent
.removeClass(className.animating)
.removeClass(className.active)
;
module.reset.display.call(this);
settings.onClose.call(this);
settings.onChange.call(this);
Expand All @@ -249,7 +267,7 @@ $.fn.accordion = function(parameters) {
var
$activeTitle = (index !== undefined)
? $title.eq(index)
: $(this),
: $(this).closest(selector.title),
$parentTitles = $activeTitle.parents(selector.content).prev(selector.title),
$activeAccordion = $activeTitle.closest(selector.accordion),
activeSelector = selector.title + '.' + className.active + ':visible',
Expand Down Expand Up @@ -524,8 +542,8 @@ $.fn.accordion.settings = {
closeNested : false,
animateChildren : true,

duration : 500,
easing : 'easeOutQuint',
duration : 350,
easing : 'easeOutQuad',

onOpen : function(){},
onClose : function(){},
Expand All @@ -536,21 +554,23 @@ $.fn.accordion.settings = {
},

className : {
active : 'active'
active : 'active',
animating : 'animating'
},

selector : {
accordion : '.accordion',
title : '.title',
trigger : '.title',
content : '.content'
}

};

// Adds easing
$.extend( $.easing, {
easeOutQuint: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t*t*t + 1) + b;
easeOutQuad: function (x, t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
}
});

Expand Down
Loading

0 comments on commit 6190e5f

Please sign in to comment.