| OLD | NEW |
| 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 27 matching lines...) Expand all Loading... |
| 38 if (!link) | 38 if (!link) |
| 39 return; | 39 return; |
| 40 } | 40 } |
| 41 | 41 |
| 42 if (link.protocol == "http:" || link.protocol == "https:") | 42 if (link.protocol == "http:" || link.protocol == "https:") |
| 43 { | 43 { |
| 44 if (link.host != "subscribe.adblockplus.org" || link.pathname != "/") | 44 if (link.host != "subscribe.adblockplus.org" || link.pathname != "/") |
| 45 return; | 45 return; |
| 46 } | 46 } |
| 47 else if (!/^abp:\/*subscribe\/*\?/i.test(link.href)) | 47 else if (!/^abp:\/*subscribe\/*\?/i.test(link.href)) |
| 48 { |
| 48 return; | 49 return; |
| 50 } |
| 49 | 51 |
| 50 // This is our link - make sure the browser doesn't handle it | 52 // This is our link - make sure the browser doesn't handle it |
| 51 event.preventDefault(); | 53 event.preventDefault(); |
| 52 event.stopPropagation(); | 54 event.stopPropagation(); |
| 53 | 55 |
| 54 // Decode URL parameters | 56 // Decode URL parameters |
| 55 let title = null; | 57 let title = null; |
| 56 let url = null; | 58 let url = null; |
| 57 for (let param of link.search.substr(1).split("&")) | 59 for (let param of link.search.substr(1).split("&")) |
| 58 { | 60 { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 77 title = url; | 79 title = url; |
| 78 | 80 |
| 79 // Trim spaces in title and URL | 81 // Trim spaces in title and URL |
| 80 title = title.trim(); | 82 title = title.trim(); |
| 81 url = url.trim(); | 83 url = url.trim(); |
| 82 if (!/^(https?|ftp):/.test(url)) | 84 if (!/^(https?|ftp):/.test(url)) |
| 83 return; | 85 return; |
| 84 | 86 |
| 85 ext.backgroundPage.sendMessage({ | 87 ext.backgroundPage.sendMessage({ |
| 86 type: "subscriptions.add", | 88 type: "subscriptions.add", |
| 87 title: title, | 89 title, |
| 88 url: url, | 90 url, |
| 89 confirm: true | 91 confirm: true |
| 90 }); | 92 }); |
| 91 }, true); | 93 }, true); |
| 92 } | 94 } |
| OLD | NEW |