// Generated by CoffeeScript 1.6.1 (function() { (function($, window, document) { var Plugin, defaults, pluginName; pluginName = "slidesjs"; defaults = { width: 940, height: 528, start: 1, dataKey : "", navigation: { active: true, effect: "slide" }, pagination: { active: true, effect: "slide" }, play: { active: false, effect: "slide", interval: 5000, auto: false, swap: true, pauseOnHover: false, restartDelay: 2500 }, effect: { slide: { speed: 500 }, fade: { speed: 300, crossfade: true } }, callback: { loaded: function() {}, start: function() {}, complete: function() {} } }; Plugin = (function() { function Plugin(element, options) { this.element = element; this.options = $.extend(true, {}, defaults, options); this._defaults = defaults; this._name = pluginName; this.init(); } return Plugin; })(); Plugin.prototype.init = function() { var dataKey = this.options.dataKey; var $element, nextButton, pagination, playButton, prevButton, stopButton, _this = this; $element = $(this.element); this.data = $.data(this); $.data(this, "animating", false); $.data(this, "total", $element.children().not(".slidesjs-navigation", $element).length); $.data(this, "current", this.options.start - 1); $.data(this, "vendorPrefix", this._getVendorPrefix()); if (typeof TouchEvent !== "undefined") { $.data(this, "touch", true); this.options.effect.slide.speed = this.options.effect.slide.speed / 2; } $element.css({ overflow: "hidden" }); $element.slidesContainer = $element.children().not(".slidesjs-navigation", $element).wrapAll("
", $element).parent().css({ overflow: "hidden", position: "relative" }); $(".slidesjs-container_"+dataKey, $element).wrapInner("
", $element).children(); $(".slidesjs-control_"+dataKey, $element).css({ position: "relative", left: 0 }); $(".slidesjs-control_"+dataKey, $element).children().addClass("slidesjs-slide").css({ position: "absolute", top: 0, left: 0, width: "100%", zIndex: 0, display: "none", webkitBackfaceVisibility: "hidden" }); $.each($(".slidesjs-control_"+dataKey, $element).children(), function(i) { var $slide; $slide = $(this); return $slide.attr("slidesjs-index", i); }); if (this.data.touch) { $(".slidesjs-control_"+dataKey, $element).on("touchstart", function(e) { return _this._touchstart(e); }); $(".slidesjs-control_"+dataKey, $element).on("touchmove", function(e) { return _this._touchmove(e); }); $(".slidesjs-control_"+dataKey, $element).on("touchend", function(e) { return _this._touchend(e); }); } $element.fadeIn(0); this.update(dataKey); if (this.data.touch) { this._setuptouch(dataKey); } $(".slidesjs-control_"+dataKey, $element).children(":eq(" + this.data.current + ")").eq(0).fadeIn(0, function() { return $(this).css({ zIndex: 10 }); }); if (this.options.navigation.active) { prevButton = $("", { "class": "slidesjs-previous_"+dataKey+" slidesjs-navigation", href: "#", title: "Previous", text: "Previous" }).appendTo($element); prevButton.wrapAll("
", $element); nextButton = $("", { "class": "slidesjs-next_"+dataKey+" slidesjs-navigation", href: "#", title: "Next", text: "Next" }).appendTo($element); nextButton.wrapAll("
", $element); } $(".slidesjs-next_"+dataKey, $element).click(function(e) { e.preventDefault(); _this.stop(true, dataKey); return _this.next(_this.options.navigation.effect, dataKey); }); $(".slidesjs-previous_"+dataKey, $element).click(function(e) { e.preventDefault(); _this.stop(true, dataKey); return _this.previous(_this.options.navigation.effect, dataKey); }); if (this.options.play.active) { playButton = $("", { "class": "slidesjs-play_"+dataKey+" slidesjs-navigation", href: "#", title: "Play", text: "Play" }).appendTo($element); playButton.wrapAll("
", $element); stopButton = $("", { "class": "slidesjs-stop_"+dataKey+" slidesjs-navigation", href: "#", title: "Stop", text: "Stop" }).appendTo($element); stopButton.wrapAll("
", $element); $(".slidesjs-play_"+dataKey, $element).click(function(e) { e.preventDefault(); return _this.play(true, dataKey); }); $(".slidesjs-stop_"+dataKey, $element).click(function(e) { e.preventDefault(); return _this.stop(true, dataKey); }); if (this.options.play.swap) { stopButton.css({ display: "none" }); } } if (this.options.pagination.active) { pagination = $("