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-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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 | 508 |
509 this.inline = response.inline; | 509 this.inline = response.inline; |
510 this.inlineEmulated = !!response.inlineEmulated; | 510 this.inlineEmulated = !!response.inlineEmulated; |
511 | 511 |
512 if (this.inline) | 512 if (this.inline) |
513 this.addSelectorsInline(response.selectors, "standard"); | 513 this.addSelectorsInline(response.selectors, "standard"); |
514 | 514 |
515 if (this.tracer) | 515 if (this.tracer) |
516 this.tracer.addSelectors(response.selectors); | 516 this.tracer.addSelectors(response.selectors); |
517 | 517 |
| 518 // Prefer CSS selectors for -abp-has and -abp-contains unless the |
| 519 // background page has asked us to use inline styles. |
| 520 this.elemHideEmulation.useInlineStyles = this.inline || |
| 521 this.inlineEmulated; |
| 522 |
518 this.elemHideEmulation.apply(response.emulatedPatterns); | 523 this.elemHideEmulation.apply(response.emulatedPatterns); |
519 }); | 524 }); |
520 } | 525 } |
521 }; | 526 }; |
522 | 527 |
523 if (document instanceof HTMLDocument) | 528 if (document instanceof HTMLDocument) |
524 { | 529 { |
525 checkSitekey(); | 530 checkSitekey(); |
526 | 531 |
527 elemhide = new ElemHide(); | 532 elemhide = new ElemHide(); |
528 elemhide.apply(); | 533 elemhide.apply(); |
529 | 534 |
530 document.addEventListener("error", event => | 535 document.addEventListener("error", event => |
531 { | 536 { |
532 checkCollapse(event.target); | 537 checkCollapse(event.target); |
533 }, true); | 538 }, true); |
534 | 539 |
535 document.addEventListener("load", event => | 540 document.addEventListener("load", event => |
536 { | 541 { |
537 let element = event.target; | 542 let element = event.target; |
538 if (/^i?frame$/.test(element.localName)) | 543 if (/^i?frame$/.test(element.localName)) |
539 checkCollapse(element); | 544 checkCollapse(element); |
540 }, true); | 545 }, true); |
541 } | 546 } |
542 | 547 |
543 window.checkCollapse = checkCollapse; | 548 window.checkCollapse = checkCollapse; |
544 window.elemhide = elemhide; | 549 window.elemhide = elemhide; |
545 window.typeMap = typeMap; | 550 window.typeMap = typeMap; |
546 window.getURLsFromElement = getURLsFromElement; | 551 window.getURLsFromElement = getURLsFromElement; |
OLD | NEW |