| 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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 { | 452 { |
| 453 var subSelectors = splitSelector(selectors[i]); | 453 var subSelectors = splitSelector(selectors[i]); |
| 454 for (var j = 0; j < subSelectors.length; j++) | 454 for (var j = 0; j < subSelectors.length; j++) |
| 455 preparedSelectors.push("::content " + subSelectors[j]); | 455 preparedSelectors.push("::content " + subSelectors[j]); |
| 456 } | 456 } |
| 457 selectors = preparedSelectors; | 457 selectors = preparedSelectors; |
| 458 } | 458 } |
| 459 | 459 |
| 460 // WebKit (and Blink?) apparently chokes when the selector list in a | 460 // WebKit (and Blink?) apparently chokes when the selector list in a |
| 461 // CSS rule is huge. So we split the elemhide selectors into groups. | 461 // CSS rule is huge. So we split the elemhide selectors into groups. |
| 462 while (selectors.length > 0) | 462 for (var i = 0; i < selectors.length; i += SELECTOR_GROUP_SIZE) |
| 463 { | 463 { |
| 464 var selector = selectors.splice(0, SELECTOR_GROUP_SIZE).join(", "); | 464 var selector = selectors.slice(i, i + SELECTOR_GROUP_SIZE).join(", "); |
| 465 style.sheet.addRule(selector, "display: none !important;"); | 465 style.sheet.addRule(selector, "display: none !important;"); |
| 466 } | 466 } |
| 467 }; | 467 }; |
| 468 | 468 |
| 469 var updateStylesheet = function() | 469 var updateStylesheet = function() |
| 470 { | 470 { |
| 471 var selectors = null; | 471 var selectors = null; |
| 472 var CSSPropertyFiltersLoaded = false; | 472 var CSSPropertyFiltersLoaded = false; |
| 473 | 473 |
| 474 var checkLoaded = function() | 474 var checkLoaded = function() |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 }, true); | 552 }, true); |
| 553 | 553 |
| 554 return updateStylesheet; | 554 return updateStylesheet; |
| 555 } | 555 } |
| 556 | 556 |
| 557 if (document instanceof HTMLDocument) | 557 if (document instanceof HTMLDocument) |
| 558 { | 558 { |
| 559 checkSitekey(); | 559 checkSitekey(); |
| 560 window.updateStylesheet = init(document); | 560 window.updateStylesheet = init(document); |
| 561 } | 561 } |
| OLD | NEW |