OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 } | 253 } |
254 | 254 |
255 function addSubscription() | 255 function addSubscription() |
256 { | 256 { |
257 var list = document.getElementById("subscriptionSelector"); | 257 var list = document.getElementById("subscriptionSelector"); |
258 var data = list.options[list.selectedIndex]._data; | 258 var data = list.options[list.selectedIndex]._data; |
259 if (data) | 259 if (data) |
260 doAddSubscription(data.url, data.title, data.homepage); | 260 doAddSubscription(data.url, data.title, data.homepage); |
261 else | 261 else |
262 { | 262 { |
263 var url = document.getElementById("customSubscriptionLocation").value.replac
e(/^\s+/, "").replace(/\s+$/, ""); | 263 var url = document.getElementById("customSubscriptionLocation").value.trim()
; |
264 if (!/^https?:/i.test(url)) | 264 if (!/^https?:/i.test(url)) |
265 { | 265 { |
266 alert(i18n.getMessage("global_subscription_invalid_location")); | 266 alert(i18n.getMessage("global_subscription_invalid_location")); |
267 $("#customSubscriptionLocation").focus(); | 267 $("#customSubscriptionLocation").focus(); |
268 return; | 268 return; |
269 } | 269 } |
270 | 270 |
271 var title = document.getElementById("customSubscriptionTitle").value.replace
(/^\s+/, "").replace(/\s+$/, ""); | 271 var title = document.getElementById("customSubscriptionTitle").value.trim(); |
272 if (!title) | 272 if (!title) |
273 title = url; | 273 title = url; |
274 | 274 |
275 doAddSubscription(url, title, null); | 275 doAddSubscription(url, title, null); |
276 } | 276 } |
277 | 277 |
278 $("#addSubscriptionContainer").hide(); | 278 $("#addSubscriptionContainer").hide(); |
279 $("#customSubscriptionContainer").hide(); | 279 $("#customSubscriptionContainer").hide(); |
280 $("#addSubscriptionButton").show(); | 280 $("#addSubscriptionButton").show(); |
281 } | 281 } |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 links[i].href = arguments[i + 1]; | 648 links[i].href = arguments[i + 1]; |
649 links[i].setAttribute("target", "_blank"); | 649 links[i].setAttribute("target", "_blank"); |
650 } | 650 } |
651 else if (typeof arguments[i + 1] == "function") | 651 else if (typeof arguments[i + 1] == "function") |
652 { | 652 { |
653 links[i].href = "javascript:void(0);"; | 653 links[i].href = "javascript:void(0);"; |
654 links[i].addEventListener("click", arguments[i + 1], false); | 654 links[i].addEventListener("click", arguments[i + 1], false); |
655 } | 655 } |
656 } | 656 } |
657 } | 657 } |
OLD | NEW |