tUtil.cachedSubscriptions['url:' + item.url]) {
        // or user subscribed filter list
        updateItem(item, 'url:' + item.url);
        return;
      } else if (action === 'subscription.title' && param1)
      {
        // or if the URL changed due to a redirect, we may not be able to determine
        // the correct id, but should be able to using one of the params
        var id = backgroundPage.getIdFromURL(param1);
        if (id)
        {
          updateItem(item, id);
          return;
        } else
        {
          var id = backgroundPage.getIdFromURL(param2);
          if (id)
          {
            updateItem(item, id);
            return;
          }
        }
      }
    }
    // If we didn't get an entry or id, loop through all of the subscriptions.
    var subs = backgroundPage.getAllSubscriptionsMinusText();
    var cachedSubscriptions = FilterListUtil.cachedSubscriptions;
    for (var id in cachedSubscriptions)
    {
      var entry = subs[id];
      updateEntry(entry);
    }
  }
}

function translateIDs(id) {
  if (id.endsWith('_old')) {
    var trimmedID = id.split(/_old$/)[0];
    return translate('filter' + trimmedID);
  } else {
    var translatedMsg = translate('filter_' + id);
    translatedMsg = translatedMsg.trim()
    if (translatedMsg != "" && translatedMsg.length > 0) {
       return translatedMsg
    } else {
       return translate('filter' + id)
    }
  }
}

$(function ()
{
  // Retrieves list of filter lists from the background.
  var subs = backgroundPage.getAllSubscriptionsMinusText();

  // Initialize page using subscriptions from the background.
  // Copy from update subscription list + setsubscriptionlist
  FilterListUtil.prepareSubscriptions(subs);

  for (var id in filterListSections)
  {
    var sectionHandler = new SectionHandler(filterListSections[id], id);
    sectionHandler.initSection();
  }

  LanguageSelectUtil.init();
  CustomFilterListUploadUtil.bindControls();

  FilterNotifier.addListener(onFilterChangeHandler);

  FilterListUtil.updateSubscriptionInfoAll();

  window.setInterval(function ()
  {
    FilterListUtil.updateSubscriptionInfoAll();
  }, 10000);

  $('#btnUpdateNow').click(function ()
  {
    $(this).prop('disabled', true);
    backgroundPage.updateFilterLists();
    setTimeout(function ()
    {
      $('#btnUpdateNow').prop('disabled', false);
    }, 300000); // Re-enable update button after 5 minutes.
  });

  $('#btnShowLinks').click(function ()
  {
    $('.linkToList').fadeIn('slow');
    $('#btnShowLinks').remove();
  });

  if (delayedSubscriptionSelection) {
    startSubscriptionSelection.apply(null, delayedSubscriptionSelection);
  }
});