| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 359 { | 359 { |
| 360 // Use Shadow DOM if available as to not mess with with web pages that | 360 // Use Shadow DOM if available as to not mess with with web pages that |
| 361 // rely on the order of their own <style> tags (#309). However, creating | 361 // rely on the order of their own <style> tags (#309). However, creating |
| 362 // a shadow root breaks running CSS transitions. So we have to create | 362 // a shadow root breaks running CSS transitions. So we have to create |
| 363 // the shadow root before transistions might start (#452). | 363 // the shadow root before transistions might start (#452). |
| 364 if (!("createShadowRoot" in document.documentElement)) | 364 if (!("createShadowRoot" in document.documentElement)) |
| 365 return null; | 365 return null; |
| 366 | 366 |
| 367 // Both Firefox and Chrome 66+ support user style sheets, so we can avoid | 367 // Both Firefox and Chrome 66+ support user style sheets, so we can avoid |
| 368 // creating an unnecessary shadow root on these platforms. | 368 // creating an unnecessary shadow root on these platforms. |
| 369 let [, version] = /\bChrome\/(\d+)\.\d+/.exec(navigator.userAgent) || []; | 369 let match = /\bChrome\/(\d+)/.exec(navigator.userAgent); |
| 370 if (isNaN(version) || version >= 66) | 370 if (!match || match[1] >= 66) |
| 371 return null; | 371 return null; |
|
Sebastian Noack
2018/03/09 00:28:13
I think this can be somewhat simplified:
let ma
Manish Jethani
2018/03/09 00:33:29
Done.
| |
| 372 | 372 |
| 373 // Using shadow DOM causes issues on some Google websites, | 373 // Using shadow DOM causes issues on some Google websites, |
| 374 // including Google Docs, Gmail and Blogger (#1770, #2602, #2687). | 374 // including Google Docs, Gmail and Blogger (#1770, #2602, #2687). |
| 375 if (/\.(?:google|blogger)\.com$/.test(document.domain)) | 375 if (/\.(?:google|blogger)\.com$/.test(document.domain)) |
| 376 return null; | 376 return null; |
| 377 | 377 |
| 378 // Finally since some users have both AdBlock and Adblock Plus installed we | 378 // Finally since some users have both AdBlock and Adblock Plus installed we |
| 379 // have to consider how the two extensions interact. For example we want to | 379 // have to consider how the two extensions interact. For example we want to |
| 380 // avoid creating the shadowRoot twice. | 380 // avoid creating the shadowRoot twice. |
| 381 let shadow = document.documentElement.shadowRoot || | 381 let shadow = document.documentElement.shadowRoot || |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 547 let element = event.target; | 547 let element = event.target; |
| 548 if (/^i?frame$/.test(element.localName)) | 548 if (/^i?frame$/.test(element.localName)) |
| 549 checkCollapse(element); | 549 checkCollapse(element); |
| 550 }, true); | 550 }, true); |
| 551 } | 551 } |
| 552 | 552 |
| 553 window.checkCollapse = checkCollapse; | 553 window.checkCollapse = checkCollapse; |
| 554 window.elemhide = elemhide; | 554 window.elemhide = elemhide; |
| 555 window.typeMap = typeMap; | 555 window.typeMap = typeMap; |
| 556 window.getURLsFromElement = getURLsFromElement; | 556 window.getURLsFromElement = getURLsFromElement; |
| LEFT | RIGHT |