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

Side by Side Diff: lib/stats.js

Issue 29785558: Issue 6679 - Don't show block stats in icon if disabled (Closed)
Patch Set: Created May 18, 2018, 10:39 a.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 | « no previous file | no next file » | 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-present eyeo GmbH 3 * Copyright (C) 2006-present 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 28 matching lines...) Expand all
39 // Once nagivation for the tab has been committed to (e.g. it's no longer 39 // Once nagivation for the tab has been committed to (e.g. it's no longer
40 // being prerendered) we clear its badge, or if some requests were already 40 // being prerendered) we clear its badge, or if some requests were already
41 // blocked beforehand we display those on the badge now. 41 // blocked beforehand we display those on the badge now.
42 browser.webNavigation.onCommitted.addListener(details => 42 browser.webNavigation.onCommitted.addListener(details =>
43 { 43 {
44 if (details.frameId == 0) 44 if (details.frameId == 0)
45 { 45 {
46 let page = new ext.Page({id: details.tabId}); 46 let page = new ext.Page({id: details.tabId});
47 let blocked = blockedPerPage.get(page); 47 let blocked = blockedPerPage.get(page);
48 48
49 page.browserAction.setBadge(blocked && { 49 if (Prefs.show_statsinicon)
Thomas Greiner 2018/05/18 10:50:18 What about moving this entire if-statement into a
kzar 2018/05/18 12:25:30 Sure, I can do it that way if you like. Done.
50 color: badgeColor, 50 {
51 number: blocked 51 page.browserAction.setBadge(blocked && {
52 }); 52 color: badgeColor,
53 number: blocked
54 });
55 }
53 } 56 }
54 }); 57 });
55 58
56 FilterNotifier.on("filter.hitCount", (filter, newValue, oldValue, tabIds) => 59 FilterNotifier.on("filter.hitCount", (filter, newValue, oldValue, tabIds) =>
57 { 60 {
58 if (!(filter instanceof BlockingFilter)) 61 if (!(filter instanceof BlockingFilter))
59 return; 62 return;
60 63
61 for (let tabId of tabIds) 64 for (let tabId of tabIds)
62 { 65 {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 101 }
99 } 102 }
100 103
101 page.browserAction.setBadge(badge); 104 page.browserAction.setBadge(badge);
102 } 105 }
103 }); 106 });
104 }); 107 });
105 108
106 port.on("stats.getBlockedPerPage", 109 port.on("stats.getBlockedPerPage",
107 message => getBlockedPerPage(new ext.Page(message.tab))); 110 message => getBlockedPerPage(new ext.Page(message.tab)));
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld