Index: stats.js |
=================================================================== |
--- a/stats.js |
+++ b/stats.js |
@@ -21,6 +21,7 @@ |
var require = backgroundPage.require; |
var getStats = require("stats").getStats; |
var FilterNotifier = require("filterNotifier").FilterNotifier; |
+ var Prefs = require("prefs").Prefs; |
var currentTabId; |
var shareURL = "https://adblockplus.org/"; |
@@ -68,8 +69,12 @@ |
function onLoad() |
{ |
- document.getElementById("shareBox").addEventListener("click", share, false); |
+ document.getElementById("share-box").addEventListener("click", share, false); |
document.getElementById("share").addEventListener("click", toggleShareBox, false); |
+ var showIconNumber = document.getElementById("show-iconnumber"); |
+ showIconNumber.setAttribute("aria-checked", Prefs.show_iconnumber); |
+ showIconNumber.addEventListener("click", toggleIconNumber, false); |
+ document.querySelector("label[for='show-iconnumber']").addEventListener("click", toggleIconNumber, false); |
// Update stats |
chrome.tabs.query({ |
@@ -84,7 +89,7 @@ |
FilterNotifier.addListener(onNotify); |
- document.getElementById("statsContainer").removeAttribute("hidden"); |
+ document.getElementById("stats-container").removeAttribute("hidden"); |
} |
}); |
} |
@@ -102,18 +107,18 @@ |
function updateStats() |
{ |
- var statsPage = document.getElementById("statsPage"); |
+ var statsPage = document.getElementById("stats-page"); |
var blockedPage = getStats("blocked", currentTabId).toLocaleString(); |
i18n.setElementText(statsPage, "stats_label_page", [blockedPage]); |
- var statsTotal = document.getElementById("statsTotal"); |
+ var statsTotal = document.getElementById("stats-total"); |
var blockedTotal = getStats("blocked").toLocaleString(); |
i18n.setElementText(statsTotal, "stats_label_total", [blockedTotal]); |
} |
function toggleShareBox(ev) |
{ |
- var shareBox = document.getElementById("shareBox"); |
+ var shareBox = document.getElementById("share-box"); |
shareBox.hidden = !shareBox.hidden; |
} |
@@ -130,6 +135,12 @@ |
chrome.tabs.create({url: url}); |
} |
+ function toggleIconNumber() |
+ { |
+ Prefs.show_iconnumber = !Prefs.show_iconnumber; |
+ document.getElementById("show-iconnumber").setAttribute("aria-checked", Prefs.show_iconnumber); |
+ } |
+ |
document.addEventListener("DOMContentLoaded", onLoad, false); |
window.addEventListener("unload", onUnload, false); |
})(); |