Skip to content

Commit

Permalink
Switched to ESLint
Browse files Browse the repository at this point in the history
  • Loading branch information
MrSaints committed Aug 19, 2014
1 parent 3e38b83 commit cb4b885
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
10 changes: 5 additions & 5 deletions Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ module.exports = (grunt) ->
files:
'dist/morphist.min.js': ['dist/morphist.js']

jshint:
eslint:
all: ['dist/morphist.js']

grunt.loadNpmTasks 'grunt-contrib-jshint';
grunt.loadNpmTasks 'grunt-contrib-uglify';
grunt.loadNpmTasks 'grunt-contrib-uglify'
grunt.loadNpmTasks 'grunt-eslint'

grunt.registerTask('default', ['uglify', 'test']);
grunt.registerTask('test', ['jshint']);
grunt.registerTask 'default', ['uglify', 'test']
grunt.registerTask 'test', ['eslint']
24 changes: 13 additions & 11 deletions dist/morphist.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Morphist v1.0.0 - Text Rotating Plugin for jQuery
* Morphist v1.1.1 - Generic Rotating Plugin for jQuery
* https://github.com/MrSaints/Morphist
*
* Built on jQuery Boilerplate
Expand All @@ -9,7 +9,12 @@
* Released under the MIT license
* http://ian.mit-license.org/
*/
;(function ($, window, document, undefined) {

/*eslint-env browser */
/*global jQuery:false */
/*eslint-disable no-underscore-dangle */

(function ($) {
var pluginName = "Morphist",
defaults = {
animateIn: "bounceIn",
Expand All @@ -28,13 +33,9 @@

Plugin.prototype = {
init: function () {
var $that = this;
this.children = this.element.children();

this.element.addClass('morphist');

this.element.addClass("morphist");
this.index = -1;

this.cycle();
},
animate: function () {
Expand All @@ -43,7 +44,7 @@
++this.index;
this.prev = this.index;

this.children.eq(this.index).addClass('animated ' + this.settings.animateIn);
this.children.eq(this.index).addClass("animated " + this.settings.animateIn);

setTimeout(function () {
$that.cycle();
Expand All @@ -52,13 +53,14 @@
cycle: function () {
var $that = this;

if ((this.index + 1) === this.children.length)
if ((this.index + 1) === this.children.length) {
this.index = -1;
}

if (typeof this.prev !== "undefined" && this.prev !== null) {
this.children.eq(this.prev)
.addClass(this.settings.animateOut)
.one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() {
.one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", function() {
$(this).removeClass();
$that.animate();
});
Expand All @@ -76,4 +78,4 @@
}
});
};
})(jQuery, window, document);
})(jQuery);
2 changes: 1 addition & 1 deletion dist/morphist.min.js

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
},
"homepage": "https://github.com/MrSaints/Morphist",
"devDependencies": {
"grunt": "^0.4.6-0",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-uglify": "^0.5.0"
"grunt": "^0.4.5",
"grunt-contrib-uglify": "^0.5.1",
"grunt-eslint": "^1.0.0"
}
}

0 comments on commit cb4b885

Please sign in to comment.