Index: stats.js |
diff --git a/stats.js b/stats.js |
index 416f0bbafd0edaf86b6fdf4f71aefd7208c55d5a..2b5c7f3cbe020ce8ff1e101ac768766e71dd5000 100644 |
--- a/stats.js |
+++ b/stats.js |
@@ -15,19 +15,18 @@ |
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
*/ |
-(function() |
{ |
- var backgroundPage = ext.backgroundPage.getWindow(); |
- var require = backgroundPage.require; |
- var getBlockedPerPage = require("stats").getBlockedPerPage; |
- var FilterNotifier = require("filterNotifier").FilterNotifier; |
- var Prefs = require("prefs").Prefs; |
+ let backgroundPage = ext.backgroundPage.getWindow(); |
+ let require = backgroundPage.require; |
+ let getBlockedPerPage = require("stats").getBlockedPerPage; |
+ let FilterNotifier = require("filterNotifier").FilterNotifier; |
+ let Prefs = require("prefs").Prefs; |
- var currentPage; |
- var shareURL = "https://adblockplus.org/"; |
+ let currentPage; |
+ let shareURL = "https://adblockplus.org/"; |
- var messageMark = {}; |
- var shareLinks = { |
+ let messageMark = {}; |
+ let shareLinks = { |
facebook: ["https://www.facebook.com/dialog/feed", { |
app_id: "475542399197328", |
link: shareURL, |
@@ -53,13 +52,13 @@ |
function createShareLink(network, blockedCount) |
{ |
- var url = shareLinks[network][0]; |
- var params = shareLinks[network][1]; |
+ let url = shareLinks[network][0]; |
+ let params = shareLinks[network][1]; |
- var querystring = []; |
- for (var key in params) |
+ let querystring = []; |
+ for (let key in params) |
{ |
- var value = params[key]; |
+ let value = params[key]; |
if (value == messageMark) |
value = i18n.getMessage("stats_share_message", blockedCount); |
querystring.push(encodeURIComponent(key) + "=" + encodeURIComponent(value)); |
@@ -70,13 +69,13 @@ |
function onLoad() |
{ |
document.getElementById("share-box").addEventListener("click", share, false); |
- var showIconNumber = document.getElementById("show-iconnumber"); |
+ let showIconNumber = document.getElementById("show-iconnumber"); |
showIconNumber.setAttribute("aria-checked", Prefs.show_statsinicon); |
showIconNumber.addEventListener("click", toggleIconNumber, false); |
document.querySelector("label[for='show-iconnumber']").addEventListener("click", toggleIconNumber, false); |
// Update stats |
- ext.pages.query({active: true, lastFocusedWindow: true}, function(pages) |
+ ext.pages.query({active: true, lastFocusedWindow: true}, pages => |
{ |
currentPage = pages[0]; |
updateStats(); |
@@ -94,19 +93,19 @@ |
function updateStats() |
{ |
- var statsPage = document.getElementById("stats-page"); |
- var blockedPage = getBlockedPerPage(currentPage).toLocaleString(); |
+ let statsPage = document.getElementById("stats-page"); |
+ let blockedPage = getBlockedPerPage(currentPage).toLocaleString(); |
i18n.setElementText(statsPage, "stats_label_page", [blockedPage]); |
- var statsTotal = document.getElementById("stats-total"); |
- var blockedTotal = Prefs.blocked_total.toLocaleString(); |
+ let statsTotal = document.getElementById("stats-total"); |
+ let blockedTotal = Prefs.blocked_total.toLocaleString(); |
i18n.setElementText(statsTotal, "stats_label_total", [blockedTotal]); |
} |
function share(ev) |
{ |
// Easter Egg |
- var blocked = Prefs.blocked_total; |
+ let blocked = Prefs.blocked_total; |
if (blocked <= 9000 || blocked >= 10000) |
blocked = blocked.toLocaleString(); |
else |
@@ -123,4 +122,4 @@ |
document.addEventListener("DOMContentLoaded", onLoad, false); |
window.addEventListener("unload", onUnload, false); |
-})(); |
+} |