Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: options.js

Issue 8621090: Replaced chrome.i18n by a platform-independent i18n object in UI (Closed)
Patch Set: Created Oct. 22, 2012, 8:46 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « i18n.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: options.js
===================================================================
--- a/options.js
+++ b/options.js
@@ -4,17 +4,17 @@ var imports = ["FilterStorage", "FilterN
"Synchronizer", "Prefs", "Utils", "require"];
for (var i = 0; i < imports.length; i++)
window[imports[i]] = backgroundPage[imports[i]];
// Loads options from localStorage and sets UI elements accordingly
function loadOptions()
{
// Set page title to i18n version of "Adblock Plus Options"
- document.title = chrome.i18n.getMessage("options");
+ document.title = i18n.getMessage("options");
// Set links
$("#acceptableAdsLink").attr("href", Prefs.subscriptions_exceptionsurl);
$("#acceptableAdsDocs").attr("href", Prefs.documentation_link.replace(/%LINK%/g, "acceptable_ads").replace(/%LANG%/g, Utils.appLocale));
// Add event listeners
window.addEventListener("unload", unloadOptions, false);
$("#updateFilterLists").click(updateFilterLists);
@@ -172,17 +172,17 @@ function loadRecommendations()
selectedPrefix = prefix;
}
}
}
list.appendChild(option);
}
var option = document.createElement("option");
- option.text = chrome.i18n.getMessage("filters_addSubscriptionOther_label") + "\u2026";
+ option.text = i18n.getMessage("filters_addSubscriptionOther_label") + "\u2026";
option._data = null;
list.appendChild(option);
list.selectedIndex = selectedIndex;
if (delayedSubscriptionSelection)
startSubscriptionSelection.apply(null, delayedSubscriptionSelection);
};
@@ -231,17 +231,17 @@ function addSubscription()
var data = list.options[list.selectedIndex]._data;
if (data)
doAddSubscription(data.url, data.title, data.homepage);
else
{
var url = document.getElementById("customSubscriptionLocation").value.replace(/^\s+/, "").replace(/\s+$/, "");
if (!/^https?:/i.test(url))
{
- alert(chrome.i18n.getMessage("global_subscription_invalid_location"));
+ alert(i18n.getMessage("global_subscription_invalid_location"));
$("#customSubscriptionLocation").focus();
return;
}
var title = document.getElementById("customSubscriptionTitle").value.replace(/^\s+/, "").replace(/\s+$/, "");
if (!title)
title = url;
@@ -311,37 +311,37 @@ function updateSubscriptionInfo(element)
title.href = subscription.url;
var enabled = element.getElementsByClassName("subscriptionEnabled")[0];
enabled.checked = !subscription.disabled;
var lastUpdate = element.getElementsByClassName("subscriptionUpdate")[0];
lastUpdate.classList.remove("error");
if (Synchronizer.isExecuting(subscription.url))
- lastUpdate.textContent = chrome.i18n.getMessage("filters_subscription_lastDownload_inProgress");
+ lastUpdate.textContent = i18n.getMessage("filters_subscription_lastDownload_inProgress");
else if (subscription.downloadStatus && subscription.downloadStatus != "synchronize_ok")
{
var map =
{
"synchronize_invalid_url": "filters_subscription_lastDownload_invalidURL",
"synchronize_connection_error": "filters_subscription_lastDownload_connectionError",
"synchronize_invalid_data": "filters_subscription_lastDownload_invalidData",
"synchronize_checksum_mismatch": "filters_subscription_lastDownload_checksumMismatch"
};
if (subscription.downloadStatus in map)
- lastUpdate.textContent = chrome.i18n.getMessage(map[subscription.downloadStatus]);
+ lastUpdate.textContent = i18n.getMessage(map[subscription.downloadStatus]);
else
lastUpdate.textContent = subscription.downloadStatus;
lastUpdate.classList.add("error");
}
else if (subscription.lastDownload > 0)
{
var timeDate = i18n_timeDateStrings(subscription.lastDownload * 1000);
var messageID = (timeDate[1] ? "last_updated_at" : "last_updated_at_today");
- lastUpdate.textContent = chrome.i18n.getMessage(messageID, timeDate);
+ lastUpdate.textContent = i18n.getMessage(messageID, timeDate);
}
}
function onFilterChange(action, item, param1, param2)
{
switch (action)
{
case "load":
@@ -560,17 +560,17 @@ function addSubscriptionEntry(subscripti
element.removeAttribute("id");
element._subscription = subscription;
var removeButton = element.getElementsByClassName("subscriptionRemoveButton")[0];
removeButton.setAttribute("title", removeButton.textContent);
removeButton.textContent = "\xD7";
removeButton.addEventListener("click", function()
{
- if (!confirm(chrome.i18n.getMessage("global_remove_subscription_warning")))
+ if (!confirm(i18n.getMessage("global_remove_subscription_warning")))
return;
FilterStorage.removeSubscription(subscription);
}, false);
var enabled = element.getElementsByClassName("subscriptionEnabled")[0];
enabled.addEventListener("click", function()
{
« no previous file with comments | « i18n.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld