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

Unified Diff: stats.js

Issue 29569649: Issue 4580 - Replace ext.i18n with i18n (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Update adblockplusui dependency Created Oct. 10, 2017, 1 p.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 | « lib/utils.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: stats.js
===================================================================
--- a/stats.js
+++ b/stats.js
@@ -10,17 +10,17 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
-/* global i18n, getPref, togglePref */
+/* global getPref, togglePref */
"use strict";
(function()
{
let currentTab;
const shareURL = "https://adblockplus.org/";
@@ -29,17 +29,17 @@
facebook: ["https://www.facebook.com/dialog/feed", {
app_id: "475542399197328",
link: shareURL,
redirect_uri: "https://www.facebook.com/",
ref: "adcounter",
name: messageMark,
actions: JSON.stringify([
{
- name: i18n.getMessage("stats_share_download"),
+ name: chrome.i18n.getMessage("stats_share_download"),
link: shareURL
}
])
}],
gplus: ["https://plus.google.com/share", {
url: shareURL
}],
twitter: ["https://twitter.com/intent/tweet", {
@@ -54,17 +54,17 @@
let url = shareLinks[network][0];
let params = shareLinks[network][1];
let querystring = [];
for (let key in params)
{
let value = params[key];
if (value == messageMark)
- value = i18n.getMessage("stats_share_message", blockedCount);
+ value = chrome.i18n.getMessage("stats_share_message", blockedCount);
querystring.push(
encodeURIComponent(key) + "=" + encodeURIComponent(value)
);
}
return url + "?" + querystring.join("&");
}
function onLoad()
@@ -95,37 +95,42 @@
{
let statsPage = document.getElementById("stats-page");
chrome.runtime.sendMessage({
type: "stats.getBlockedPerPage",
tab: currentTab
},
blockedPage =>
{
- i18n.setElementText(statsPage, "stats_label_page",
- [blockedPage.toLocaleString()]);
+ ext.i18n.setElementText(statsPage, "stats_label_page",
+ [blockedPage.toLocaleString()]);
});
let statsTotal = document.getElementById("stats-total");
getPref("blocked_total", blockedTotal =>
{
- i18n.setElementText(statsTotal, "stats_label_total",
- [blockedTotal.toLocaleString()]);
+ ext.i18n.setElementText(statsTotal, "stats_label_total",
+ [blockedTotal.toLocaleString()]);
});
}
function share(ev)
{
getPref("blocked_total", blockedTotal =>
{
// Easter Egg
if (blockedTotal <= 9000 || blockedTotal >= 10000)
+ {
blockedTotal = blockedTotal.toLocaleString();
+ }
else
- blockedTotal = i18n.getMessage("stats_over", (9000).toLocaleString());
+ {
+ blockedTotal = chrome.i18n.getMessage("stats_over",
+ (9000).toLocaleString());
+ }
chrome.tabs.create({
url: createShareLink(ev.target.dataset.social, blockedTotal)
});
});
}
function toggleIconNumber()
« no previous file with comments | « lib/utils.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld