 
   DEFAULT_EMAIL_INPUT_SELECTOR = 'input[type="email"], input[type="text"]'
 
+  @init: ->
+    instance = new @ unless instance
+
+    instance
+
+  @setToken: (token) ->
+    @init().token = token
+
+  @send: (email) ->
+    @init().send(email)
+
   constructor: ->
-    @token = document.querySelector('script[data-token]').getAttribute('data-token')
-    @debug = document.querySelector('script[data-debug]').getAttribute('data-debug')
-    @installListeners()
+    @token = @getDataAttribute('data-token')
+    @debug = @getDataAttribute('data-debug')
+    @auto  = @getDataAttribute('data-auto')
+
+    if @token and @auto
+      @installListeners()
 
   forms: ->
     document.forms

#= require superagent

class @SignupSumo
  DEFAULT_BASE_ENDPOINT = "http://signupsumo.com/api/v1/"

  DEFAULT_NOTIFIER_ENDPOINT = DEFAULT_BASE_ENDPOINT + "signups"

    if @debug and console
      [].unshift.call(arguments, "[SignupSumo v#{NOTIFIER_VERSION}]")
      console.log.apply(console, arguments)

  getDataAttribute: (name) ->
    document.querySelector("script[#{name}]")?.getAttribute(name)

  installListeners: ->
    @log 'Installing listeners...'
