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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 a.href = url; | 103 a.href = url; |
104 return a.href; | 104 return a.href; |
105 } | 105 } |
106 | 106 |
107 function init(document) | 107 function init(document) |
108 { | 108 { |
109 // prior to Chrome 37, content scripts don't run on about:blank | 109 // prior to Chrome 37, content scripts don't run on about:blank |
110 // and about:srcdoc. So we have to apply element hiding and collapsing | 110 // and about:srcdoc. So we have to apply element hiding and collapsing |
111 // from the parent frame, when inline frames are loaded. | 111 // from the parent frame, when inline frames are loaded. |
112 var match = navigator.userAgent.match(/\bChrome\/(\d+)/); | 112 var match = navigator.userAgent.match(/\bChrome\/(\d+)/); |
113 var fixInlineFrames = match && parseInt(match[1]) < 37; | 113 var fixInlineFrames = match && parseInt(match[1], 10) < 37; |
114 | 114 |
115 // use Shadow DOM if available to don't mess with web pages that | 115 // use Shadow DOM if available to don't mess with web pages that |
116 // rely on the order of their own <style> tags (#309). However we | 116 // rely on the order of their own <style> tags (#309). However we |
117 // must not create the shadow root in the response callback passed | 117 // must not create the shadow root in the response callback passed |
118 // to sendMessage(), otherwise Chrome breaks some websites (#450). | 118 // to sendMessage(), otherwise Chrome breaks some websites (#450). |
119 var shadow = null; | 119 var shadow = null; |
120 if ("createShadowRoot" in document.documentElement) | 120 if ("createShadowRoot" in document.documentElement) |
121 { | 121 { |
122 shadow = document.documentElement.createShadowRoot(); | 122 shadow = document.documentElement.createShadowRoot(); |
123 shadow.appendChild(document.createElement("shadow")); | 123 shadow.appendChild(document.createElement("shadow")); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 }, true); | 191 }, true); |
192 | 192 |
193 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules); | 193 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules); |
194 } | 194 } |
195 | 195 |
196 if (document instanceof HTMLDocument) | 196 if (document instanceof HTMLDocument) |
197 { | 197 { |
198 checkSitekey(); | 198 checkSitekey(); |
199 init(document); | 199 init(document); |
200 } | 200 } |
OLD | NEW |