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 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 { | 914 { |
915 var customFilterItems = collections.customFilters.items; | 915 var customFilterItems = collections.customFilters.items; |
916 var filterTexts = []; | 916 var filterTexts = []; |
917 for (var i = 0; i < customFilterItems.length; i++) | 917 for (var i = 0; i < customFilterItems.length; i++) |
918 filterTexts.push(customFilterItems[i].text); | 918 filterTexts.push(customFilterItems[i].text); |
919 E("custom-filters-raw").value = filterTexts.join("\n"); | 919 E("custom-filters-raw").value = filterTexts.join("\n"); |
920 } | 920 } |
921 | 921 |
922 function getAcceptableAdsURL(callback) | 922 function getAcceptableAdsURL(callback) |
923 { | 923 { |
924 getPref("subscriptions_exceptionsurl", function(value) | 924 getPref("subscriptions_exceptionsurl", function(value) |
925 { | 925 { |
926 getAcceptableAdsURL = function(callback) | 926 getAcceptableAdsURL = function(callback) |
927 { | 927 { |
928 callback(value); | 928 callback(value); |
929 }; | 929 }; |
930 getAcceptableAdsURL(callback); | 930 getAcceptableAdsURL(callback); |
931 }); | 931 }); |
932 } | 932 } |
933 | 933 |
934 function addEnableSubscription(url, title, homepage) | 934 function addEnableSubscription(url, title, homepage) |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1126 | 1126 |
1127 for (var i = 0; i < shareResources.length; i++) | 1127 for (var i = 0; i < shareResources.length; i++) |
1128 checkShareResource(shareResources[i], onResult); | 1128 checkShareResource(shareResources[i], onResult); |
1129 } | 1129 } |
1130 | 1130 |
1131 ext.onMessage.addListener(function(message) | 1131 ext.onMessage.addListener(function(message) |
1132 { | 1132 { |
1133 switch (message.type) | 1133 switch (message.type) |
1134 { | 1134 { |
1135 case "app.respond": | 1135 case "app.respond": |
1136 if (message.action == "addSubscription") | 1136 switch (message.action) |
1137 { | 1137 { |
1138 var subscription = message.args[0]; | 1138 case "addSubscription": |
1139 var dialog = E("dialog-content-predefined"); | 1139 var subscription = message.args[0]; |
1140 dialog.querySelector("h3").textContent = subscription.title || ""; | 1140 var dialog = E("dialog-content-predefined"); |
1141 dialog.querySelector(".url").textContent = subscription.url; | 1141 dialog.querySelector("h3").textContent = subscription.title || ""; |
1142 openDialog("predefined"); | 1142 dialog.querySelector(".url").textContent = subscription.url; |
| 1143 openDialog("predefined"); |
| 1144 break; |
| 1145 case "focusSection": |
| 1146 document.body.setAttribute("data-tab", message.args[0]); |
| 1147 break; |
1143 } | 1148 } |
1144 break; | 1149 break; |
1145 case "filters.respond": | 1150 case "filters.respond": |
1146 onFilterMessage(message.action, message.args[0]); | 1151 onFilterMessage(message.action, message.args[0]); |
1147 break; | 1152 break; |
1148 case "prefs.respond": | 1153 case "prefs.respond": |
1149 onPrefMessage(message.action, message.args[0], false); | 1154 onPrefMessage(message.action, message.args[0], false); |
1150 break; | 1155 break; |
1151 case "subscriptions.respond": | 1156 case "subscriptions.respond": |
1152 onSubscriptionMessage(message.action, message.args[0]); | 1157 onSubscriptionMessage(message.action, message.args[0]); |
1153 break; | 1158 break; |
1154 } | 1159 } |
1155 }); | 1160 }); |
1156 | 1161 |
1157 ext.backgroundPage.sendMessage( | 1162 ext.backgroundPage.sendMessage( |
1158 { | 1163 { |
1159 type: "app.listen", | 1164 type: "app.listen", |
1160 filter: ["addSubscription"] | 1165 filter: ["addSubscription", "focusSection"] |
1161 }); | 1166 }); |
1162 ext.backgroundPage.sendMessage( | 1167 ext.backgroundPage.sendMessage( |
1163 { | 1168 { |
1164 type: "filters.listen", | 1169 type: "filters.listen", |
1165 filter: ["added", "loaded", "removed"] | 1170 filter: ["added", "loaded", "removed"] |
1166 }); | 1171 }); |
1167 ext.backgroundPage.sendMessage( | 1172 ext.backgroundPage.sendMessage( |
1168 { | 1173 { |
1169 type: "prefs.listen", | 1174 type: "prefs.listen", |
1170 filter: ["notifications_ignoredcategories", "notifications_showui", | 1175 filter: ["notifications_ignoredcategories", "notifications_showui", |
1171 "safari_contentblocker", "show_devtools_panel", | 1176 "safari_contentblocker", "show_devtools_panel", |
1172 "shouldShowBlockElementMenu"] | 1177 "shouldShowBlockElementMenu"] |
1173 }); | 1178 }); |
1174 ext.backgroundPage.sendMessage( | 1179 ext.backgroundPage.sendMessage( |
1175 { | 1180 { |
1176 type: "subscriptions.listen", | 1181 type: "subscriptions.listen", |
1177 filter: ["added", "disabled", "homepage", "lastDownload", "removed", | 1182 filter: ["added", "disabled", "homepage", "lastDownload", "removed", |
1178 "title"] | 1183 "title"] |
1179 }); | 1184 }); |
1180 | 1185 |
1181 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 1186 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); |
1182 })(); | 1187 })(); |
OLD | NEW |