Left: | ||
Right: |
OLD | NEW |
---|---|
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 16 matching lines...) Expand all Loading... | |
27 let blockedPerPage = new ext.PageMap(); | 27 let blockedPerPage = new ext.PageMap(); |
28 | 28 |
29 /** | 29 /** |
30 * Gets the number of requests blocked on the given page. | 30 * Gets the number of requests blocked on the given page. |
31 * | 31 * |
32 * @param {Page} page | 32 * @param {Page} page |
33 * @return {Number} | 33 * @return {Number} |
34 */ | 34 */ |
35 exports.getBlockedPerPage = page => blockedPerPage.get(page) || 0; | 35 exports.getBlockedPerPage = page => blockedPerPage.get(page) || 0; |
36 | 36 |
37 // Chrome automatically clears the browser action badge text when the URL of | |
38 // the tab is updated, but Firefox doesn't. | |
Sebastian Noack
2017/08/29 23:07:01
Please refer to the Firefox bug here. If there isn
Wladimir Palant
2017/08/30 08:13:30
I filed a bug: https://bugzilla.mozilla.org/show_b
Manish Jethani
2017/08/30 10:30:35
Done.
| |
39 ext.pages.onLoading.addListener(page => | |
40 { | |
41 page.browserAction.setBadge(); | |
42 }); | |
43 | |
37 FilterNotifier.on("filter.hitCount", (filter, newValue, oldValue, page) => | 44 FilterNotifier.on("filter.hitCount", (filter, newValue, oldValue, page) => |
38 { | 45 { |
39 if (!(filter instanceof BlockingFilter) || !page) | 46 if (!(filter instanceof BlockingFilter) || !page) |
40 return; | 47 return; |
41 | 48 |
42 Prefs.blocked_total++; | 49 Prefs.blocked_total++; |
43 | 50 |
44 let blocked = blockedPerPage.get(page) || 0; | 51 let blocked = blockedPerPage.get(page) || 0; |
45 blockedPerPage.set(page, ++blocked); | 52 blockedPerPage.set(page, ++blocked); |
46 | 53 |
(...skipping 24 matching lines...) Expand all Loading... | |
71 color: badgeColor, | 78 color: badgeColor, |
72 number: blocked | 79 number: blocked |
73 }; | 80 }; |
74 } | 81 } |
75 } | 82 } |
76 | 83 |
77 page.browserAction.setBadge(badge); | 84 page.browserAction.setBadge(badge); |
78 } | 85 } |
79 }); | 86 }); |
80 }); | 87 }); |
OLD | NEW |