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-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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 return; | 378 return; |
379 | 379 |
380 let element = currentElement.prisoner || currentElement; | 380 let element = currentElement.prisoner || currentElement; |
381 getFiltersForElement(element, (filters, selectors) => | 381 getFiltersForElement(element, (filters, selectors) => |
382 { | 382 { |
383 if (currentlyPickingElement) | 383 if (currentlyPickingElement) |
384 stopPickingElement(); | 384 stopPickingElement(); |
385 | 385 |
386 ext.backgroundPage.sendMessage( | 386 ext.backgroundPage.sendMessage( |
387 { | 387 { |
388 type: "blockelement-open-popup", | 388 type: "blockelement-open-popup" |
389 filters: filters | 389 }, |
| 390 response => |
| 391 { |
| 392 blockelementPopupId = response; |
| 393 ext.backgroundPage.sendMessage( |
| 394 { |
| 395 type: "forward", |
| 396 targetPageId: blockelementPopupId, |
| 397 payload: |
| 398 { |
| 399 type: "blockelement-popup-init", |
| 400 filters: filters |
| 401 } |
| 402 }); |
390 }); | 403 }); |
391 | 404 |
392 if (selectors.length > 0) | 405 if (selectors.length > 0) |
393 highlightElements(selectors.join(",")); | 406 highlightElements(selectors.join(",")); |
394 | 407 |
395 highlightElement(currentElement, "#fd1708", "#f6a1b5"); | 408 highlightElement(currentElement, "#fd1708", "#f6a1b5"); |
396 }); | 409 }); |
397 | 410 |
398 event.preventDefault(); | 411 event.preventDefault(); |
399 event.stopPropagation(); | 412 event.stopPropagation(); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 // Apply added element hiding filters. | 537 // Apply added element hiding filters. |
525 updateStylesheet(); | 538 updateStylesheet(); |
526 } | 539 } |
527 deactivateBlockElement(); | 540 deactivateBlockElement(); |
528 break; | 541 break; |
529 case "blockelement-clear-previous-right-click-event": | 542 case "blockelement-clear-previous-right-click-event": |
530 if (!lastRightClickEventIsMostRecent) | 543 if (!lastRightClickEventIsMostRecent) |
531 lastRightClickEvent = null; | 544 lastRightClickEvent = null; |
532 lastRightClickEventIsMostRecent = false; | 545 lastRightClickEventIsMostRecent = false; |
533 break; | 546 break; |
534 case "blockelement-popup-opened": | |
535 if (window == window.top) | |
536 blockelementPopupId = msg.popupId; | |
537 break; | |
538 case "blockelement-popup-closed": | 547 case "blockelement-popup-closed": |
539 // The onRemoved hook for the popup can create a race condition, so we | 548 // The onRemoved hook for the popup can create a race condition, so we |
540 // to be careful here. (This is not perfect, but best we can do.) | 549 // to be careful here. (This is not perfect, but best we can do.) |
541 if (window == window.top && blockelementPopupId == msg.popupId) | 550 if (window == window.top && blockelementPopupId == msg.popupId) |
542 { | 551 { |
543 ext.backgroundPage.sendMessage( | 552 ext.backgroundPage.sendMessage( |
544 { | 553 { |
545 type: "forward", | 554 type: "forward", |
546 payload: | 555 payload: |
547 { | 556 { |
548 type: "blockelement-finished" | 557 type: "blockelement-finished" |
549 } | 558 } |
550 }); | 559 }); |
551 } | 560 } |
552 break; | 561 break; |
553 } | 562 } |
554 }); | 563 }); |
555 | 564 |
556 if (window == window.top) | 565 if (window == window.top) |
557 ext.backgroundPage.sendMessage({type: "report-html-page"}); | 566 ext.backgroundPage.sendMessage({type: "report-html-page"}); |
558 } | 567 } |
LEFT | RIGHT |