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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 }, | 86 }, |
87 | 87 |
88 function(response) | 88 function(response) |
89 { | 89 { |
90 if (response && target.parentNode) | 90 if (response && target.parentNode) |
91 { | 91 { |
92 // <frame> cannot be removed, doing that will mess up the frameset | 92 // <frame> cannot be removed, doing that will mess up the frameset |
93 if (tag == "frame") | 93 if (tag == "frame") |
94 target.style.setProperty("visibility", "hidden", "!important"); | 94 target.style.setProperty("visibility", "hidden", "!important"); |
95 else | 95 else |
96 target.parentNode.removeChild(target); | 96 target.style.setProperty("display", "none", "!important"); |
97 } | 97 } |
98 } | 98 } |
99 ); | 99 ); |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 function init() | 103 function init() |
104 { | 104 { |
105 // Make sure this is really an HTML page, as Chrome runs these scripts on just
about everything | 105 // Make sure this is really an HTML page, as Chrome runs these scripts on just
about everything |
106 if (!(document.documentElement instanceof HTMLElement)) | 106 if (!(document.documentElement instanceof HTMLElement)) |
107 return; | 107 return; |
108 | 108 |
109 document.addEventListener("error", checkCollapse, true); | 109 document.addEventListener("error", checkCollapse, true); |
110 document.addEventListener("load", checkCollapse, true); | 110 document.addEventListener("load", checkCollapse, true); |
111 | 111 |
112 var attr = document.documentElement.getAttribute("data-adblockkey"); | 112 var attr = document.documentElement.getAttribute("data-adblockkey"); |
113 if (attr) | 113 if (attr) |
114 ext.backgroundPage.sendMessage({type: "add-key-exception", token: attr}); | 114 ext.backgroundPage.sendMessage({type: "add-key-exception", token: attr}); |
115 | 115 |
116 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules); | 116 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules); |
117 } | 117 } |
118 | 118 |
119 // In Chrome 18 the document might not be initialized yet | 119 // In Chrome 18 the document might not be initialized yet |
120 if (document.documentElement) | 120 if (document.documentElement) |
121 init(); | 121 init(); |
122 else | 122 else |
123 window.setTimeout(init, 0); | 123 window.setTimeout(init, 0); |
OLD | NEW |