 # In case jQuery is brought in after this file
 setTimeout wrapJQuery, 0
 
-class Odometer
+class TextRoller
   constructor: (@options) ->
     @el = @options.el
     return @el.odometer if @el.odometer?
 
     @el.odometer = @
 
-    for k, v in Odometer.options
+    for k, v in TextRoller.options
       if not @options[k]?
         @options[k] = v
 

    if fractionalCount
      @addSpacer @format.radix, @digits[fractionalCount - 1], 'odometer-radix-mark'

Odometer.options = window.odometerOptions ? {}

setTimeout ->
  # We do this in a seperate pass to allow people to set
  # window.odometerOptions after bringing the file in.
  if window.odometerOptions
    for k, v of window.odometerOptions
      Odometer.options[k] ?= v
, 0

Odometer.init = ->
  if not document.querySelectorAll?
    # IE 7 or 8 in Quirksmode
    return

  elements = document.querySelectorAll (Odometer.options.selector or '.odometer')

  for el in elements
    el.odometer = new Odometer {el, value: el.innerText}

if document.documentElement?.doScroll? and document.createEventObject?
  # IE < 9
  _old = document.onreadystatechange
  document.onreadystatechange = ->
    if document.readyState is 'complete' and Odometer.options.auto isnt false
      Odometer.init()

    _old?.apply this, arguments
else
  document.addEventListener 'DOMContentLoaded', ->
    if Odometer.options.auto isnt false
      Odometer.init()
  , false

window.Odometer = Odometer


    parsed = FORMAT_PARSER.exec format
    if not parsed
      throw new Error "TextRoller: Unparsable digit format"

    [repeating, radix, fractional] = parsed[1..3]

