Left: | ||
Right: |
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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 function onUnload() | 80 function onUnload() |
81 { | 81 { |
82 ext.onMessage.removeListener(onMessage); | 82 ext.onMessage.removeListener(onMessage); |
83 } | 83 } |
84 | 84 |
85 function onMessage(message, sender, callback) | 85 function onMessage(message, sender, callback) |
86 { | 86 { |
87 if (message.type == "report-html-page" | 87 if (message.type == "report-html-page" && sender.page._id == page._id) |
88 && backgroundPage.htmlPages.has(page)) | |
Sebastian Noack
2016/01/09 00:01:50
This check is redundant. Or if you want to keep it
Thomas Greiner
2016/01/12 11:35:17
Unfortunately, it's not redundant. Any page could'
Sebastian Noack
2016/01/12 16:09:16
Acknowledged.
| |
89 document.body.classList.remove("nohtml"); | 88 document.body.classList.remove("nohtml"); |
90 } | 89 } |
91 | 90 |
92 function toggleEnabled() | 91 function toggleEnabled() |
93 { | 92 { |
94 var disabled = document.body.classList.toggle("disabled"); | 93 var disabled = document.body.classList.toggle("disabled"); |
95 if (disabled) | 94 if (disabled) |
96 { | 95 { |
97 var host = getDecodedHostname(page.url).replace(/^www\./, ""); | 96 var host = getDecodedHostname(page.url).replace(/^www\./, ""); |
98 var filter = Filter.fromText("@@||" + host + "^$document"); | 97 var filter = Filter.fromText("@@||" + host + "^$document"); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
140 | 139 |
141 function toggleCollapse(event) | 140 function toggleCollapse(event) |
142 { | 141 { |
143 var collapser = event.currentTarget; | 142 var collapser = event.currentTarget; |
144 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option]; | 143 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option]; |
145 collapser.parentNode.classList.toggle("collapsed"); | 144 collapser.parentNode.classList.toggle("collapsed"); |
146 } | 145 } |
147 | 146 |
148 document.addEventListener("DOMContentLoaded", onLoad, false); | 147 document.addEventListener("DOMContentLoaded", onLoad, false); |
149 window.addEventListener("unload", onUnload, false); | 148 window.addEventListener("unload", onUnload, false); |
LEFT | RIGHT |