Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
Refactoring: Sepearate renderers and feature support from coverflow core.
Refactor 2d/classic renderer: look and feel like Brandon's renderer, use same config options
Add Hammer.js support
Add standalone version
Fix transitionend on MSIE >= 10
  • Loading branch information
basti1253 committed Jan 19, 2014
1 parent 3895000 commit 2c9365a
Show file tree
Hide file tree
Showing 86 changed files with 7,515 additions and 13,197 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ publish

## nodejs dependencies
node_modules
src/css/coverflow.unprefixed.css
1 change: 1 addition & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ Paul Bakaus <[email protected]>
Addy Osmani <[email protected]>
Sebastian Sauer <[email protected]>
Brandon Belvin <[email protected]>
April Barrett
87 changes: 75 additions & 12 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,19 @@ module.exports = function( grunt ) {

"use strict";

var jsFiles = [
'src/js/coverflow.js'
var uiFiles = [
"libs/jquery-ui/ui/jquery.ui.core.js",
"libs/jquery-ui/ui/jquery.ui.widget.js",
"libs/jquery-ui/ui/jquery.ui.effect.js"
],
pluginFiles = [
"src/js/support.core.js",
"src/js/support.transform3d.js",
"src/js/renderer.classic.js",
"src/js/renderer.3d.js",
"src/js/coverflow.js"
],
jsFiles = uiFiles.concat( pluginFiles ),
cssFiles = [
"src/css/coverflow.css"
],
Expand All @@ -24,7 +34,8 @@ var jsFiles = [
banner: banner
},
files: {
"dist/coverflow.min.js": "dist/coverflow.js"
"dist/coverflow.min.js": "dist/coverflow.js",
"dist/coverflow.standalone.min.js": "dist/coverflow.standalone.js"
}
}
},
Expand All @@ -43,13 +54,16 @@ var jsFiles = [


// grunt plugins
grunt.loadNpmTasks( "grunt-git-authors" );
grunt.loadNpmTasks( "grunt-autoprefixer" );
grunt.loadNpmTasks( "grunt-contrib-jshint" );
grunt.loadNpmTasks( "grunt-contrib-uglify" );
grunt.loadNpmTasks( "grunt-contrib-concat" );
grunt.loadNpmTasks( "grunt-contrib-qunit" );
grunt.loadNpmTasks( "grunt-contrib-copy");
grunt.loadNpmTasks( "grunt-compare-size" );
grunt.loadNpmTasks( "grunt-git-authors" );
grunt.loadNpmTasks( "grunt-contrib-less" );
grunt.loadNpmTasks( "grunt-contrib-watch" );

grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
Expand All @@ -73,6 +87,16 @@ grunt.initConfig({
src: jsFiles,
dest: "dist/coverflow.js"
},
standalone : {
options: {
banner: banner,
stripBanners: {
block: true
}
},
src: pluginFiles,
dest: "dist/coverflow.standalone.js"
},
css: {
options: {
banner: banner,
Expand All @@ -92,17 +116,15 @@ grunt.initConfig({
"AUTHORS.txt",
"MIT-LICENSE.txt",
"README.md",
"package.json",
"libs/jquery.mobile.custom.js",
"libs/jquery.mobile.custom.min.js",
"package.json"
],
dest: 'dist/',
filter: 'isFile'
dest: "dist/",
filter: "isFile"
}]
}
},
qunit: {
files: "tests/qunit/**/*.html"
all: [ "tests/qunit/*.html" ]
},
jshint: {
all: {
Expand All @@ -113,12 +135,53 @@ grunt.initConfig({
src: "src/js/*.js"
}
}
}
},
autoprefixer: {
all: {
files: {
"src/css/coverflow.css" : "src/css/coverflow.unprefixed.css"
}
}
},
less: {
dev: {
options: {
dumpLineNumbers : true
},
files: {
"src/css/coverflow.unprefixed.css": "src/css/coverflow.less"
}
},
dist : {
options: {
cleancss : true
},
files: {
"src/css/coverflow.unprefixed.css": "src/css/coverflow.less"
}
}

},
watch: {
css: {
options : {
livereload : true
},
files: [
"src/css/**/*.less",
"src/js/**/*.js",
"tests/qunit/visual*.html"
],
tasks: [ "css" ]
}
},
});

