Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: include.postload.js

Issue 5246523029848064: Issue 2212 - Implement http://subscribe.adblockplus.org/?... subscription links (Closed)
Patch Set: Created March 25, 2015, 2:01 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include.postload.js
===================================================================
--- a/include.postload.js
+++ b/include.postload.js
@@ -610,22 +610,28 @@
// Search the link associated with the click
var link = event.target;
- while (link && !(link instanceof HTMLAnchorElement))
+ while (!(link instanceof HTMLAnchorElement))
+ {
link = link.parentNode;
- if (!link || link.protocol != "abp:")
+ if (!link)
+ return;
+ }
+
+ 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
+ {
+ if (link.host != "subscribe.adblockplus.org" || link.pathname != "/")
+ return;
+ }
+ 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.
return;
// This is our link - make sure the browser doesn't handle it
event.preventDefault();
event.stopPropagation();
- var linkTarget = link.href;
- if (!/^abp:\/*subscribe\/*\?(.*)/i.test(linkTarget)) /**/
- return;
-
// Decode URL parameters
- var params = RegExp.$1.split("&");
+ 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
var title = null;
var url = null;
for (var i = 0; i < params.length; i++)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld