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

Unified Diff: stats.js

Issue 29570614: Issue 5028 - Use browser namespace (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Fix indentation Created Oct. 9, 2017, 3:50 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 | « qunit/tests/prefs.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
@@ -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: chrome.i18n.getMessage("stats_share_download"),
+ name: browser.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 = chrome.i18n.getMessage("stats_share_message", blockedCount);
+ value = browser.i18n.getMessage("stats_share_message", blockedCount);
querystring.push(
encodeURIComponent(key) + "=" + encodeURIComponent(value)
);
}
return url + "?" + querystring.join("&");
}
function onLoad()
@@ -77,29 +77,29 @@
showIconNumber.setAttribute("aria-checked", showStatsInIcon);
});
showIconNumber.addEventListener("click", toggleIconNumber, false);
document.querySelector("label[for='show-iconnumber']").addEventListener(
"click", toggleIconNumber, false
);
// Update stats
- chrome.tabs.query({active: true, lastFocusedWindow: true}, tabs =>
+ browser.tabs.query({active: true, lastFocusedWindow: true}, tabs =>
{
currentTab = tabs[0];
updateStats();
document.getElementById("stats-container").removeAttribute("hidden");
});
}
function updateStats()
{
let statsPage = document.getElementById("stats-page");
- chrome.runtime.sendMessage({
+ browser.runtime.sendMessage({
type: "stats.getBlockedPerPage",
tab: currentTab
},
blockedPage =>
{
ext.i18n.setElementText(statsPage, "stats_label_page",
[blockedPage.toLocaleString()]);
});
@@ -118,21 +118,21 @@
{
// Easter Egg
if (blockedTotal <= 9000 || blockedTotal >= 10000)
{
blockedTotal = blockedTotal.toLocaleString();
}
else
{
- blockedTotal = chrome.i18n.getMessage("stats_over",
- (9000).toLocaleString());
+ blockedTotal = browser.i18n.getMessage("stats_over",
+ (9000).toLocaleString());
}
- chrome.tabs.create({
+ browser.tabs.create({
url: createShareLink(ev.target.dataset.social, blockedTotal)
});
});
}
function toggleIconNumber()
{
togglePref("show_statsinicon", showStatsInIcon =>
« no previous file with comments | « qunit/tests/prefs.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld