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

Side by Side Diff: subscriptionLink.postload.js

Issue 29342971: Fixes 4065 - Subscription links on Chrome 30 (Closed)
Patch Set: Created May 24, 2016, 11:48 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 if (link.host != "subscribe.adblockplus.org" || link.pathname != "/") 48 if (link.host != "subscribe.adblockplus.org" || link.pathname != "/")
49 return; 49 return;
50 } 50 }
51 else if (!/^abp:\/*subscribe\/*\?/i.test(link.href)) 51 else if (!/^abp:\/*subscribe\/*\?/i.test(link.href))
52 return; 52 return;
53 53
54 // This is our link - make sure the browser doesn't handle it 54 // This is our link - make sure the browser doesn't handle it
55 event.preventDefault(); 55 event.preventDefault();
56 event.stopPropagation(); 56 event.stopPropagation();
57 57
58 // Decode URL parameters 58 // Decode URL parameters (Note: Old versions of Chrome (30) don't populate
59 var params = link.search.substr(1).split("&"); 59 // link.search here so we have to grab the search part of the URL manually.)
60 var params = link.href.substr(link.href.indexOf("?") + 1).split("&");
60 var title = null; 61 var title = null;
61 var url = null; 62 var url = null;
62 for (var i = 0; i < params.length; i++) 63 for (var i = 0; i < params.length; i++)
63 { 64 {
64 var parts = params[i].split("=", 2); 65 var parts = params[i].split("=", 2);
65 if (parts.length != 2 || !/\S/.test(parts[1])) 66 if (parts.length != 2 || !/\S/.test(parts[1]))
66 continue; 67 continue;
67 switch (parts[0]) 68 switch (parts[0])
68 { 69 {
69 case "title": 70 case "title":
(...skipping 18 matching lines...) Expand all
88 return; 89 return;
89 90
90 ext.backgroundPage.sendMessage({ 91 ext.backgroundPage.sendMessage({
91 type: "subscriptions.add", 92 type: "subscriptions.add",
92 title: title, 93 title: title,
93 url: url, 94 url: url,
94 confirm: true 95 confirm: true
95 }); 96 });
96 }, true); 97 }, true);
97 } 98 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld