Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: include.preload.js

Issue 29370970: [adblockpluschrome] Issue 3596 - Added support for CSS property filters to devtools panel (Closed)
Left Patch Set: Removed obsolete variable and blank line Created Feb. 23, 2017, 11:19 a.m.
Right Patch Set: Addressed review comment Created Feb. 23, 2017, 2:23 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « dependencies ('k') | lib/devtools.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 // is! Edge apparently has no such limit.) 537 // is! Edge apparently has no such limit.)
538 // [1] - https://github.com/WebKit/webkit/blob/1cb2227f6b2a1035f7bdc46e5ab69 debb75fc1de/Source/WebCore/css/RuleSet.h#L68 538 // [1] - https://github.com/WebKit/webkit/blob/1cb2227f6b2a1035f7bdc46e5ab69 debb75fc1de/Source/WebCore/css/RuleSet.h#L68
539 for (let i = 0; i < preparedSelectors.length; i += this.selectorGroupSize) 539 for (let i = 0; i < preparedSelectors.length; i += this.selectorGroupSize)
540 { 540 {
541 let selector = preparedSelectors.slice(i, i + this.selectorGroupSize).join (", "); 541 let selector = preparedSelectors.slice(i, i + this.selectorGroupSize).join (", ");
542 this.style.sheet.insertRule(selector + "{display: none !important;}", 542 this.style.sheet.insertRule(selector + "{display: none !important;}",
543 this.style.sheet.cssRules.length); 543 this.style.sheet.cssRules.length);
544 } 544 }
545 545
546 if (this.tracer) 546 if (this.tracer)
547 this.tracer.addSelectors(selectors, filters); 547 this.tracer.addSelectors(selectors, filters || selectors);
548 }, 548 },
549 549
550 apply() 550 apply()
551 { 551 {
552 ext.backgroundPage.sendMessage({type: "get-selectors"}, response => 552 ext.backgroundPage.sendMessage({type: "get-selectors"}, response =>
553 { 553 {
554 if (this.tracer) 554 if (this.tracer)
555 this.tracer.disconnect(); 555 this.tracer.disconnect();
556 this.tracer = null; 556 this.tracer = null;
557 557
558 if (this.style && this.style.parentElement) 558 if (this.style && this.style.parentElement)
559 this.style.parentElement.removeChild(this.style); 559 this.style.parentElement.removeChild(this.style);
560 this.style = null; 560 this.style = null;
561 561
562 if (response.trace) 562 if (response.trace)
563 this.tracer = new ElementHidingTracer(); 563 this.tracer = new ElementHidingTracer();
564 564
565 this.addSelectors(response.selectors, response.selectors); 565 this.addSelectors(response.selectors);
566 this.elemHideEmulation.apply(); 566 this.elemHideEmulation.apply();
567 }); 567 });
568 } 568 }
569 }; 569 };
570 570
571 if (document instanceof HTMLDocument) 571 if (document instanceof HTMLDocument)
572 { 572 {
573 checkSitekey(); 573 checkSitekey();
574 wrapWebSocket(); 574 wrapWebSocket();
575 575
576 // This variable is also used by our other content scripts, outside of the 576 // This variable is also used by our other content scripts, outside of the
577 // current scope. 577 // current scope.
578 var elemhide = new ElemHide(); 578 var elemhide = new ElemHide();
579 elemhide.apply(); 579 elemhide.apply();
580 580
581 document.addEventListener("error", event => 581 document.addEventListener("error", event =>
582 { 582 {
583 checkCollapse(event.target); 583 checkCollapse(event.target);
584 }, true); 584 }, true);
585 585
586 document.addEventListener("load", event => 586 document.addEventListener("load", event =>
587 { 587 {
588 let element = event.target; 588 let element = event.target;
589 if (/^i?frame$/.test(element.localName)) 589 if (/^i?frame$/.test(element.localName))
590 checkCollapse(element); 590 checkCollapse(element);
591 }, true); 591 }, true);
592 } 592 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld