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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver; | |
19 | |
20 var typeMap = { | 18 var typeMap = { |
21 "img": "IMAGE", | 19 "img": "IMAGE", |
22 "input": "IMAGE", | 20 "input": "IMAGE", |
23 "picture": "IMAGE", | 21 "picture": "IMAGE", |
24 "audio": "MEDIA", | 22 "audio": "MEDIA", |
25 "video": "MEDIA", | 23 "video": "MEDIA", |
26 "frame": "SUBDOCUMENT", | 24 "frame": "SUBDOCUMENT", |
27 "iframe": "SUBDOCUMENT", | 25 "iframe": "SUBDOCUMENT", |
28 "object": "OBJECT", | 26 "object": "OBJECT", |
29 "embed": "OBJECT" | 27 "embed": "OBJECT" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 155 |
158 if (element.style.getPropertyValue(propertyName) != propertyValue || | 156 if (element.style.getPropertyValue(propertyName) != propertyValue || |
159 element.style.getPropertyPriority(propertyName) != "important") | 157 element.style.getPropertyPriority(propertyName) != "important") |
160 element.style.setProperty(propertyName, propertyValue, "important"); | 158 element.style.setProperty(propertyName, propertyValue, "important"); |
161 } | 159 } |
162 | 160 |
163 if (collapse) | 161 if (collapse) |
164 { | 162 { |
165 collapseElement(); | 163 collapseElement(); |
166 | 164 |
167 if (MutationObserver) | 165 new MutationObserver(collapseElement).observe( |
168 new MutationObserver(collapseElement).observe( | 166 element, { |
169 element, { | 167 attributes: true, |
170 attributes: true, | 168 attributeFilter: ["style"] |
171 attributeFilter: ["style"] | 169 } |
172 } | 170 ); |
173 ); | |
174 } | 171 } |
175 } | 172 } |
176 ); | 173 ); |
177 } | 174 } |
178 | 175 |
179 function checkSitekey() | 176 function checkSitekey() |
180 { | 177 { |
181 var attr = document.documentElement.getAttribute("data-adblockkey"); | 178 var attr = document.documentElement.getAttribute("data-adblockkey"); |
182 if (attr) | 179 if (attr) |
183 ext.backgroundPage.sendMessage({type: "filters.addKey", token: attr}); | 180 ext.backgroundPage.sendMessage({type: "filters.addKey", token: attr}); |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 checkCollapse(event.target); | 593 checkCollapse(event.target); |
597 }, true); | 594 }, true); |
598 | 595 |
599 document.addEventListener("load", function(event) | 596 document.addEventListener("load", function(event) |
600 { | 597 { |
601 var element = event.target; | 598 var element = event.target; |
602 if (/^i?frame$/.test(element.localName)) | 599 if (/^i?frame$/.test(element.localName)) |
603 checkCollapse(element); | 600 checkCollapse(element); |
604 }, true); | 601 }, true); |
605 } | 602 } |
OLD | NEW |