Update Semantic to 2.1

Ticket #56
This commit is contained in:
Tim Schumacher 2016-06-10 00:34:34 +02:00
parent 3f1e728781
commit 4385f1acbc
425 changed files with 59924 additions and 37200 deletions

View file

@ -1,9 +1,9 @@
/*!
* # Semantic UI 1.11.4 - Accordion
* # Semantic UI 2.1.7 - Accordion
* http://github.com/semantic-org/semantic-ui/
*
*
* Copyright 2014 Contributors
* Copyright 2015 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
@ -63,7 +63,9 @@ $.fn.accordion = function(parameters) {
initialize: function() {
module.debug('Initializing', $module);
module.bind.events();
module.observeChanges();
if(settings.observeChanges) {
module.observeChanges();
}
module.instantiate();
},
@ -105,7 +107,7 @@ $.fn.accordion = function(parameters) {
events: function() {
module.debug('Binding delegated events');
$module
.on('click' + eventNamespace, selector.trigger, module.event.click)
.on(settings.on + eventNamespace, selector.trigger, module.event.click)
;
}
},
@ -153,54 +155,59 @@ $.fn.accordion = function(parameters) {
$activeContent = $activeTitle.next($content),
isAnimating = $activeContent.hasClass(className.animating),
isActive = $activeContent.hasClass(className.active),
isUnopen = (!isActive && !isAnimating)
isOpen = (isActive || isAnimating)
;
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',
queue : false,
useFailSafe : true,
debug : settings.debug,
verbose : settings.verbose,
duration : settings.duration
})
;
}
else {
$activeContent
.children()
.stop(true)
.animate({
opacity: 1
}, settings.duration, module.resetOpacity)
;
}
}
$activeContent
.stop(true)
.slideDown(settings.duration, settings.easing, function() {
$activeContent
.removeClass(className.animating)
.addClass(className.active)
;
module.reset.display.call(this);
settings.onOpen.call(this);
settings.onChange.call(this);
})
;
if(isOpen) {
module.debug('Accordion already open, skipping', $activeContent);
return;
}
module.debug('Opening accordion content', $activeTitle);
settings.onOpening.call($activeContent);
if(settings.exclusive) {
module.closeOthers.call($activeTitle);
}
$activeTitle
.addClass(className.active)
;
$activeContent
.stop(true, true)
.addClass(className.animating)
;
if(settings.animateChildren) {
if($.fn.transition !== undefined && $module.transition('is supported')) {
$activeContent
.children()
.transition({
animation : 'fade in',
queue : false,
useFailSafe : true,
debug : settings.debug,
verbose : settings.verbose,
duration : settings.duration
})
;
}
else {
$activeContent
.children()
.stop(true, true)
.animate({
opacity: 1
}, settings.duration, module.resetOpacity)
;
}
}
$activeContent
.slideDown(settings.duration, settings.easing, function() {
$activeContent
.removeClass(className.animating)
.addClass(className.active)
;
module.reset.display.call(this);
settings.onOpen.call(this);
settings.onChange.call(this);
})
;
},
close: function(query) {
@ -218,10 +225,12 @@ $.fn.accordion = function(parameters) {
;
if((isActive || isOpening) && !isClosing) {
module.debug('Closing accordion content', $activeContent);
settings.onClosing.call($activeContent);
$activeTitle
.removeClass(className.active)
;
$activeContent
.stop(true, true)
.addClass(className.animating)
;
if(settings.animateChildren) {
@ -241,7 +250,7 @@ $.fn.accordion = function(parameters) {
else {
$activeContent
.children()
.stop(true)
.stop(true, true)
.animate({
opacity: 0
}, settings.duration, module.resetOpacity)
@ -249,7 +258,6 @@ $.fn.accordion = function(parameters) {
}
}
$activeContent
.stop(true)
.slideUp(settings.duration, settings.easing, function() {
$activeContent
.removeClass(className.animating)
@ -291,6 +299,10 @@ $.fn.accordion = function(parameters) {
$openTitles
.removeClass(className.active)
;
$openContents
.removeClass(className.animating)
.stop(true, true)
;
if(settings.animateChildren) {
if($.fn.transition !== undefined && $module.transition('is supported')) {
$openContents
@ -307,7 +319,7 @@ $.fn.accordion = function(parameters) {
else {
$openContents
.children()
.stop()
.stop(true, true)
.animate({
opacity: 0
}, settings.duration, module.resetOpacity)
@ -315,7 +327,6 @@ $.fn.accordion = function(parameters) {
}
}
$openContents
.stop()
.slideUp(settings.duration , settings.easing, function() {
$(this).removeClass(className.active);
module.reset.display.call(this);
@ -422,7 +433,7 @@ $.fn.accordion = function(parameters) {
});
}
clearTimeout(module.performance.timer);
module.performance.timer = setTimeout(module.performance.display, 100);
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function() {
var
@ -534,20 +545,27 @@ $.fn.accordion.settings = {
namespace : 'accordion',
debug : false,
verbose : true,
verbose : false,
performance : true,
exclusive : true,
collapsible : true,
closeNested : false,
animateChildren : true,
on : 'click', // event on title that opens accordion
duration : 350,
easing : 'easeOutQuad',
observeChanges : true, // whether accordion should automatically refresh on DOM insertion
onOpen : function(){},
onClose : function(){},
onChange : function(){},
exclusive : true, // whether a single accordion content panel should be open at once
collapsible : true, // whether accordion content can be closed
closeNested : false, // whether nested content should be closed when a panel is closed
animateChildren : true, // whether children opacity should be animated
duration : 350, // duration of animation
easing : 'easeOutQuad', // easing equation for animation
onOpening : function(){}, // callback before open animation
onOpen : function(){}, // callback after open animation
onClosing : function(){}, // callback before closing animation
onClose : function(){}, // callback after closing animation
onChange : function(){}, // callback after closing or opening animation
error: {
method : 'The method you called is not defined'
@ -574,5 +592,5 @@ $.extend( $.easing, {
}
});
})( jQuery, window , document );
})( jQuery, window, document );