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

Unified Diff: stats.js

Issue 29317001: Relocated icon and redesigned icon popup (Closed)
Patch Set: Rebased Created Nov. 19, 2013, 1:43 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
« safari/background.js ('K') | « skin/popup.png ('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
@@ -21,6 +21,7 @@
var require = backgroundPage.require;
var getStats = require("stats").getStats;
var FilterNotifier = require("filterNotifier").FilterNotifier;
+ var Prefs = require("prefs").Prefs;
var currentTab;
var shareURL = "https://adblockplus.org/";
@@ -68,8 +69,11 @@
function onLoad()
{
- document.getElementById("shareBox").addEventListener("click", share, false);
- document.getElementById("share").addEventListener("click", toggleShareBox, false);
+ document.getElementById("share-box").addEventListener("click", share, 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
ext.windows.getLastFocused(function(win)
@@ -81,7 +85,7 @@
FilterNotifier.addListener(onNotify);
- document.getElementById("statsContainer").removeAttribute("hidden");
+ document.getElementById("stats-container").removeAttribute("hidden");
});
});
}
@@ -99,21 +103,15 @@
function updateStats()
{
- var statsPage = document.getElementById("statsPage");
+ var statsPage = document.getElementById("stats-page");
var blockedPage = getStats("blocked", currentTab).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");
- shareBox.hidden = !shareBox.hidden;
- }
-
function share(ev)
{
// Easter Egg
@@ -127,6 +125,12 @@
ext.windows.getLastFocused(function(win) { win.openTab(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);
})();
« safari/background.js ('K') | « skin/popup.png ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld