| 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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 { | 88 { |
| 89 NotificationStorage.toggleIgnoreCategory("*"); | 89 NotificationStorage.toggleIgnoreCategory("*"); |
| 90 return this.get(); | 90 return this.get(); |
| 91 } | 91 } |
| 92 }); | 92 }); |
| 93 } | 93 } |
| 94 else | 94 else |
| 95 document.getElementById("shouldShowNotificationsContainer").hidden = true; | 95 document.getElementById("shouldShowNotificationsContainer").hidden = true; |
| 96 | 96 |
| 97 ext.onMessage.addListener(onMessage); | 97 ext.onMessage.addListener(onMessage); |
| 98 ext.backgroundPage.sendMessage({ |
| 99 type: "app.listen", |
| 100 filter: ["addSubscription"] |
| 101 }); |
| 98 | 102 |
| 99 // Load recommended subscriptions | 103 // Load recommended subscriptions |
| 100 loadRecommendations(); | 104 loadRecommendations(); |
| 101 | 105 |
| 102 // Show user's filters | 106 // Show user's filters |
| 103 reloadFilters(); | 107 reloadFilters(); |
| 104 } | 108 } |
| 105 $(loadOptions); | 109 $(loadOptions); |
| 106 | 110 |
| 107 function onMessage(msg) | 111 function onMessage(msg) |
| 108 { | 112 { |
| 109 if (msg.type == "add-subscription") | 113 if (msg.type == "app.listen") |
| 110 startSubscriptionSelection(msg.title, msg.url); | 114 { |
| 115 if (msg.action == "addSubscription") |
| 116 { |
| 117 var subscription = msg.args[0]; |
| 118 startSubscriptionSelection(subscription.title, subscription.url); |
| 119 } |
| 120 } |
| 111 else if (msg.type == "focus-section") | 121 else if (msg.type == "focus-section") |
| 112 { | 122 { |
| 113 var tabs = document.getElementsByClassName("ui-tabs-panel"); | 123 var tabs = document.getElementsByClassName("ui-tabs-panel"); |
| 114 for (var i = 0; i < tabs.length; i++) | 124 for (var i = 0; i < tabs.length; i++) |
| 115 { | 125 { |
| 116 var found = tabs[i].querySelector("[data-section='" + msg.section + "']"); | 126 var found = tabs[i].querySelector("[data-section='" + msg.section + "']"); |
| 117 if (!found) | 127 if (!found) |
| 118 continue; | 128 continue; |
| 119 | 129 |
| 120 var previous = document.getElementsByClassName("focused"); | 130 var previous = document.getElementsByClassName("focused"); |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 links[i].href = arguments[i + 1]; | 692 links[i].href = arguments[i + 1]; |
| 683 links[i].setAttribute("target", "_blank"); | 693 links[i].setAttribute("target", "_blank"); |
| 684 } | 694 } |
| 685 else if (typeof arguments[i + 1] == "function") | 695 else if (typeof arguments[i + 1] == "function") |
| 686 { | 696 { |
| 687 links[i].href = "javascript:void(0);"; | 697 links[i].href = "javascript:void(0);"; |
| 688 links[i].addEventListener("click", arguments[i + 1], false); | 698 links[i].addEventListener("click", arguments[i + 1], false); |
| 689 } | 699 } |
| 690 } | 700 } |
| 691 } | 701 } |
| OLD | NEW |