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

Delta Between Two Patch Sets: include.postload.js

Issue 5088751004942336: Issue 370 - Right-clicked element is removed independent of created filter (Closed)
Left Patch Set: Rebase to rev 3c9cea80c481 Created July 18, 2014, 8:54 a.m.
Right Patch Set: Created July 18, 2014, 9:13 a.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
« block.js ('K') | « block.js ('k') | include.preload.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 <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 if (clickHideFiltersDialog) 547 if (clickHideFiltersDialog)
548 { 548 {
549 clickHideFiltersDialog.style.left = (parseInt(clickHideFiltersDialog.s tyle.left, 10) + msg.x) + "px"; 549 clickHideFiltersDialog.style.left = (parseInt(clickHideFiltersDialog.s tyle.left, 10) + msg.x) + "px";
550 clickHideFiltersDialog.style.top = (parseInt(clickHideFiltersDialog.st yle.top, 10) + msg.y) + "px"; 550 clickHideFiltersDialog.style.top = (parseInt(clickHideFiltersDialog.st yle.top, 10) + msg.y) + "px";
551 } 551 }
552 break; 552 break;
553 case "clickhide-close": 553 case "clickhide-close":
554 if (clickHideFiltersDialog) 554 if (clickHideFiltersDialog)
555 { 555 {
556 // Explicitly get rid of currentElement 556 // Explicitly get rid of currentElement
557 var element = currentElement; 557 var filters = msg.filters;
558 currentElement.parentNode.removeChild(currentElement); 558 if (filters)
559 ext.backgroundPage.sendMessage({
560 type: "should-collapse",
561 url: element.src,
562 documentUrl: document.URL,
563 mediatype: typeMap[element.localName]
564 }, function(response)
565 { 559 {
566 if (response && element.parentNode) 560 var isHidden = false;
567 element.parentNode.removeChild(element); 561 var selectors = [];
568 }); 562 for (var i = 0; i < filters.length; i++)
563 {
564 var selector = filters[i].match(/##(.*)$/);
565 if (selector)
566 {
567 if (currentElement.matches(selector[1]))
568 isHidden = true;
569
570 selectors.push(selector[1]);
571 }
572 }
573 if (setElemhideCSSRules)
574 setElemhideCSSRules(selectors);
Wladimir Palant 2014/11/17 19:53:57 The code above has multiple issues: * It doesn't
Thomas Greiner 2014/11/27 14:46:07 What we could do is instead of just forwarding the
575
576 if (!isHidden)
577 {
578 var element = currentElement;
579 ext.backgroundPage.sendMessage({
580 type: "should-collapse",
581 url: element.src,
582 documentUrl: document.URL,
583 mediatype: typeMap[element.localName]
584 }, function(response)
585 {
586 if (response && element.parentNode)
587 element.style.setProperty("display", "none", "important");
Wladimir Palant 2014/11/17 19:53:57 We don't need to check the element's parent node i
Sebastian Noack 2014/11/27 12:43:40 What is if element collapsing is disabled in the o
Thomas Greiner 2014/11/27 14:46:07 That's a valid comment and it doesn't seem like we
Sebastian Noack 2014/11/27 15:15:48 If that is sufficient, fine for me.
588 });
589 }
590 }
569 591
570 clickHide_deactivate(); 592 clickHide_deactivate();
571 } 593 }
572 break; 594 break;
573 default: 595 default:
574 sendResponse({}); 596 sendResponse({});
575 break; 597 break;
576 } 598 }
577 }); 599 });
578 } 600 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld