| 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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 let selector = preparedSelectors.slice( | 434 let selector = preparedSelectors.slice( |
| 435 i, i + this.selectorGroupSize | 435 i, i + this.selectorGroupSize |
| 436 ).join(", "); | 436 ).join(", "); |
| 437 this.style.sheet.insertRule(selector + "{display: none !important;}", | 437 this.style.sheet.insertRule(selector + "{display: none !important;}", |
| 438 this.style.sheet.cssRules.length); | 438 this.style.sheet.cssRules.length); |
| 439 } | 439 } |
| 440 }, | 440 }, |
| 441 | 441 |
| 442 addSelectors(selectors, filters) | 442 addSelectors(selectors, filters) |
| 443 { | 443 { |
| 444 if (!selectors || selectors.length == 0) | 444 if (selectors.length == 0) |
| 445 return; | 445 return; |
| 446 | 446 |
| 447 if (this.inject) | 447 if (this.inject) |
| 448 { | 448 { |
| 449 // Insert the style rules inline if we have been instructed by the | 449 // Insert the style rules inline if we have been instructed by the |
| 450 // background page to do so. This is usually the case, except on platforms | 450 // background page to do so. This is usually the case, except on platforms |
| 451 // that do support user stylesheets via the chrome.tabs.insertCSS API | 451 // that do support user stylesheets via the chrome.tabs.insertCSS API |
| 452 // (Firefox 53 onwards for now and possibly Chrome in the near future). | 452 // (Firefox 53 onwards for now and possibly Chrome in the near future). |
| 453 // Once all supported platforms have implemented this API, we can remove | 453 // Once all supported platforms have implemented this API, we can remove |
| 454 // the code below. See issue #5090. | 454 // the code below. See issue #5090. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 this.tracer.disconnect(); | 492 this.tracer.disconnect(); |
| 493 this.tracer = null; | 493 this.tracer = null; |
| 494 | 494 |
| 495 if (this.style && this.style.parentElement) | 495 if (this.style && this.style.parentElement) |
| 496 this.style.parentElement.removeChild(this.style); | 496 this.style.parentElement.removeChild(this.style); |
| 497 this.style = null; | 497 this.style = null; |
| 498 | 498 |
| 499 if (response.trace) | 499 if (response.trace) |
| 500 this.tracer = new ElementHidingTracer(); | 500 this.tracer = new ElementHidingTracer(); |
| 501 | 501 |
| 502 this.inject = !!response.inject; | 502 this.inject = response.inject; |
| 503 | 503 |
| 504 if (this.inject) | 504 if (this.inject) |
| 505 this.addSelectors(response.selectors); | 505 this.addSelectors(response.selectors); |
| 506 else if (this.tracer) | 506 else if (this.tracer) |
| 507 this.tracer.addSelectors(response.selectors); | 507 this.tracer.addSelectors(response.selectors); |
| 508 | 508 |
| 509 this.elemHideEmulation.apply(); | 509 this.elemHideEmulation.apply(); |
| 510 }); | 510 }); |
| 511 } | 511 } |
| 512 }; | 512 }; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 523 checkCollapse(event.target); | 523 checkCollapse(event.target); |
| 524 }, true); | 524 }, true); |
| 525 | 525 |
| 526 document.addEventListener("load", event => | 526 document.addEventListener("load", event => |
| 527 { | 527 { |
| 528 let element = event.target; | 528 let element = event.target; |
| 529 if (/^i?frame$/.test(element.localName)) | 529 if (/^i?frame$/.test(element.localName)) |
| 530 checkCollapse(element); | 530 checkCollapse(element); |
| 531 }, true); | 531 }, true); |
| 532 } | 532 } |
| LEFT | RIGHT |