<commit_before>_ = require 'underscore'
imagesLoaded = require 'imagesloaded'
Backbone = require 'backbone'
template = -> require('./template.jade') arguments...

module.exports = class Carousel extends Backbone.View
  className: 'carousel'
  tagName: 'section'

  events:
    'click .carousel-dot': 'dotClick'
    'click .carousel-figures .carousel-figure': 'figureClick'
    'click .carousel-pre-decoys .carousel-figure': 'shiftLeft'
    'click .carousel-arrow-left': 'shiftLeft'
    'click .carousel-post-decoys .carousel-figure': 'shiftRight'
    'click .carousel-arrow-right': 'shiftRight'
    'touchstart .carousel-figures-clip': 'swipeStart'
    'touchend .carousel-figures-clip': 'swipeEnd'

  active: 0
  centerIndex: 0
  firstDecoyPosition: 0
  height: 480
  inTransition: false
  lastDecoyPosition: 0
  length: 0
  minLength: 2
  noDecoys: false
  prefixWidth: 0
  stopPositions: []
  transitionDuration: '0.5s'
  hasDimensions: true

  initialize: (options) ->
    @$window = $(window)
    @$document = $(document)
    @length = @collection?.length or @$('.carousel-figures .carousel-figure').length
    { @height } = options

  cacheSelectors: ->
    @$track = @$('.carousel-track')
    @$preDecoys = @$('.carousel-pre-decoys')
    @$postDecoys = @$('.carousel-post-decoys')
    @$decoys = @$preDecoys.add @$postDecoys
    @$figures = @$('.carousel-figures .carousel-figure')
    @$dots = @$('.carousel-dot')

  postRender: ->
    @cacheSelectors()

    # Start the carousel at the first image
    @setActive 0

    # When images are loaded, do the math
    if @hasDimensions
      @complete()
    else
      @$el.imagesLoaded?()?.always => @complete()
<commit_msg>Pull out the hasDimensions option<commit_after>_ = require 'underscore'
imagesLoaded = require 'imagesloaded'
Backbone = require 'backbone'
template = -> require('./template.jade') arguments...

module.exports = class Carousel extends Backbone.View
  className: 'carousel'
  tagName: 'section'

  events:
    'click .carousel-dot': 'dotClick'
    'click .carousel-figures .carousel-figure': 'figureClick'
    'click .carousel-pre-decoys .carousel-figure': 'shiftLeft'
    'click .carousel-arrow-left': 'shiftLeft'
    'click .carousel-post-decoys .carousel-figure': 'shiftRight'
    'click .carousel-arrow-right': 'shiftRight'
    'touchstart .carousel-figures-clip': 'swipeStart'
    'touchend .carousel-figures-clip': 'swipeEnd'

  active: 0
  centerIndex: 0
  firstDecoyPosition: 0
  height: 480
  inTransition: false
  lastDecoyPosition: 0
  length: 0
  minLength: 2
  noDecoys: false
  prefixWidth: 0
  stopPositions: []
  transitionDuration: '0.5s'
  hasDimensions: true

  initialize: (options) ->
    @$window = $(window)
    @$document = $(document)
    @length = @collection?.length or @$('.carousel-figures .carousel-figure').length
    { @height, @hasDimensions } = options

  cacheSelectors: ->
    @$track = @$('.carousel-track')
    @$preDecoys = @$('.carousel-pre-decoys')
    @$postDecoys = @$('.carousel-post-decoys')
    @$decoys = @$preDecoys.add @$postDecoys
    @$figures = @$('.carousel-figures .carousel-figure')
    @$dots = @$('.carousel-dot')

  postRender: ->
    @cacheSelectors()

    # Start the carousel at the first image
    @setActive 0

    # When images are loaded, do the math
    if @hasDimensions
      @complete()
    else
      @$el.imagesLoaded?()?.always => @complete()

{'fraction_non_alphanumeric': 0.1509433962264151, 'fraction_numerical': 0.0076650943396226415, 'mean_word_length': 3.560483870967742, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5978209', 'n_tokens_mistral': 1195, 'n_tokens_neox': 1131, 'n_words': 257}