Left: | ||
Right: |
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-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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
611 // Search the link associated with the click | 611 // Search the link associated with the click |
612 var link = event.target; | 612 var link = event.target; |
613 while (!(link instanceof HTMLAnchorElement)) | 613 while (!(link instanceof HTMLAnchorElement)) |
614 { | 614 { |
615 link = link.parentNode; | 615 link = link.parentNode; |
616 | 616 |
617 if (!link) | 617 if (!link) |
618 return; | 618 return; |
619 } | 619 } |
620 | 620 |
621 if (link.protocol == "http:" || link.protocol == "https:") | 621 if (link.protocol == "http:" || link.protocol == "https:") |
kzar
2015/03/25 14:09:29
(Do we even need to support http? I guess we will
Sebastian Noack
2015/03/25 14:21:04
We probably will. But others linking to our websit
| |
622 { | 622 { |
623 if (link.host != "subscribe.adblockplus.org" || link.pathname != "/") | 623 if (link.host != "subscribe.adblockplus.org" || link.pathname != "/") |
624 return; | 624 return; |
625 } | 625 } |
626 else if (!/^abp:\/*subscribe\/*\?(.*)/i.test(link.href)) | 626 else if (!/^abp:\/*subscribe\/*\?/i.test(link.href)) |
Thomas Greiner
2015/03/25 15:05:36
The `(.*)` at the end of the regular expression is
Wladimir Palant
2015/03/25 15:07:17
Nit: Please remove the parentheses in this regexp
Sebastian Noack
2015/03/25 15:23:26
Done.
| |
627 return; | 627 return; |
628 | 628 |
629 // This is our link - make sure the browser doesn't handle it | 629 // This is our link - make sure the browser doesn't handle it |
630 event.preventDefault(); | 630 event.preventDefault(); |
631 event.stopPropagation(); | 631 event.stopPropagation(); |
632 | 632 |
633 // Decode URL parameters | 633 // Decode URL parameters |
634 var params = link.search.substr(1).split("&"); | 634 var params = link.search.substr(1).split("&"); |
Wladimir Palant
2015/03/25 15:07:17
Note that this change will make the approach incon
Sebastian Noack
2015/03/25 15:23:26
Well, the alternative would be to make things inco
| |
635 var title = null; | 635 var title = null; |
636 var url = null; | 636 var url = null; |
637 for (var i = 0; i < params.length; i++) | 637 for (var i = 0; i < params.length; i++) |
638 { | 638 { |
639 var parts = params[i].split("=", 2); | 639 var parts = params[i].split("=", 2); |
640 if (parts.length != 2 || !/\S/.test(parts[1])) | 640 if (parts.length != 2 || !/\S/.test(parts[1])) |
641 continue; | 641 continue; |
642 switch (parts[0]) | 642 switch (parts[0]) |
643 { | 643 { |
644 case "title": | 644 case "title": |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
736 lastRightClickEventValid = false; | 736 lastRightClickEventValid = false; |
737 else | 737 else |
738 lastRightClickEvent = null; | 738 lastRightClickEvent = null; |
739 break; | 739 break; |
740 } | 740 } |
741 }); | 741 }); |
742 | 742 |
743 if (window == window.top) | 743 if (window == window.top) |
744 ext.backgroundPage.sendMessage({type: "report-html-page"}); | 744 ext.backgroundPage.sendMessage({type: "report-html-page"}); |
745 } | 745 } |
LEFT | RIGHT |