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-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 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" && sender.page._id == page._id) | 87 if (message.type == "report-html-page" && sender.page.id == page.id) |
88 document.body.classList.remove("nohtml"); | 88 document.body.classList.remove("nohtml"); |
89 } | 89 } |
90 | 90 |
91 function toggleEnabled() | 91 function toggleEnabled() |
92 { | 92 { |
93 var disabled = document.body.classList.toggle("disabled"); | 93 var disabled = document.body.classList.toggle("disabled"); |
94 if (disabled) | 94 if (disabled) |
95 { | 95 { |
96 var host = getDecodedHostname(page.url).replace(/^www\./, ""); | 96 var host = getDecodedHostname(page.url).replace(/^www\./, ""); |
97 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... |
139 | 139 |
140 function toggleCollapse(event) | 140 function toggleCollapse(event) |
141 { | 141 { |
142 var collapser = event.currentTarget; | 142 var collapser = event.currentTarget; |
143 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option]; | 143 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option]; |
144 collapser.parentNode.classList.toggle("collapsed"); | 144 collapser.parentNode.classList.toggle("collapsed"); |
145 } | 145 } |
146 | 146 |
147 document.addEventListener("DOMContentLoaded", onLoad, false); | 147 document.addEventListener("DOMContentLoaded", onLoad, false); |
148 window.addEventListener("unload", onUnload, false); | 148 window.addEventListener("unload", onUnload, false); |
LEFT | RIGHT |