LEFT | RIGHT |
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 23 matching lines...) Expand all Loading... |
34 * @param {Page} page | 34 * @param {Page} page |
35 * @return {Number} | 35 * @return {Number} |
36 */ | 36 */ |
37 exports.getBlockedPerPage = page => blockedPerPage.get(page) || 0; | 37 exports.getBlockedPerPage = page => blockedPerPage.get(page) || 0; |
38 | 38 |
39 // Chrome automatically clears the browser action badge text when the URL of | 39 // Chrome automatically clears the browser action badge text when the URL of |
40 // the tab is updated, but Firefox doesn't. | 40 // the tab is updated, but Firefox doesn't. |
41 // https://bugzilla.mozilla.org/show_bug.cgi?id=1395074 | 41 // https://bugzilla.mozilla.org/show_bug.cgi?id=1395074 |
42 ext.pages.onLoading.addListener(page => | 42 ext.pages.onLoading.addListener(page => |
43 { | 43 { |
44 page.browserAction.setBadge(); | 44 if (!blockedPerPage.get(page)) |
| 45 page.browserAction.setBadge(); |
45 }); | 46 }); |
46 | 47 |
47 FilterNotifier.on("filter.hitCount", (filter, newValue, oldValue, page) => | 48 FilterNotifier.on("filter.hitCount", (filter, newValue, oldValue, page) => |
48 { | 49 { |
49 if (!(filter instanceof BlockingFilter) || !page) | 50 if (!(filter instanceof BlockingFilter) || !page) |
50 return; | 51 return; |
51 | 52 |
52 Prefs.blocked_total++; | 53 Prefs.blocked_total++; |
53 | 54 |
54 let blocked = blockedPerPage.get(page) || 0; | 55 let blocked = blockedPerPage.get(page) || 0; |
(...skipping 29 matching lines...) Expand all Loading... |
84 } | 85 } |
85 } | 86 } |
86 | 87 |
87 page.browserAction.setBadge(badge); | 88 page.browserAction.setBadge(badge); |
88 } | 89 } |
89 }); | 90 }); |
90 }); | 91 }); |
91 | 92 |
92 port.on("stats.getBlockedPerPage", | 93 port.on("stats.getBlockedPerPage", |
93 message => getBlockedPerPage(new ext.Page(message.tab))); | 94 message => getBlockedPerPage(new ext.Page(message.tab))); |
LEFT | RIGHT |