 
 $ = (id) -> document.getElementById id
 bgExclusions = chrome.extension.getBackgroundPage().Exclusions
+restoreSettingsVersion = null
 
 # We have to use Settings from the background page here (not Settings, directly) to avoid a race condition for
 # the page popup.  Specifically, we must ensure that the settings have been updated on the background page

DomUtils?.documentReady ->
  $("backupButton").addEventListener "click", ->
    document.activeElement?.blur()
    backup = {}
    for option in Option.all
      backup[option.field] = option.readValueFromElement()
    # Create the blob in the background page so it isn't garbage collected when the page closes in FF.

          alert "Failed to parse Vimium backup."
          return

        restoreSettingsVersion = backup["settingsVersion"] if "settingsVersion" of backup
        for option in Option.all
          if option.field of backup
            option.populateElement backup[option.field]