grunt.registerTask( "default", [ "lint", "test" ] );
grunt.registerTask( "lint", [ "jshint" ] );
grunt.registerTask( "test", [ "qunit" ] );
grunt.registerTask( "build", [ "concat", "copy", "uglify" ] );
grunt.registerTask( "css", [ "less:dev", "autoprefixer" ] );
grunt.registerTask( "css:release", [ "less:dist", "autoprefixer", "concat:css" ] );
grunt.registerTask( "build", [ "css", "concat:js", "concat:standalone", "copy", "uglify" ] );

};
120 changes: 4 additions & 116 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,124 +8,12 @@ The jQueryUI Coverflow project seeks to create a fully functional 'CoverFlow' ef

`#: git clone --recursive git://github.com/coverflowjs/coverflow.git`

## automatic event binding:

This coverflow effect binds to the following events on initialization:

- mousewheel
- mobile swipe events
- keyboard selection (tabbed)
- items.click
- items.focus

## public events:
- beforeselect
- select

## Documentation

**Plugin Methods**

- select( Int/{jQuery} item ):

Returns a boolean (selection success). Pass an item index (zero based) or any valid jQuery coverflow item. So these expressions are equivalent:

` $( '#coverflow' ).coverflow( 'select', 2 );`

` $( '#coverflow' ).coverflow( 'select', $('#coverflow > *:eq(2)' ) );`

- next()

` $( '#coverflow' ).coverflow( 'prev' );`

Returns a boolean (selection success). Selects next/previous item.

- prev()

` $( '#coverflow' ).coverflow( 'prev' );`

Returns a boolean (selection success). Selects next/previous item.


**Plugin Options:**

- items (string):

Any valid jQuery Selector. Default any child element of your coverflow container.

- stacking (float) DEPRECATED:

This option is now deprecated. Please see the rendererOptions option below.

- active (int >=0):

active item index on initialisation, zero based. Default the first item got selected.

- duration (int):

animation duration in ms, default 200.

- easing (string):

easing used for animation. Defaults to 'easeOutQuint'

- trigger (plain object):

automatic event bindings you may want to customize. Your options are:

- itemfocus
- itemclick
- mousewheel
- swipe : true (default) or "momentum" for momentum-based swipe scrolling

- swipefriction (float):

friction effect to apply on momentum-based swipe scrolling, default 0.43

- renderer (string):

Select which renderer to use for coverflow effect: "classic" (default) or "3d"

- rendererOptions (plain object):

Options to send to the renderer

Options for "classic" :

- stacking (float) - Value between 0 and 1. Defines how close items should stack. Default 0.73

Options for "3d" :

- angle (float) - Angle in degrees at which to fold the items back from origin. Default 60
- scale (float) - Percentage scale to resize to non-active items. Default 0.85
- overlap (float) - Value between 0 and 1. Percentage overflap for non-active items. Default 0.3
- perspectiveY (int) - Percentage below origin to view the 3D transforms. Default 45

**Swipe Support:**

Swipe support depends on jQuery mobile. If you only want to support swipe (and don't need the full jQm lib), you can use the custom build that ships with this repository (it's just jQm core/events).

It is hightly recommended to turn off the `itemfocus` trigger when using momentum-based swipe scrolling.

**CSS3 Transitions support:**

Depends on [$.fn.transit](https://github.com/rstacruz/jquery.transit) and [$.fn.getStyles](https://github.com/moagrius/copycss). Simply include libs/jquery.transit.js and libs/jquery.copycss.js.

**jQuery animate fallback:**

Don't want to include any external libraries besides jQueryUI? No problem. Coverflowjs will fallback to jQuery's animate fn.

**Mousewheel support:**

No external lib needed.

**Internet Explorer transformations for IE<=9:**

You don't need transformie or sylvester. Filter matrices for IE are applied if there's no css3 transform support.

## Examples

Check out demo/index.html or tests/visual.html in your browser.
- [Get started](http://coverflowjs.github.io/coverflow/tutorial/get-started/)
- [API options](http://coverflowjs.github.io/coverflow/api/options/)
- [API events](http://coverflowjs.github.io/coverflow/api/events/)
- [API methods](http://coverflowjs.github.io/coverflow/api/methods/)

## License
Copyright (c) 2008-2013 Paul Baukus, Addy Osmani, Sebastian Sauer, Brandon Belvin
Expand Down
Loading

0 comments on commit 2c9365a

Please sign in to comment.