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-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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 onclick: function(page) | 120 onclick: function(page) |
121 { | 121 { |
122 page.sendMessage({type: "clickhide-new-filter"}); | 122 page.sendMessage({type: "clickhide-new-filter"}); |
123 } | 123 } |
124 }; | 124 }; |
125 | 125 |
126 // Adds or removes browser action icon according to options. | 126 // Adds or removes browser action icon according to options. |
127 function refreshIconAndContextMenu(page) | 127 function refreshIconAndContextMenu(page) |
128 { | 128 { |
129 var whitelisted = isPageWhitelisted(page); | 129 var whitelisted = isPageWhitelisted(page); |
130 updateIcon(page, whitelisted); | 130 updateIcon(page, whitelisted && true || false); |
Sebastian Noack
2016/01/21 18:11:01
Why mind casting to bool here?
kzar
2016/01/21 21:07:30
Because the documentation for updateIcon says it e
Sebastian Noack
2016/01/22 15:59:15
Well, documented type annotations or not, JavaScri
kzar
2016/01/22 16:49:34
Ok, I'll just remove this change.
| |
131 | 131 |
132 // show or hide the context menu entry dependent on whether | 132 // show or hide the context menu entry dependent on whether |
133 // adblocking is active on that page | 133 // adblocking is active on that page |
134 page.contextMenus.removeAll(); | 134 page.contextMenus.removeAll(); |
135 if (Prefs.shouldShowBlockElementMenu && !whitelisted && htmlPages.has(page)) | 135 if (Prefs.shouldShowBlockElementMenu && !whitelisted && htmlPages.has(page)) |
136 page.contextMenus.create(contextMenuItem); | 136 page.contextMenus.create(contextMenuItem); |
137 } | 137 } |
138 | 138 |
139 function refreshIconAndContextMenuForAllPages() | 139 function refreshIconAndContextMenuForAllPages() |
140 { | 140 { |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
408 } | 408 } |
409 }); | 409 }); |
410 | 410 |
411 // update icon when page changes location | 411 // update icon when page changes location |
412 ext.pages.onLoading.addListener(function(page) | 412 ext.pages.onLoading.addListener(function(page) |
413 { | 413 { |
414 page.sendMessage({type: "clickhide-deactivate"}); | 414 page.sendMessage({type: "clickhide-deactivate"}); |
415 refreshIconAndContextMenu(page); | 415 refreshIconAndContextMenu(page); |
416 showNextNotificationForUrl(page.url); | 416 showNextNotificationForUrl(page.url); |
417 }); | 417 }); |
OLD | NEW |