       params.username  = utils.get 'yourlsUsername'
     else if utils.get 'yourlsSignature'
       params.signature = utils.get 'yourlsSignature'
-    return params
+    params
   input: ->
-    return null
+    null
   isEnabled: ->
-    return utils.get 'yourls'
+    utils.get 'yourls'
   method: 'POST'
   name: 'YOURLS'
   output: (resp) ->
-    return JSON.parse(resp).shorturl
+    JSON.parse(resp).shorturl
   url: ->
-    return utils.get 'yourlsUrl'
+    utils.get 'yourlsUrl'
 ]
 # List of extensions supported by Template and used for compatibility purposes.
 SUPPORT           = [

          return ''
      cookies: names
    # Try to prevent pages hanging because content script wasn't executed.
    if ext.isProtectedPage tab
      $.extend data,
        selection:      ''
        selectionlinks: []

    yourlssignature: utils.get 'yourlsSignature'
    yourlsurl: utils.get 'yourlsUrl'
    yourlsusername: utils.get 'yourlsUsername'
  data

# HTML building functions
# -----------------------

# Create an `li` element to represent `feature`.  
# The element should then be inserted in to the `ul` element in the popup page
# but is created here to optimize display times for the popup.
buildFeature = (feature) ->
  image   = getImagePathForFeature feature, yes
  image or= '../images/spacer.png'
  item    = $ '<li/>',
    name:    feature.name
    onclick: 'popup.sendRequest(this)'
  menu    = $ '<div/>',
    class: 'menu'
    style: "background-image: url('#{image}')"
  menu.append $ '<span/>',
    class: 'text'
    text:  feature.title
  if utils.get 'shortcuts'
    modifiers = ext.SHORTCUT_MODIFIERS
    modifiers = ext.SHORTCUT_MAC_MODIFIERS if ext.isThisPlatform 'mac'
    menu.append $ '<span/>',
      class: 'shortcut',
      html:  if feature.shortcut then modifiers + feature.shortcut else ''
  item.append menu

# Build the HTML to populate the popup with to optimize popup loading times.
buildPopup = ->
  item     = $ '<div id="item"/>'
  itemList = $ '<ul id="itemList"/>'
  loadDiv  = $ '<div id="loadDiv"/>'
  $.prototype.append.apply loadDiv [
    $ '<img src="../images/loading.gif"/>'
    $ '<div/>', text: utils.i18n 'shortening'
  ]
  # Generate the HTML for each feature.
  for feature in ext.features when feature.enabled
    itemList.append buildFeature feature
  # Add a generic message to state the obvious... that the list is empty.
  if itemList.find('li').length is 0
    itemList.append $('<li/>').append $('<div/>',
      class: 'menu'
      style: "background-image: url('../images/spacer.png')"
    ).append $ '<span/>',
      class: 'text'
      style: 'margin-left: 0'
      text:  utils.i18n 'empty'
  item.append itemList
  ext.popupHtml = $('<div/>').append(loadDiv, item).html()

# Initialization functions
# ------------------------

# Handle the conversion/removal of older version of settings that may have
# been stored previously by `ext.init`.
init_update = ->
  update_progress = utils.get 'update_progress'
  update_progress.settings ?= []
  # Check if the settings need updated for 0.1.0.0.
  if update_progress.settings.indexOf('0.1.0.0') is -1
    # Update the settings for 0.1.0.0.
    utils.rename 'settingNotification', 'notifications', on
    utils.rename 'settingNotificationTimer', 'notificationDuration', 3000
    utils.rename 'settingShortcut', 'shortcuts', on
    utils.rename 'settingTargetAttr', 'doAnchorTarget', off
    utils.rename 'settingTitleAttr', 'doAnchorTitle', off
    utils.remove 'settingIeTabExtract'
    utils.remove 'settingIeTabTitle'
    # Ensure that settings are not updated for 0.1.0.0 again.
    update_progress.settings.push '0.1.0.0'
    utils.set 'update_progress', update_progress

# Initilaize the settings for `feature`.  
# Store the name of the `feature` in the persisted list of managed features.
initFeature = (feature) ->
  utils.set "feat_#{feature.name}_content",   feature.content
  utils.init "feat_#{feature.name}_enabled",  feature.enabled
  utils.init "feat_#{feature.name}_image",    feature.image
  utils.init "feat_#{feature.name}_index",    feature.index
  utils.set "feat_#{feature.name}_readonly",  feature.readOnly
  utils.init "feat_#{feature.name}_shortcut", feature.shortcut
  utils.set "feat_#{feature.name}_title",     feature.title
  addFeatureName feature.name
  feature

# Initialize the persisted managed features.
initFeatures = ->
  utils.init 'features', []
  initFeatures_update()
  initFeature feature for feature in DEFAULT_FEATURES
  ext.updateFeatures()

# Handle the conversion/removal of older version of settings that may have
# been stored previously by `initFeatures`.
initFeatures_update = ->
  update_progress = utils.get 'update_progress'
  update_progress.features ?= []
  # Check if the features need updated for 0.1.0.0.
  if update_progress.features.indexOf('0.1.0.0') is -1
    # Update the features for 0.1.0.0.
    utils.rename 'copyAnchorEnabled', 'feat__anchor_enabled', yes
    utils.rename 'copyAnchorOrder', 'feat__anchor_index', 2
    utils.rename 'copyBBCodeEnabled', 'feat__bbcode_enabled', no
    utils.rename 'copyBBCodeOrder', 'feat__bbcode_index', 4
    utils.rename 'copyEncodedEnabled', 'feat__encoded_enabled', yes
    utils.rename 'copyEncodedOrder', 'feat__encoded_index', 3
    utils.rename 'copyShortEnabled', 'feat__short_enabled', yes
    utils.rename 'copyShortOrder', 'feat__short_index', 1
    utils.rename 'copyUrlEnabled', 'feat__url_enabled', yes
    utils.rename 'copyUrlOrder', 'feat__url_index', 0
    # Ensure that features are not updated for 0.1.0.0 again.
    update_progress.features.push '0.1.0.0'
    utils.set 'update_progress', update_progress
  # Check if the features need updated for 0.2.0.0.
  if update_progress.features.indexOf('0.2.0.0') is -1
    # Update the features for 0.2.0.0.
    names = utils.get 'features'
    for name in utils.get 'features'
      utils.rename "feat_#{name}_template", "feat_#{name}_content"
      image = utils.get "feat_#{name}_image"
      if typeof image is 'string'
        for img in ext.IMAGES when img.file is image
          utils.set "feat_#{name}_image", img.id
          break
      else if typeof image is 'undefined'
        utils.set "feat_#{name}_image", 0
    # Ensure that features are not updated for 0.2.0.0 again.
    update_progress.features.push '0.2.0.0'
    utils.set 'update_progress', update_progress

# Initialize the settings related to the toolbar/browser action.
initToolbar = ->
  utils.init 'toolbarPopup', on
  utils.init 'toolbarFeature', off
  utils.init 'toolbarFeatureDetails', off
  utils.init 'toolbarFeatureName', ''
  ext.updateToolbar()

# Initialize the settings related to the supported URL Shortener services.
initUrlShorteners = ->
  initUrlShorteners_update()
  utils.init 'bitly', off
  utils.init 'bitlyApiKey', ''
  utils.init 'bitlyUsername', ''
  utils.init 'googl', on
  utils.init 'googlOAuth', on
  utils.init 'yourls', off
  utils.init 'yourlsPassword', ''
  utils.init 'yourlsSignature', ''
  utils.init 'yourlsUrl', ''
  utils.init 'yourlsUsername', ''

# Handle the conversion/removal of older version of settings that may have
# been stored previously by `initUrlShorteners`.
initUrlShorteners_update = ->
  update_progress = utils.get 'update_progress'
  update_progress.shorteners ?= []
  # Check if the URL shorteners need updated for 0.1.0.0.
  if update_progress.shorteners.indexOf('0.1.0.0') is -1
    # Update the URL shorteners for 0.1.0.0.
    utils.rename 'bitlyEnabled', 'bitly', off
    utils.rename 'bitlyXApiKey', 'bitlyApiKey', ''
    utils.rename 'bitlyXLogin', 'bitlyUsername', ''
    utils.rename 'googleEnabled', 'googl', on
    utils.rename 'googleOAuthEnabled', 'googlOAuth', on
    # Ensure that URL shorteners are not updated for 0.1.0.0 again.
    update_progress.shorteners.push '0.1.0.0'
    utils.set 'update_progress', update_progress

# URL shortener functions
# -----------------------

# Call the active URL shortener service for `url` in order to obtain the
# relevant short URL.  
