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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 // Safari only allows 8192 primitive selectors to be injected at once[1], we | 433 // Safari only allows 8192 primitive selectors to be injected at once[1], we |
434 // therefore chunk the inserted selectors into groups of 200 to be safe. | 434 // therefore chunk the inserted selectors into groups of 200 to be safe. |
435 // (Chrome also has a limit, larger... but we're not certain exactly what it | 435 // (Chrome also has a limit, larger... but we're not certain exactly what it |
436 // is! Edge apparently has no such limit.) | 436 // is! Edge apparently has no such limit.) |
437 // [1] - https://github.com/WebKit/webkit/blob/1cb2227f6b2a1035f7bdc46e5ab69
debb75fc1de/Source/WebCore/css/RuleSet.h#L68 | 437 // [1] - https://github.com/WebKit/webkit/blob/1cb2227f6b2a1035f7bdc46e5ab69
debb75fc1de/Source/WebCore/css/RuleSet.h#L68 |
438 for (let i = 0; i < preparedSelectors.length; i += this.selectorGroupSize) | 438 for (let i = 0; i < preparedSelectors.length; i += this.selectorGroupSize) |
439 { | 439 { |
440 let selector = preparedSelectors.slice( | 440 let selector = preparedSelectors.slice( |
441 i, i + this.selectorGroupSize | 441 i, i + this.selectorGroupSize |
442 ).join(", "); | 442 ).join(", "); |
443 this.style.sheet.insertRule(selector + "{display: none !important;}", | 443 style.sheet.insertRule(selector + "{display: none !important;}", |
444 this.style.sheet.cssRules.length); | 444 style.sheet.cssRules.length); |
445 } | 445 } |
446 }, | 446 }, |
447 | 447 |
448 addSelectors(selectors, filters) | 448 addSelectors(selectors, filters) |
449 { | 449 { |
450 if (this.inline) | 450 if (this.inline) |
451 { | 451 { |
452 // Insert the style rules inline if we have been instructed by the | 452 // Insert the style rules inline if we have been instructed by the |
453 // background page to do so. This is usually the case, except on platforms | 453 // background page to do so. This is usually the case, except on platforms |
454 // that do support user stylesheets via the browser.tabs.insertCSS API | 454 // that do support user stylesheets via the browser.tabs.insertCSS API |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 let element = event.target; | 529 let element = event.target; |
530 if (/^i?frame$/.test(element.localName)) | 530 if (/^i?frame$/.test(element.localName)) |
531 checkCollapse(element); | 531 checkCollapse(element); |
532 }, true); | 532 }, true); |
533 } | 533 } |
534 | 534 |
535 window.checkCollapse = checkCollapse; | 535 window.checkCollapse = checkCollapse; |
536 window.elemhide = elemhide; | 536 window.elemhide = elemhide; |
537 window.typeMap = typeMap; | 537 window.typeMap = typeMap; |
538 window.getURLsFromElement = getURLsFromElement; | 538 window.getURLsFromElement = getURLsFromElement; |
OLD | NEW |