// Generated by CoffeeScript 1.6.3 /* FilmRoll (for jQuery) version: 0.1.8 (12/23/13) @requires jQuery >= v1.4 By Noel Peden Examples at http://straydogstudio.github.io/film_roll Licensed under the MIT: http://www.opensource.org/licenses/mit-license.php Usage: var film_troll = new FilmRoll({container: '#container_id', OPTIONS}); */(function(){var e=function(e,t){return function(){return e.apply(t,arguments)}};this.FilmRoll=function(){function t(t){this.options=t!=null?t:{};this.rotateRight=e(this.rotateRight,this);this.rotateLeft=e(this.rotateLeft,this);this.moveRight=e(this.moveRight,this);this.moveLeft=e(this.moveLeft,this);this.clearScroll=e(this.clearScroll,this);this.configureScroll=e(this.configureScroll,this);this.configureWidths=e(this.configureWidths,this);this.configureLoad=e(this.configureLoad,this);this.configureHover=e(this.configureHover,this);if(this.options.container){this.div=jQuery(this.options.container);this.div.length&&this.configure()}}t.prototype.configure=function(){var e,t=this;this.children=this.div.children();this.children.wrapAll('
');this.children.wrapAll('
');this.wrapper=this.div.find(".film_roll_wrapper");this.shuttle=this.div.find(".film_roll_shuttle");this.rotation=[];this.shuttle.width(this.options.shuttle_width?parseInt(this.options.shuttle_width,10):1e4);this.options.start_height&&this.wrapper.height(parseInt(this.options.start_height,10));this.options.vertical_center&&this.shuttle.addClass("vertical_center");if(this.options.no_css!==!0&&!document.film_roll_styles_added){jQuery("").appendTo("head");document.film_roll_styles_added=!0}if(this.options.pager!==!1){this.pager=jQuery('
');this.div.append(this.pager);this.children.each(function(e,n){var r;r=jQuery(""+(e+1)+"");t.pager.append(r);return r.click(function(){t.index=e;t.moveToIndex(t.index,"best",!0);return!1})})}this.pager_links=this.div.find(".film_roll_pager a");this.mouse_catcher=jQuery('
');this.mouse_catcher.appendTo(this.wrapper).mousemove(function(){t.clearScroll();return t.mouse_catcher.remove()});e=null;this.children.each(function(e,n){var r;r=jQuery(n);r.attr("data-film-roll-child-id",e);r.addClass("film_roll_child");return t.rotation.push(n)});if(this.options.prev&&this.options.next){this.prev=jQuery(this.options.prev);this.next=jQuery(this.options.next)}else{this.wrapper.append('');this.wrapper.append('');this.prev=this.div.find(".film_roll_prev");this.next=this.div.find(".film_roll_next")}this.prev.click(function(){return t.moveRight()});this.next.click(function(){return t.moveLeft()});this.index=this.options.start_index||0;this.interval=this.options.interval||4e3;this.animation=this.options.animation||this.interval/4;this.options.resize!==!1&&jQuery(window).resize(function(){return t.resize()});this.options.configure_load?this.configureLoad():jQuery(window).load(this.configureLoad);this.div.trigger(jQuery.Event("film_roll:dom_ready"));return this};t.prototype.bestDirection=function(e,t){t||(t=jQuery.inArray(e,this.rotation));return te&&(e=s)}return r});if(this.options.height)this.wrapper.height(this.options.height);else{this.wrapper.height("");this.wrapper.css("min-height",e)}this.real_width=this.width;this.shuttle.width(this.real_width*2).removeClass("film_roll_resizing").addClass("film_roll_shuttle");return this};t.prototype.configureScroll=function(){var e=this;if(this.scrolled!==!0){this.timer=setInterval(function(){return e.moveLeft()},this.interval);this.scrolled=!0}return this};t.prototype.clearScroll=function(){if(this.scrolled!==!1){clearInterval(this.timer);this.scrolled=!1}return this};t.prototype.marginLeft=function(e,t){var n,r,i,s,o,u;t==null&&(t=0);i=0;u=this.rotation;for(r=s=0,o=u.length;s=t&&(i+=jQuery(n).outerWidth(!0))}return i};t.prototype.marginRight=function(e,t){var n,r,i,s,o,u;t==null&&(t=0);t=this.rotation.length-t-1;i=0;u=this.rotation;for(r=s=0,o=u.length;se&&r<=t&&(i+=jQuery(n).outerWidth(!0))}return i};t.prototype.moveLeft=function(){this.index=(this.index+1)%this.children.length;this.moveToIndex(this.index,"left",!0);return!1};t.prototype.moveRight=function(){this.index-=1;this.index<0&&(this.index=this.children.length-1);this.moveToIndex(this.index,"right",!0);return!1};t.prototype.moveToChild=function(e){var t;t=jQuery.inArray(jQuery(e)[0],this.children);if(t>-1)return this.moveToIndex(t)};t.prototype.moveToIndex=function(e,t,n){var r,i,s,o,u,a,f=this;n==null&&(n=!0);this.index=e;this.clearScroll();r=this.children[e];o=jQuery.inArray(r,this.rotation);if(!t||t==="best")t=this.bestDirection(r,o);this.children.removeClass("active");jQuery(r).addClass("active").trigger(jQuery.Event("film_roll:activate"));this.pager_links.removeClass("active");jQuery(this.pager_links[e]).addClass("active");a=this.wrapper.width();if(a