Skip to content

Commit

Permalink
removed a couple of optional extensions from the default build
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Jehl committed Aug 7, 2012
1 parent 22fe149 commit ea96724
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 205 deletions.
203 changes: 1 addition & 202 deletions dist/responsive-carousel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Responsive Carousel - v0.1.0 - 2012-08-01
/*! Responsive Carousel - v0.1.0 - 2012-08-07
* https://github.com/filamentgroup/responsive-carousel
* Copyright (c) 2012 Filament Group, Inc.; Licensed MIT, GPL */

Expand Down Expand Up @@ -320,205 +320,4 @@
}
} );

}(jQuery));
/*
* responsive-carousel dynamic containers extension
* https://github.com/filamentgroup/responsive-carousel
*
* Copyright (c) 2012 Filament Group, Inc.
* Licensed under the MIT, GPL licenses.
*/

(function($) {

var pluginName = "carousel",
initSelector = "." + pluginName,
itemClass = pluginName + "-item",
activeClass = pluginName + "-active",
rowAttr = "data-" + pluginName + "-slide",
dynamicContainers = {
_assessContainers: function(){
var $self = $( this ),
$rows = $self.find( "[" + rowAttr + "]" ),
$activeItem = $rows.filter( "." + activeClass ).children( 0 ),
$kids = $rows.children(),
$nav = $self.find( "." + pluginName + "-nav" ),
sets = [];

if( !$rows.length ){
$kids = $( this ).find( "." + itemClass );
}
else{
$kids.appendTo( $self );
$rows.remove();
}

$kids
.removeClass( itemClass + " " + activeClass )
.each(function(){
var prev = $( this ).prev();

if( !prev.length || $( this ).offset().top !== prev.offset().top ){
sets.push([]);
}

sets[ sets.length -1 ].push( $( this ) );
});

for( var i = 0; i < sets.length; i++ ){
var $row = $( "<div " + rowAttr + "></div>" );
for( var j = 0; j < sets[ i ].length; j++ ){
$row.append( sets[ i ][ j ] );
}

$row.insertBefore( $nav );
}

$self[ pluginName ]( "update" );

$self.find( "." + itemClass ).eq( 0 ).addClass( activeClass );
},

_dynamicContainerEvents: function(){
var $self = $( this ),
timeout;

// on init
$self[ pluginName ]( "_assessContainers" );

// and on resize
$( window )
.bind( "resize", function( e ){
if( timeout ){
clearTimeout( timeout );
}

timeout = setTimeout( function(){
$self[ pluginName ]( "_assessContainers" );
}, 200 );
} );
}
};

// add methods
$.extend( $.fn[ pluginName ].prototype, dynamicContainers );

// DOM-ready auto-init
$( initSelector ).live( "create." + pluginName, function(){
$( this )[ pluginName ]( "_dynamicContainerEvents" );
} );

}(jQuery));
/*
* responsive-carousel autoplay extension
* https://github.com/filamentgroup/responsive-carousel
*
* Copyright (c) 2012 Filament Group, Inc.
* Licensed under the MIT, GPL licenses.
*/

(function( $, undefined ) {
var pluginName = "carousel",
initSelector = "." + pluginName,
interval = 4000,
autoPlayMethods = {
play: function(){
var $self = $( this ),
intAttr = $self.attr( "data-interval" ),
thisInt = parseFloat( intAttr ) || interval;
return $self.data(
"timer",
setInterval( function(){
$self[ pluginName ]( "next" );
},
thisInt )
);
},

stop: function(){
clearTimeout( $( this ).data( "timer" ) );
},

_bindStopListener: function(){
return $(this).bind( "mousedown", function(){
$( this )[ pluginName ]( "stop" );
} );
},

_initAutoPlay: function(){
var autoplay = $( this ).attr( "data-autoplay");
if( autoplay !== undefined && autoplay !== false ){
$( this )
[ pluginName ]( "_bindStopListener" )
[ pluginName ]( "play" );
}
}
};

// add methods
$.extend( $.fn[ pluginName ].prototype, autoPlayMethods );

// DOM-ready auto-init
$( initSelector ).live( "create." + pluginName, function(){
$( this )[ pluginName ]( "_initAutoPlay" );
} );

}(jQuery));
/*
* responsive-carousel pagination extension
* https://github.com/filamentgroup/responsive-carousel
*
* Copyright (c) 2012 Filament Group, Inc.
* Licensed under the MIT, GPL licenses.
*/

(function( $, undefined ) {
var pluginName = "carousel",
initSelector = "." + pluginName + "[data-paginate]",
paginationClass = pluginName + "-pagination",
paginationMethods = {
_createPagination: function(){
var nav = $( this ).find( "." + pluginName + "-nav" ),
items = $( this ).find( "." + pluginName + "-item" ),
pNav = $( "<ol class='" + paginationClass + "'></ol>" ),
num;

// remove any existing nav
nav.find( "." + paginationClass ).remove();

for( var i = 0, il = items.length; i < il; i++ ){
num = i + 1;
pNav.append( "<li><a href='#" + num + "' title='Go to slide " + num + "'>" + num + "</a>" );
}
nav
.addClass( pluginName + "-nav-paginated" )
.find( "a" ).first().after( pNav );
},
_bindPaginationEvents: function(){
$( this ).bind( "click", function( e ){
var pagLink = $( e.target ).closest( "a" ),
href = pagLink.attr( "href" );

if( pagLink.closest( "." + paginationClass ).length && href ){
$( this )[ pluginName ]( "goTo", parseFloat( href.split( "#" )[ 1 ] ) );
e.preventDefault();
}
} );
}
};

// add methods
$.extend( $.fn[ pluginName ].prototype, paginationMethods );

// create pagination on create and update
$( initSelector )
.live( "create." + pluginName, function(){
$( this )
[ pluginName ]( "_createPagination" )
[ pluginName ]( "_bindPaginationEvents" );
} )
.live( "update." + pluginName, function(){
$( this )[ pluginName ]( "_createPagination" );
} );

}(jQuery));
4 changes: 2 additions & 2 deletions dist/responsive-carousel.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion grunt.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = function(grunt) {
},
concat: {
dist: {
src: ['<banner:meta.banner>', 'src/responsive-carousel.js', 'src/responsive-carousel.touch.js', 'src/responsive-carousel.drag.js', 'src/responsive-carousel.dynamic-containers.js', 'src/responsive-carousel.autoplay.js', 'src/responsive-carousel.pagination.js' ],
src: ['<banner:meta.banner>', 'src/responsive-carousel.js', 'src/responsive-carousel.touch.js', 'src/responsive-carousel.drag.js' ],
dest: 'dist/<%= pkg.name %>.js'
}
},
Expand Down

0 comments on commit ea96724

Please sign in to comment.