I've edited it to do what you want, and I've made the javascript (slightly) clearer so you can see what's going on. If you do have the un-minified javascript, I would recommend making similar edits to that instead.
(function () {
rt.Homepage = function () {
function e() {
var e = this;
this.currentCaption = 0;
this.$carousel = $(".js-carousel");
this.$captions = $(".js-captions");
this.switchCaption(1);
// set a variable for the interval, so we can stop it later
this.interval = setInterval(function () {
return e.advanceCaption()
}, 1500);
this.addHandlers();
}
e.prototype.addHandlers = function () {}
e.prototype.advanceCaption = function () {
this.currentCaption++;
// if currentCaption reaches final caption, stop the interval
if (this.currentCaption >= 4) {
clearInterval(this.interval)
}
return this.switchCaption(this.currentCaption + 1);
}
e.prototype.switchCaption = function (e) {
var t, n, r, i, s, o, u = this;
n = "state-1 state-2 state-3 state-4 state-5";
this.$carousel.removeClass(n).addClass("state-" + e);
o = this.$captions;
for (i = 0, s = o.length; i < s; i++) t = o[i];
r = $(".caption-" + e, t).width(), $(t).width(r);
return _.delay(function () {
return u.$carousel.addClass("show-caption")
}, 500)
}
return e;
}(), $(function () {
return new rt.Homepage
})
}).call(this);