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: Removed unneeded regexp group Created March 25, 2015, 3:23 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:")
+ {
+ if (link.host != "subscribe.adblockplus.org" || link.pathname != "/")
+ return;
+ }
+ else if (!/^abp:\/*subscribe\/*\?/i.test(link.href))
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("&");
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