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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // Load recommended subscriptions | 82 // Load recommended subscriptions |
83 loadRecommendations(); | 83 loadRecommendations(); |
84 | 84 |
85 // Show user's filters | 85 // Show user's filters |
86 reloadFilters(); | 86 reloadFilters(); |
87 } | 87 } |
88 $(loadOptions); | 88 $(loadOptions); |
89 | 89 |
90 function onMessage(msg) | 90 function onMessage(msg) |
91 { | 91 { |
92 switch (msg.type) | 92 if (msg.type == "add-subscription") |
93 { | 93 startSubscriptionSelection(msg.title, msg.url); |
94 case "add-subscription": | |
95 startSubscriptionSelection(msg.title, msg.url); | |
96 break; | |
97 default: | |
98 console.log("got unexpected message: " + msg.type); | |
99 } | |
100 }; | 94 }; |
101 | 95 |
102 // Reloads the displayed subscriptions and filters | 96 // Reloads the displayed subscriptions and filters |
103 function reloadFilters() | 97 function reloadFilters() |
104 { | 98 { |
105 // Load user filter URLs | 99 // Load user filter URLs |
106 var container = document.getElementById("filterLists"); | 100 var container = document.getElementById("filterLists"); |
107 while (container.lastChild) | 101 while (container.lastChild) |
108 container.removeChild(container.lastChild); | 102 container.removeChild(container.lastChild); |
109 | 103 |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 links[i].href = arguments[i + 1]; | 641 links[i].href = arguments[i + 1]; |
648 links[i].setAttribute("target", "_blank"); | 642 links[i].setAttribute("target", "_blank"); |
649 } | 643 } |
650 else if (typeof arguments[i + 1] == "function") | 644 else if (typeof arguments[i + 1] == "function") |
651 { | 645 { |
652 links[i].href = "javascript:void(0);"; | 646 links[i].href = "javascript:void(0);"; |
653 links[i].addEventListener("click", arguments[i + 1], false); | 647 links[i].addEventListener("click", arguments[i + 1], false); |
654 } | 648 } |
655 } | 649 } |
656 } | 650 } |
OLD | NEW |