| 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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 sendResponse({filters: clickHide_filters}); | 693 sendResponse({filters: clickHide_filters}); |
| 694 | 694 |
| 695 clickHideFiltersDialog.style.width = msg.width + "px"; | 695 clickHideFiltersDialog.style.width = msg.width + "px"; |
| 696 clickHideFiltersDialog.style.height = msg.height + "px"; | 696 clickHideFiltersDialog.style.height = msg.height + "px"; |
| 697 clickHideFiltersDialog.style.visibility = "visible"; | 697 clickHideFiltersDialog.style.visibility = "visible"; |
| 698 } | 698 } |
| 699 break; | 699 break; |
| 700 case "clickhide-move": | 700 case "clickhide-move": |
| 701 if (clickHideFiltersDialog) | 701 if (clickHideFiltersDialog) |
| 702 { | 702 { |
| 703 clickHideFiltersDialog.style.left = (parseInt(clickHideFiltersDialog.s
tyle.left, 10) + msg.x) + "px"; | 703 var rect = clickHideFiltersDialog.getBoundingClientRect(); |
| 704 clickHideFiltersDialog.style.top = (parseInt(clickHideFiltersDialog.st
yle.top, 10) + msg.y) + "px"; | 704 var x = Math.max(0, Math.min(rect.left + msg.x, window.innerWidth - re
ct.width)); |
| 705 var y = Math.max(0, Math.min(rect.top + msg.y, window.innerHeight - re
ct.height)); |
| 706 |
| 707 clickHideFiltersDialog.style.left = x + "px"; |
| 708 clickHideFiltersDialog.style.top = y + "px"; |
| 705 } | 709 } |
| 706 break; | 710 break; |
| 707 case "clickhide-close": | 711 case "clickhide-close": |
| 708 if (currentElement && msg.remove) | 712 if (currentElement && msg.remove) |
| 709 { | 713 { |
| 710 // Hide the selected element itself if an added blocking | 714 // Hide the selected element itself if an added blocking |
| 711 // filter is causing it to collapse. Note that this | 715 // filter is causing it to collapse. Note that this |
| 712 // behavior is incomplete, but the best we can do here, | 716 // behavior is incomplete, but the best we can do here, |
| 713 // e.g. if an added blocking filter matches other elements, | 717 // e.g. if an added blocking filter matches other elements, |
| 714 // the effect won't be visible until the page is is reloaded. | 718 // the effect won't be visible until the page is is reloaded. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 730 lastRightClickEventValid = false; | 734 lastRightClickEventValid = false; |
| 731 else | 735 else |
| 732 lastRightClickEvent = null; | 736 lastRightClickEvent = null; |
| 733 break; | 737 break; |
| 734 } | 738 } |
| 735 }); | 739 }); |
| 736 | 740 |
| 737 if (window == window.top) | 741 if (window == window.top) |
| 738 ext.backgroundPage.sendMessage({type: "report-html-page"}); | 742 ext.backgroundPage.sendMessage({type: "report-html-page"}); |
| 739 } | 743 } |
| OLD | NEW |