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

Side by Side Diff: lib/stats.js

Issue 29338534: Issue 3826 - Filter preference change events (Closed)
Patch Set: Fixed typo in comment Created March 18, 2016, 6:15 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/prefs.js ('k') | lib/uninstall.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // Update number in icon 51 // Update number in icon
52 if (Prefs.show_statsinicon) 52 if (Prefs.show_statsinicon)
53 { 53 {
54 page.browserAction.setBadge({ 54 page.browserAction.setBadge({
55 color: badgeColor, 55 color: badgeColor,
56 number: blocked 56 number: blocked
57 }); 57 });
58 } 58 }
59 }); 59 });
60 60
61 Prefs.onChanged.addListener(function(name) 61 Prefs.on("show_statsinicon", function()
62 { 62 {
63 if (name != "show_statsinicon")
64 return;
65
66 ext.pages.query({}, function(pages) 63 ext.pages.query({}, function(pages)
67 { 64 {
68 for (var i = 0; i < pages.length; i++) 65 for (var i = 0; i < pages.length; i++)
69 { 66 {
70 let page = pages[i]; 67 let page = pages[i];
71 let badge = null; 68 let badge = null;
72 69
73 if (Prefs.show_statsinicon) 70 if (Prefs.show_statsinicon)
74 { 71 {
75 let blocked = blockedPerPage.get(page); 72 let blocked = blockedPerPage.get(page);
76 if (blocked) 73 if (blocked)
77 { 74 {
78 badge = { 75 badge = {
79 color: badgeColor, 76 color: badgeColor,
80 number: blocked 77 number: blocked
81 }; 78 };
82 } 79 }
83 } 80 }
84 81
85 page.browserAction.setBadge(badge); 82 page.browserAction.setBadge(badge);
86 } 83 }
87 }); 84 });
88 }); 85 });
OLDNEW
« no previous file with comments | « lib/prefs.js ('k') | lib/uninstall.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld