Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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", callback); | 924 getPref("subscriptions_exceptionsurl", function(value) |
Sebastian Noack
2016/04/06 17:38:29
Please ignore this change. It's not part of the pa
| |
925 { | |
926 getAcceptableAdsURL = function(callback) | |
927 { | |
928 callback(value); | |
929 }; | |
930 getAcceptableAdsURL(callback); | |
931 }); | |
925 } | 932 } |
926 | 933 |
927 function addEnableSubscription(url, title, homepage) | 934 function addEnableSubscription(url, title, homepage) |
928 { | 935 { |
929 var messageType = null; | 936 var messageType = null; |
930 var knownSubscription = subscriptionsMap[url]; | 937 var knownSubscription = subscriptionsMap[url]; |
931 if (knownSubscription && knownSubscription.disabled == true) | 938 if (knownSubscription && knownSubscription.disabled == true) |
932 messageType = "subscriptions.toggle" | 939 messageType = "subscriptions.toggle" |
933 else | 940 else |
934 messageType = "subscriptions.add" | 941 messageType = "subscriptions.add" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1128 case "app.respond": | 1135 case "app.respond": |
1129 switch (message.action) | 1136 switch (message.action) |
1130 { | 1137 { |
1131 case "addSubscription": | 1138 case "addSubscription": |
1132 var subscription = message.args[0]; | 1139 var subscription = message.args[0]; |
1133 var dialog = E("dialog-content-predefined"); | 1140 var dialog = E("dialog-content-predefined"); |
1134 dialog.querySelector("h3").textContent = subscription.title || ""; | 1141 dialog.querySelector("h3").textContent = subscription.title || ""; |
1135 dialog.querySelector(".url").textContent = subscription.url; | 1142 dialog.querySelector(".url").textContent = subscription.url; |
1136 openDialog("predefined"); | 1143 openDialog("predefined"); |
1137 break; | 1144 break; |
1138 case "switchToOptionsSection": | 1145 case "focusSection": |
Thomas Greiner
2016/04/04 12:46:36
Detail: Is this specific to the options page? We c
Sebastian Noack
2016/04/05 13:32:02
Fine with me using a more generic name that doesn'
Thomas Greiner
2016/04/06 12:49:12
I'd suggest "focusSection" to no limit ourselves t
Sebastian Noack
2016/04/06 17:38:29
Done.
| |
1139 document.body.setAttribute("data-tab", message.args[0]); | 1146 document.body.setAttribute("data-tab", message.args[0]); |
1140 break; | 1147 break; |
1141 } | 1148 } |
1142 break; | 1149 break; |
1143 case "filters.respond": | 1150 case "filters.respond": |
1144 onFilterMessage(message.action, message.args[0]); | 1151 onFilterMessage(message.action, message.args[0]); |
1145 break; | 1152 break; |
1146 case "prefs.respond": | 1153 case "prefs.respond": |
1147 onPrefMessage(message.action, message.args[0], false); | 1154 onPrefMessage(message.action, message.args[0], false); |
1148 break; | 1155 break; |
1149 case "subscriptions.respond": | 1156 case "subscriptions.respond": |
1150 onSubscriptionMessage(message.action, message.args[0]); | 1157 onSubscriptionMessage(message.action, message.args[0]); |
1151 break; | 1158 break; |
1152 } | 1159 } |
1153 }); | 1160 }); |
1154 | 1161 |
1155 ext.backgroundPage.sendMessage( | 1162 ext.backgroundPage.sendMessage( |
1156 { | 1163 { |
1157 type: "app.listen", | 1164 type: "app.listen", |
1158 filter: ["addSubscription", "switchToOptionsSection"] | 1165 filter: ["addSubscription", "focusSection"] |
1159 }); | 1166 }); |
1160 ext.backgroundPage.sendMessage( | 1167 ext.backgroundPage.sendMessage( |
1161 { | 1168 { |
1162 type: "filters.listen", | 1169 type: "filters.listen", |
1163 filter: ["added", "loaded", "removed"] | 1170 filter: ["added", "loaded", "removed"] |
1164 }); | 1171 }); |
1165 ext.backgroundPage.sendMessage( | 1172 ext.backgroundPage.sendMessage( |
1166 { | 1173 { |
1167 type: "prefs.listen", | 1174 type: "prefs.listen", |
1168 filter: ["notifications_ignoredcategories", "notifications_showui", | 1175 filter: ["notifications_ignoredcategories", "notifications_showui", |
1169 "safari_contentblocker", "show_devtools_panel", | 1176 "safari_contentblocker", "show_devtools_panel", |
1170 "shouldShowBlockElementMenu"] | 1177 "shouldShowBlockElementMenu"] |
1171 }); | 1178 }); |
1172 ext.backgroundPage.sendMessage( | 1179 ext.backgroundPage.sendMessage( |
1173 { | 1180 { |
1174 type: "subscriptions.listen", | 1181 type: "subscriptions.listen", |
1175 filter: ["added", "disabled", "homepage", "lastDownload", "removed", | 1182 filter: ["added", "disabled", "homepage", "lastDownload", "removed", |
1176 "title"] | 1183 "title"] |
1177 }); | 1184 }); |
1178 | 1185 |
1179 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 1186 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); |
1180 })(); | 1187 })(); |
LEFT | RIGHT |