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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 overlay.style.position = position; | 243 overlay.style.position = position; |
244 overlay.style.zIndex = zIndex; | 244 overlay.style.zIndex = zIndex; |
245 | 245 |
246 // elt.parentNode.appendChild(overlay, elt); | 246 // elt.parentNode.appendChild(overlay, elt); |
247 document.documentElement.appendChild(overlay); | 247 document.documentElement.appendChild(overlay); |
248 return overlay; | 248 return overlay; |
249 } | 249 } |
250 | 250 |
251 // Show dialog asking user whether she wants to add the proposed filters derived | 251 // Show dialog asking user whether she wants to add the proposed filters derived |
252 // from selected page element | 252 // from selected page element |
253 function clickHide_showDialog(left, top, filters) | 253 function clickHide_showDialog(filters) |
254 { | 254 { |
255 // If we are already selecting, abort now | 255 // If we are already selecting, abort now |
256 if (clickHide_activated) | 256 if (clickHide_activated) |
257 clickHide_rulesPending(); | 257 clickHide_rulesPending(); |
258 | 258 |
259 clickHide_filters = filters; | 259 clickHide_filters = filters; |
260 | 260 |
261 clickHideFiltersDialog = document.createElement("iframe"); | 261 clickHideFiltersDialog = document.createElement("iframe"); |
262 clickHideFiltersDialog.src = ext.getURL("block.html"); | 262 clickHideFiltersDialog.src = ext.getURL("block.html"); |
263 clickHideFiltersDialog.setAttribute("style", "position: fixed !important; visi
bility: hidden; display: block !important; border: 0px !important;"); | 263 clickHideFiltersDialog.setAttribute("style", "position: fixed !important; visi
bility: hidden; display: block !important; border: 0px !important;"); |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 elt = currentElement.prisoner; | 523 elt = currentElement.prisoner; |
524 | 524 |
525 getFiltersForElement(elt, function(filters, selectors) | 525 getFiltersForElement(elt, function(filters, selectors) |
526 { | 526 { |
527 ext.backgroundPage.sendMessage( | 527 ext.backgroundPage.sendMessage( |
528 { | 528 { |
529 type: "forward", | 529 type: "forward", |
530 payload: | 530 payload: |
531 { | 531 { |
532 type: "clickhide-show-dialog", | 532 type: "clickhide-show-dialog", |
533 screenX: e.screenX, | |
534 screenY: e.screenY, | |
535 clickHideFilters: filters | 533 clickHideFilters: filters |
536 } | 534 } |
537 }); | 535 }); |
538 | 536 |
539 if (selectors.length > 0) | 537 if (selectors.length > 0) |
540 highlightElements(selectors.join(",")); | 538 highlightElements(selectors.join(",")); |
541 | 539 |
542 highlightElement(currentElement, "#fd1708", "#f6a1b5"); | 540 highlightElement(currentElement, "#fd1708", "#f6a1b5"); |
543 }); | 541 }); |
544 | 542 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 // 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. |
721 checkCollapse(currentElement.prisoner || currentElement); | 719 checkCollapse(currentElement.prisoner || currentElement); |
722 | 720 |
723 // Apply added element hiding filters. | 721 // Apply added element hiding filters. |
724 updateStylesheet(); | 722 updateStylesheet(); |
725 } | 723 } |
726 clickHide_deactivate(); | 724 clickHide_deactivate(); |
727 break; | 725 break; |
728 case "clickhide-show-dialog": | 726 case "clickhide-show-dialog": |
729 if (window.self == window.top) | 727 if (window.self == window.top) |
730 clickHide_showDialog(msg.screenX + window.pageXOffset, | 728 clickHide_showDialog(msg.clickHideFilters); |
731 msg.screenY + window.pageYOffset, | |
732 msg.clickHideFilters); | |
733 break; | 729 break; |
734 case "clickhide-clear-last-right-click-event": | 730 case "clickhide-clear-last-right-click-event": |
735 if (lastRightClickEventValid) | 731 if (lastRightClickEventValid) |
736 lastRightClickEventValid = false; | 732 lastRightClickEventValid = false; |
737 else | 733 else |
738 lastRightClickEvent = null; | 734 lastRightClickEvent = null; |
739 break; | 735 break; |
740 } | 736 } |
741 }); | 737 }); |
742 | 738 |
743 if (window == window.top) | 739 if (window == window.top) |
744 ext.backgroundPage.sendMessage({type: "report-html-page"}); | 740 ext.backgroundPage.sendMessage({type: "report-html-page"}); |
745 } | 741 } |
OLD | NEW |