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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 for (let collapser of document.getElementsByClassName("collapse")) | 84 for (let collapser of document.getElementsByClassName("collapse")) |
85 { | 85 { |
86 collapser.addEventListener("click", toggleCollapse, false); | 86 collapser.addEventListener("click", toggleCollapse, false); |
87 if (!Prefs[collapser.dataset.option]) | 87 if (!Prefs[collapser.dataset.option]) |
88 { | 88 { |
89 document.getElementById( | 89 document.getElementById( |
90 collapser.dataset.collapsable | 90 collapser.dataset.collapsable |
91 ).classList.add("collapsed"); | 91 ).classList.add("collapsed"); |
92 } | 92 } |
93 } | 93 } |
| 94 |
| 95 document.removeEventListener("DOMContentLoaded", onLoad); |
94 } | 96 } |
95 | 97 |
96 function toggleEnabled() | 98 function toggleEnabled() |
97 { | 99 { |
98 let disabled = document.body.classList.toggle("disabled"); | 100 let disabled = document.body.classList.toggle("disabled"); |
99 if (disabled) | 101 if (disabled) |
100 { | 102 { |
101 let host = getDecodedHostname(page.url).replace(/^www\./, ""); | 103 let host = getDecodedHostname(page.url).replace(/^www\./, ""); |
102 let filter = Filter.fromText("@@||" + host + "^$document"); | 104 let filter = Filter.fromText("@@||" + host + "^$document"); |
103 if (filter.subscriptions.length && filter.disabled) | 105 if (filter.subscriptions.length && filter.disabled) |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 145 } |
144 | 146 |
145 function toggleCollapse(event) | 147 function toggleCollapse(event) |
146 { | 148 { |
147 let collapser = event.currentTarget; | 149 let collapser = event.currentTarget; |
148 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option]; | 150 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option]; |
149 collapser.parentNode.classList.toggle("collapsed"); | 151 collapser.parentNode.classList.toggle("collapsed"); |
150 } | 152 } |
151 | 153 |
152 document.addEventListener("DOMContentLoaded", onLoad, false); | 154 document.addEventListener("DOMContentLoaded", onLoad, false); |
OLD | NEW |