Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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-2013 Eyeo GmbH | 3 * Copyright (C) 2006-2013 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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
555 clickHide_mouseClick(lastRightClickEvent); | 555 clickHide_mouseClick(lastRightClickEvent); |
556 } | 556 } |
557 else | 557 else |
558 console.log("clickhide-new-filter: URLs don't match. Couldn't find tha t element.", request.filter, url, lastRightClickEvent.target.src); | 558 console.log("clickhide-new-filter: URLs don't match. Couldn't find tha t element.", request.filter, url, lastRightClickEvent.target.src); |
559 break; | 559 break; |
560 case "clickhide-init": | 560 case "clickhide-init": |
561 if (clickHideFiltersDialog) | 561 if (clickHideFiltersDialog) |
562 { | 562 { |
563 sendResponse({filters: clickHide_filters}); | 563 sendResponse({filters: clickHide_filters}); |
564 | 564 |
565 clickHideFiltersDialog.style.width = (msg.width + 5) + "px"; | 565 clickHideFiltersDialog.style.width = msg.width + "px"; |
566 clickHideFiltersDialog.style.height = (msg.height + 15) + "px"; | 566 clickHideFiltersDialog.style.height = msg.height + "px"; |
Thomas Greiner
2014/01/07 12:13:11
This was necessary because Safari is otherwise sho
Sebastian Noack
2014/01/07 14:13:14
This is a hack. The problem here is that the code
Thomas Greiner
2014/01/07 15:01:39
Sounds like you addressed that already?! In that c
Sebastian Noack
2014/01/07 15:42:28
No I didn't. I just figured out what the problem i
Thomas Greiner
2014/01/07 16:15:51
I see your point but block.html is included as an
Sebastian Noack
2014/01/07 16:28:34
Yes, that is true. And that is why we send a messa
Thomas Greiner
2014/01/07 17:39:42
Sorry, I got a bit confused when you were talking
Sebastian Noack
2014/01/07 17:42:21
Sorry, I meant block.js.
| |
567 clickHideFiltersDialog.style.visibility = "visible"; | 567 clickHideFiltersDialog.style.visibility = "visible"; |
568 } | 568 } |
569 break; | 569 break; |
570 case "clickhide-move": | 570 case "clickhide-move": |
571 if (clickHideFiltersDialog) | 571 if (clickHideFiltersDialog) |
572 { | 572 { |
573 clickHideFiltersDialog.style.left = (parseInt(clickHideFiltersDialog.s tyle.left, 10) + request.x) + "px"; | 573 clickHideFiltersDialog.style.left = (parseInt(clickHideFiltersDialog.s tyle.left, 10) + request.x) + "px"; |
574 clickHideFiltersDialog.style.top = (parseInt(clickHideFiltersDialog.st yle.top, 10) + request.y) + "px"; | 574 clickHideFiltersDialog.style.top = (parseInt(clickHideFiltersDialog.st yle.top, 10) + request.y) + "px"; |
575 } | 575 } |
576 break; | 576 break; |
577 case "clickhide-close": | 577 case "clickhide-close": |
578 if (clickHideFiltersDialog) | 578 if (clickHideFiltersDialog) |
579 { | 579 { |
580 // Explicitly get rid of currentElement | 580 // Explicitly get rid of currentElement |
581 if (msg.remove && currentElement && currentElement.parentNode) | 581 if (msg.remove && currentElement && currentElement.parentNode) |
582 currentElement.parentNode.removeChild(currentElement); | 582 currentElement.parentNode.removeChild(currentElement); |
583 | 583 |
584 clickHide_deactivate(); | 584 clickHide_deactivate(); |
585 } | 585 } |
586 break; | 586 break; |
587 default: | 587 default: |
588 sendResponse({}); | 588 sendResponse({}); |
589 break; | 589 break; |
590 } | 590 } |
591 }); | 591 }); |
592 | 592 } |
593 // Safari does not pass the element which the context menu is refering to | |
594 // so we need to add it to the event's user info. | |
595 if ("safari" in window) | |
596 { | |
597 document.addEventListener("contextmenu", function(event) | |
Sebastian Noack
2014/01/07 14:13:14
This should go in safari/ext/content.js
Thomas Greiner
2014/01/07 15:01:39
Done.
| |
598 { | |
599 var element = event.srcElement; | |
600 safari.self.tab.setContextMenuEventUserInfo(event, { | |
601 srcUrl: ("src" in element) ? element.src : null, | |
602 tagName: element.tagName | |
603 }); | |
604 }, false); | |
605 } | |
606 } | |
LEFT | RIGHT |