OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 29 matching lines...) Expand all Loading... |
40 { | 40 { |
41 type: "should-collapse", | 41 type: "should-collapse", |
42 url: url, | 42 url: url, |
43 mediatype: typeMap[tag] | 43 mediatype: typeMap[tag] |
44 }, | 44 }, |
45 | 45 |
46 function(response) | 46 function(response) |
47 { | 47 { |
48 if (response && element.parentNode) | 48 if (response && element.parentNode) |
49 { | 49 { |
| 50 var property = "display"; |
| 51 var value = "none"; |
| 52 |
50 // <frame> cannot be removed, doing that will mess up the frameset | 53 // <frame> cannot be removed, doing that will mess up the frameset |
51 if (tag == "frame") | 54 if (tag == "frame") |
52 element.style.setProperty("visibility", "hidden", "important"); | 55 { |
53 else | 56 property = "visibility"; |
54 element.style.setProperty("display", "none", "important"); | 57 value = "hidden"; |
| 58 } |
| 59 |
| 60 // <input type="image"> elements try to load their image again |
| 61 // when the "display" CSS property is set. So we have to check |
| 62 // that it isn't already collapsed to avoid an infinite recursion. |
| 63 if (element.style.getPropertyValue(property) != value || |
| 64 element.style.getPropertyPriority(property) != "important") |
| 65 element.style.setProperty(property, value, "important"); |
55 } | 66 } |
56 } | 67 } |
57 ); | 68 ); |
58 } | 69 } |
59 } | 70 } |
60 | 71 |
61 function checkSitekey() | 72 function checkSitekey() |
62 { | 73 { |
63 var attr = document.documentElement.getAttribute("data-adblockkey"); | 74 var attr = document.documentElement.getAttribute("data-adblockkey"); |
64 if (attr) | 75 if (attr) |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 }, true); | 210 }, true); |
200 | 211 |
201 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules); | 212 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules); |
202 } | 213 } |
203 | 214 |
204 if (document instanceof HTMLDocument) | 215 if (document instanceof HTMLDocument) |
205 { | 216 { |
206 checkSitekey(); | 217 checkSitekey(); |
207 init(document); | 218 init(document); |
208 } | 219 } |
OLD | NEW |