Skip to content

Commit

Permalink
Fix JavaScript lint errors, missing semicolons and parseInt second ar…
Browse files Browse the repository at this point in the history
…gument
  • Loading branch information
Lance Willett committed Oct 25, 2013
1 parent ca347d4 commit 301b058
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions jquery.flexslider.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
init: function() {
slider.animating = false;
// Get current slide and make sure it is a number
slider.currentSlide = parseInt( ( slider.vars.startAt ? slider.vars.startAt : 0) );
slider.currentSlide = parseInt( ( slider.vars.startAt ? slider.vars.startAt : 0), 10 );
if ( isNaN( slider.currentSlide ) ) slider.currentSlide = 0;
slider.animatingTo = slider.currentSlide;
slider.atEnd = (slider.currentSlide === 0 || slider.currentSlide === slider.last);
Expand Down Expand Up @@ -626,7 +626,7 @@
watchedEvent = "";
}, 3000);
}
}
};

// public methods
slider.flexAnimate = function(target, pause, override, withSync, fromNav) {
Expand Down Expand Up @@ -738,7 +738,7 @@
// SMOOTH HEIGHT:
if (slider.vars.smoothHeight) methods.smoothHeight(slider.vars.animationSpeed);
}
}
};
slider.wrapup = function(dimension) {
// SLIDE:
if (!fade && !carousel) {
Expand All @@ -752,12 +752,12 @@
slider.currentSlide = slider.animatingTo;
// API: after() animation Callback
slider.vars.after(slider);
}
};

// SLIDESHOW:
slider.animateSlides = function() {
if (!slider.animating && focused ) slider.flexAnimate(slider.getTarget("next"));
}
};
// SLIDESHOW:
slider.pause = function() {
clearInterval(slider.animatedSlides);
Expand All @@ -767,7 +767,7 @@
if (slider.vars.pausePlay) methods.pausePlay.update("play");
// SYNC:
if (slider.syncExists) methods.sync("pause");
}
};
// SLIDESHOW:
slider.play = function() {
if (slider.playing) clearInterval(slider.animatedSlides);
Expand All @@ -777,12 +777,12 @@
if (slider.vars.pausePlay) methods.pausePlay.update("pause");
// SYNC:
if (slider.syncExists) methods.sync("play");
}
};
// STOP:
slider.stop = function () {
slider.pause();
slider.stopped = true;
}
};
slider.canAdvance = function(target, fromNav) {
// ASNAV:
var last = (asNav) ? slider.pagingCount - 1 : slider.last;
Expand All @@ -794,15 +794,15 @@
(slider.atEnd && slider.currentSlide === 0 && target === last && slider.direction !== "next") ? false :
(slider.atEnd && slider.currentSlide === last && target === 0 && slider.direction === "next") ? false :
true;
}
};
slider.getTarget = function(dir) {
slider.direction = dir;
if (dir === "next") {
return (slider.currentSlide === slider.last) ? 0 : slider.currentSlide + 1;
} else {
return (slider.currentSlide === 0) ? slider.last : slider.currentSlide - 1;
}
}
};

// SLIDE:
slider.setProps = function(pos, special, dur) {
Expand Down Expand Up @@ -836,7 +836,7 @@

slider.args[slider.prop] = target;
if (slider.transitions || dur === undefined) slider.container.css(slider.args);
}
};

slider.setup = function(type) {
// SLIDE:
Expand Down Expand Up @@ -901,8 +901,7 @@
// !CAROUSEL:
// CANDIDATE: active slide
if (!carousel) slider.slides.removeClass(namespace + "active-slide").eq(slider.currentSlide).addClass(namespace + "active-slide");
}

};

slider.doMath = function() {
var slide = slider.slides.first(),
Expand Down Expand Up @@ -935,8 +934,7 @@
slider.last = slider.count - 1;
}
slider.computedW = slider.itemW - slider.boxPadding;
}

};

slider.update = function(pos, action) {
slider.doMath();
Expand Down Expand Up @@ -966,7 +964,7 @@
// update directionNav
if (slider.vars.directionNav) methods.directionNav.update();

}
};

slider.addSlide = function(obj, pos) {
var $obj = $(obj);
Expand All @@ -991,7 +989,7 @@

//FlexSlider: added() Callback
slider.vars.added(slider);
}
};
slider.removeSlide = function(obj) {
var pos = (isNaN(obj)) ? slider.slides.index($(obj)) : obj;

Expand All @@ -1017,11 +1015,11 @@

// FlexSlider: removed() Callback
slider.vars.removed(slider);
}
};

//FlexSlider: Initialize
methods.init();
}
};

// Ensure the slider isn't focussed if the window loses focus.
$( window ).blur( function ( e ) {
Expand Down Expand Up @@ -1091,8 +1089,7 @@
end: function(){}, //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)
added: function(){}, //{NEW} Callback: function(slider) - Fires after a slide is added
removed: function(){} //{NEW} Callback: function(slider) - Fires after a slide is removed
}

};

//FlexSlider: Plugin Function
$.fn.flexslider = function(options) {
Expand Down Expand Up @@ -1124,5 +1121,5 @@
default: if (typeof options === "number") $slider.flexAnimate(options, true);
}
}
}
};
})(jQuery);

0 comments on commit 301b058

Please sign in to comment.