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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 "use strict"; | 18 "use strict"; |
19 | 19 |
20 (function() | 20 (function() |
21 { | 21 { |
22 var subscriptionsMap = Object.create(null); | 22 var subscriptionsMap = Object.create(null); |
23 var recommendationsMap = Object.create(null); | 23 var recommendationsMap = Object.create(null); |
24 var filtersMap = Object.create(null); | 24 var filtersMap = Object.create(null); |
25 var collections = Object.create(null); | 25 var collections = Object.create(null); |
26 var acceptableAdsUrl = null; | |
26 var maxLabelId = 0; | 27 var maxLabelId = 0; |
27 var getMessage = ext.i18n.getMessage; | 28 var getMessage = ext.i18n.getMessage; |
28 var filterErrors = | 29 var filterErrors = |
29 { | 30 { |
30 "synchronize_invalid_url": "options_filterList_lastDownload_invalidURL", | 31 "synchronize_invalid_url": "options_filterList_lastDownload_invalidURL", |
31 "synchronize_connection_error": "options_filterList_lastDownload_connectionE rror", | 32 "synchronize_connection_error": "options_filterList_lastDownload_connectionE rror", |
32 "synchronize_invalid_data": "options_filterList_lastDownload_invalidData", | 33 "synchronize_invalid_data": "options_filterList_lastDownload_invalidData", |
33 "synchronize_checksum_mismatch": "options_filterList_lastDownload_checksumMi smatch" | 34 "synchronize_checksum_mismatch": "options_filterList_lastDownload_checksumMi smatch" |
34 }; | 35 }; |
35 | 36 |
(...skipping 17 matching lines...) Expand all Loading... | |
53 table.removeChild(placeholder); | 54 table.removeChild(placeholder); |
54 } | 55 } |
55 | 56 |
56 Collection.prototype._createElementQuery = function(item) | 57 Collection.prototype._createElementQuery = function(item) |
57 { | 58 { |
58 var access = (item.url || item.text).replace(/'/g, "\\'"); | 59 var access = (item.url || item.text).replace(/'/g, "\\'"); |
59 return function(container) | 60 return function(container) |
60 { | 61 { |
61 return container.querySelector("[data-access='" + access + "']"); | 62 return container.querySelector("[data-access='" + access + "']"); |
62 }; | 63 }; |
63 }; | |
64 | |
65 Collection.prototype._isControlDisabled = function(item, i) | |
66 { | |
67 return item.disableable == false && | |
68 this.details[i].onClick == toggleDisableSubscription; | |
69 }; | 64 }; |
70 | 65 |
71 Collection.prototype._getItemTitle = function(item, i) | 66 Collection.prototype._getItemTitle = function(item, i) |
72 { | 67 { |
73 var title = null; | 68 var title = null; |
74 if (this.details[i].useOriginalTitle) | 69 if (this.details[i].useOriginalTitle) |
75 title = item.originalTitle; | 70 title = item.originalTitle; |
76 if (!title) | 71 if (!title) |
77 title = item.title || item.url || item.text; | 72 title = item.title || item.url || item.text; |
78 return title; | 73 return title; |
79 }; | 74 }; |
80 | 75 |
81 Collection.prototype.addItems = function() | 76 Collection.prototype.addItems = function() |
82 { | 77 { |
83 var length = Array.prototype.push.apply(this.items, arguments); | 78 var length = Array.prototype.push.apply(this.items, arguments); |
84 if (length == 0) | 79 if (length == 0) |
85 return; | 80 return; |
86 | 81 |
87 this.items.sort(function(a, b) | 82 this.items.sort(function(a, b) |
88 { | 83 { |
89 var aDisabled = this._isControlDisabled(a, 0); | 84 // Make sure that Acceptable Ads is always last, since it cannot be |
Sebastian Noack
2016/04/01 18:26:43
This makes sure that items with disabled checkboxe
| |
90 var bDisabled = this._isControlDisabled(b, 0); | 85 // disabled, but only be removed. That way it's grouped together with |
91 if (aDisabled != bDisabled) | 86 // the "Own filter list" which cannot be disabled either at the bottom |
92 return aDisabled - bDisabled; | 87 // of the filter lists in the Advanced tab. |
88 if (a.url == acceptableAdsUrl) | |
89 return 1; | |
90 if (b.url == acceptableAdsUrl) | |
91 return -1; | |
93 | 92 |
94 var aTitle = this._getItemTitle(a, 0).toLowerCase(); | 93 var aTitle = this._getItemTitle(a, 0).toLowerCase(); |
Sebastian Noack
2016/04/01 18:26:43
This was missed on the previous review, where we s
| |
95 var bTitle = this._getItemTitle(b, 0).toLowerCase(); | 94 var bTitle = this._getItemTitle(b, 0).toLowerCase(); |
96 return aTitle.localeCompare(bTitle); | 95 return aTitle.localeCompare(bTitle); |
97 }.bind(this)); | 96 }.bind(this)); |
98 | 97 |
99 for (var j = 0; j < this.details.length; j++) | 98 for (var j = 0; j < this.details.length; j++) |
100 { | 99 { |
101 var table = E(this.details[j].id); | 100 var table = E(this.details[j].id); |
102 var template = table.querySelector("template"); | 101 var template = table.querySelector("template"); |
103 for (var i = 0; i < arguments.length; i++) | 102 for (var i = 0; i < arguments.length; i++) |
104 { | 103 { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 continue; | 189 continue; |
191 | 190 |
192 var title = this._getItemTitle(item, i); | 191 var title = this._getItemTitle(item, i); |
193 element.querySelector(".display").textContent = title; | 192 element.querySelector(".display").textContent = title; |
194 if (title) | 193 if (title) |
195 element.setAttribute("data-search", title.toLowerCase()); | 194 element.setAttribute("data-search", title.toLowerCase()); |
196 var control = element.querySelector(".control[role='checkbox']"); | 195 var control = element.querySelector(".control[role='checkbox']"); |
197 if (control) | 196 if (control) |
198 { | 197 { |
199 control.setAttribute("aria-checked", item.disabled == false); | 198 control.setAttribute("aria-checked", item.disabled == false); |
200 if (this._isControlDisabled(item, i)) | 199 if (item.url == acceptableAdsUrl && this.details[i].onClick == |
200 toggleDisableSubscription) | |
201 control.setAttribute("disabled", true); | 201 control.setAttribute("disabled", true); |
202 } | 202 } |
203 | 203 |
204 var downloadStatus = item.downloadStatus; | |
205 var dateElement = element.querySelector(".date"); | 204 var dateElement = element.querySelector(".date"); |
206 var timeElement = element.querySelector(".time"); | 205 var timeElement = element.querySelector(".time"); |
207 if(dateElement && timeElement) | 206 if (dateElement && timeElement) |
208 { | 207 { |
209 var message = element.querySelector(".message"); | 208 var message = element.querySelector(".message"); |
210 ext.backgroundPage.sendMessage( | 209 if (item.isDownloading) |
211 { | 210 { |
212 type: "subscriptions.isDownloading", | 211 var text = getMessage("options_filterList_lastDownload_inProgress"); |
213 url: item.url | 212 message.textContent = text; |
214 }, | 213 element.classList.add("show-message"); |
215 function(isDownloading) | 214 } |
216 { | 215 else if (item.downloadStatus != "synchronize_ok") |
217 if (isDownloading) | 216 { |
218 { | 217 var error = filterErrors[item.downloadStatus]; |
219 var text = getMessage("options_filterList_lastDownload_inProgress"); | 218 if (error) |
220 message.textContent = text; | 219 message.textContent = getMessage(error); |
221 element.classList.add("show-message"); | 220 else |
222 } | 221 message.textContent = item.downloadStatus; |
223 else if (downloadStatus && downloadStatus != "synchronize_ok") | 222 element.classList.add("show-message"); |
224 { | 223 } |
225 if (downloadStatus in filterErrors) | 224 else if (item.lastDownload > 0) |
226 message.textContent = getMessage(filterErrors[downloadStatus]); | 225 { |
227 else | 226 var dateTime = i18n_formatDateTime(item.lastDownload * 1000); |
228 message.textContent = item.downloadStatus; | 227 dateElement.textContent = dateTime[0]; |
229 element.classList.add("show-message"); | 228 timeElement.textContent = dateTime[1]; |
230 } | 229 element.classList.remove("show-message"); |
231 else if (item.lastDownload > 0) | 230 } |
232 { | 231 } |
233 var dateTime = i18n_formatDateTime(item.lastDownload * 1000); | 232 |
234 dateElement.textContent = dateTime[0]; | |
235 timeElement.textContent = dateTime[1]; | |
236 element.classList.remove("show-message"); | |
237 } | |
238 }); | |
239 } | |
240 var websiteElement = element.querySelector(".context-menu .website"); | 233 var websiteElement = element.querySelector(".context-menu .website"); |
241 var sourceElement = element.querySelector(".context-menu .source"); | 234 var sourceElement = element.querySelector(".context-menu .source"); |
242 if (websiteElement && item.homepage) | 235 if (websiteElement && item.homepage) |
243 websiteElement.setAttribute("href", item.homepage); | 236 websiteElement.setAttribute("href", item.homepage); |
244 if (sourceElement) | 237 if (sourceElement) |
245 sourceElement.setAttribute("href", item.url); | 238 sourceElement.setAttribute("href", item.url); |
246 } | 239 } |
247 }; | 240 }; |
248 | 241 |
249 Collection.prototype.clearAll = function() | 242 Collection.prototype.clearAll = function() |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
404 collections.allLangs.removeItem(subscription); | 397 collections.allLangs.removeItem(subscription); |
405 collections.langs.addItems(subscription); | 398 collections.langs.addItems(subscription); |
406 } | 399 } |
407 else | 400 else |
408 { | 401 { |
409 collections.allLangs.addItems(subscription); | 402 collections.allLangs.addItems(subscription); |
410 collections.langs.removeItem(subscription); | 403 collections.langs.removeItem(subscription); |
411 } | 404 } |
412 } | 405 } |
413 } | 406 } |
414 for (var i in collections) | 407 } |
415 collections[i].updateItem(subscription); | 408 |
416 } | 409 for (var name in collections) |
410 collections[name].updateItem(subscription); | |
417 } | 411 } |
418 | 412 |
419 if (!Object.observe) | 413 if (!Object.observe) |
420 { | 414 { |
421 ["disabled", "lastDownload"].forEach(function(property) | 415 Object.keys(subscription).forEach(function(property) |
422 { | 416 { |
423 subscription["$" + property] = subscription[property]; | 417 var value = subscription[property]; |
424 Object.defineProperty(subscription, property, | 418 Object.defineProperty(subscription, property, |
425 { | 419 { |
426 get: function() | 420 get: function() |
427 { | 421 { |
428 return this["$" + property]; | 422 return value; |
429 }, | 423 }, |
430 set: function(newValue) | 424 set: function(newValue) |
431 { | 425 { |
432 var oldValue = this["$" + property]; | 426 if (value != newValue) |
433 if (oldValue != newValue) | |
434 { | 427 { |
435 this["$" + property] = newValue; | 428 value = newValue; |
436 var change = Object.create(null); | 429 onObjectChanged([{name: property}]); |
437 change.name = property; | |
438 onObjectChanged([change]); | |
439 } | 430 } |
440 } | 431 } |
441 }); | 432 }); |
442 }); | 433 }); |
443 } | 434 } |
444 else | 435 else |
445 { | 436 { |
446 Object.observe(subscription, onObjectChanged); | 437 Object.observe(subscription, onObjectChanged); |
447 } | 438 } |
448 } | 439 } |
449 | 440 |
450 function updateSubscription(subscription) | 441 function updateSubscription(subscription) |
451 { | 442 { |
452 var subscriptionUrl = subscription.url; | 443 var subscriptionUrl = subscription.url; |
453 var knownSubscription = subscriptionsMap[subscriptionUrl]; | 444 var knownSubscription = subscriptionsMap[subscriptionUrl]; |
454 if (knownSubscription) | 445 if (knownSubscription) |
455 { | 446 { |
456 for (var property in subscription) | 447 for (var property in subscription) |
457 if (property != "title") | 448 { |
449 if (property == "title" && subscriptionUrl in recommendationsMap) | |
450 knownSubscription.originalTitle = subscription.title; | |
451 else | |
458 knownSubscription[property] = subscription[property]; | 452 knownSubscription[property] = subscription[property]; |
453 } | |
459 } | 454 } |
460 else | 455 else |
461 { | 456 { |
462 observeSubscription(subscription); | 457 observeSubscription(subscription); |
463 getAcceptableAdsURL(function(acceptableAdsUrl) | 458 |
464 { | 459 var collection; |
465 var collection = null; | 460 if (subscriptionUrl in recommendationsMap) |
466 if (subscriptionUrl in recommendationsMap) | 461 { |
467 { | 462 var recommendation = recommendationsMap[subscriptionUrl]; |
468 var recommendation = recommendationsMap[subscriptionUrl]; | 463 if (recommendation.type != "ads") |
469 if (recommendation.type != "ads") | 464 collection = collections.popular; |
470 collection = collections.popular; | 465 else if (subscription.disabled == false) |
471 else if (subscription.disabled == false) | 466 collection = collections.langs; |
472 collection = collections.langs; | |
473 else | |
474 collection = collections.allLangs; | |
475 } | |
476 else if (subscriptionUrl == acceptableAdsUrl) | |
477 { | |
478 collection = collections.acceptableAds; | |
479 subscription.disableable = false; | |
480 } | |
481 else | 467 else |
482 collection = collections.custom; | 468 collection = collections.allLangs; |
483 | 469 } |
484 collection.addItems(subscription); | 470 else if (subscriptionUrl == acceptableAdsUrl) |
485 subscriptionsMap[subscriptionUrl] = subscription; | 471 collection = collections.acceptableAds; |
486 }); | 472 else |
473 collection = collections.custom; | |
474 | |
475 collection.addItems(subscription); | |
476 subscriptionsMap[subscriptionUrl] = subscription; | |
487 } | 477 } |
488 } | 478 } |
489 | 479 |
490 function updateFilter(filter) | 480 function updateFilter(filter) |
491 { | 481 { |
492 var match = filter.text.match(/^@@\|\|([^\/:]+)\^\$document$/); | 482 var match = filter.text.match(/^@@\|\|([^\/:]+)\^\$document$/); |
493 if (match && !filtersMap[filter.text]) | 483 if (match && !filtersMap[filter.text]) |
494 { | 484 { |
495 filter.title = match[1]; | 485 filter.title = match[1]; |
496 collections.whitelist.addItems(filter); | 486 collections.whitelist.addItems(filter); |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
865 subscriptionUrl: subscriptions[i].url | 855 subscriptionUrl: subscriptions[i].url |
866 }, | 856 }, |
867 function(filters) | 857 function(filters) |
868 { | 858 { |
869 for (var i = 0; i < filters.length; i++) | 859 for (var i = 0; i < filters.length; i++) |
870 updateFilter(filters[i]); | 860 updateFilter(filters[i]); |
871 }); | 861 }); |
872 } | 862 } |
873 }); | 863 }); |
874 loadRecommendations(); | 864 loadRecommendations(); |
875 getAcceptableAdsURL(function(acceptableAdsUrl) | 865 ext.backgroundPage.sendMessage( |
876 { | 866 { |
877 var subscription = Object.create(null); | 867 type: "prefs.get", |
878 subscription.url = acceptableAdsUrl; | 868 key: "subscriptions_exceptionsurl" |
879 subscription.disabled = true; | 869 }, |
880 subscription.title = getMessage("options_acceptableAds_description"); | 870 function(url) |
881 updateSubscription(subscription); | 871 { |
872 acceptableAdsUrl = url; | |
873 updateSubscription({ | |
874 url: acceptableAdsUrl, | |
875 disabled: true, | |
876 title: getMessage("options_acceptableAds_description") | |
877 }); | |
882 | 878 |
883 // Load user subscriptions | 879 // Load user subscriptions |
884 ext.backgroundPage.sendMessage( | 880 ext.backgroundPage.sendMessage( |
885 { | 881 { |
886 type: "subscriptions.get", | 882 type: "subscriptions.get", |
887 downloadable: true | 883 downloadable: true |
888 }, | 884 }, |
889 function(subscriptions) | 885 function(subscriptions) |
890 { | 886 { |
891 for (var i = 0; i < subscriptions.length; i++) | 887 for (var i = 0; i < subscriptions.length; i++) |
(...skipping 18 matching lines...) Expand all Loading... | |
910 document.querySelector("#whitelisting .controls").classList.remove("mode-edi t"); | 906 document.querySelector("#whitelisting .controls").classList.remove("mode-edi t"); |
911 } | 907 } |
912 | 908 |
913 function editCustomFilters() | 909 function editCustomFilters() |
914 { | 910 { |
915 var customFilterItems = collections.customFilters.items; | 911 var customFilterItems = collections.customFilters.items; |
916 var filterTexts = []; | 912 var filterTexts = []; |
917 for (var i = 0; i < customFilterItems.length; i++) | 913 for (var i = 0; i < customFilterItems.length; i++) |
918 filterTexts.push(customFilterItems[i].text); | 914 filterTexts.push(customFilterItems[i].text); |
919 E("custom-filters-raw").value = filterTexts.join("\n"); | 915 E("custom-filters-raw").value = filterTexts.join("\n"); |
920 } | |
921 | |
922 function getAcceptableAdsURL(callback) | |
923 { | |
924 getPref("subscriptions_exceptionsurl", callback); | |
925 } | 916 } |
926 | 917 |
927 function addEnableSubscription(url, title, homepage) | 918 function addEnableSubscription(url, title, homepage) |
928 { | 919 { |
929 var messageType = null; | 920 var messageType = null; |
930 var knownSubscription = subscriptionsMap[url]; | 921 var knownSubscription = subscriptionsMap[url]; |
931 if (knownSubscription && knownSubscription.disabled == true) | 922 if (knownSubscription && knownSubscription.disabled == true) |
932 messageType = "subscriptions.toggle" | 923 messageType = "subscriptions.toggle" |
933 else | 924 else |
934 messageType = "subscriptions.add" | 925 messageType = "subscriptions.add" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
977 var knownSubscription = subscriptionsMap[subscription.url]; | 968 var knownSubscription = subscriptionsMap[subscription.url]; |
978 if (knownSubscription) | 969 if (knownSubscription) |
979 collections.filterLists.addItems(knownSubscription); | 970 collections.filterLists.addItems(knownSubscription); |
980 else | 971 else |
981 collections.filterLists.addItems(subscription); | 972 collections.filterLists.addItems(subscription); |
982 break; | 973 break; |
983 case "disabled": | 974 case "disabled": |
984 updateSubscription(subscription); | 975 updateSubscription(subscription); |
985 updateShareLink(); | 976 updateShareLink(); |
986 break; | 977 break; |
987 case "lastDownload": | |
988 updateSubscription(subscription); | |
989 break; | |
990 case "homepage": | |
991 // TODO: NYI | |
992 break; | |
993 case "removed": | 978 case "removed": |
994 var knownSubscription = subscriptionsMap[subscription.url]; | 979 var knownSubscription = subscriptionsMap[subscription.url]; |
995 getAcceptableAdsURL(function(acceptableAdsUrl) | 980 if (subscription.url == acceptableAdsUrl) |
996 { | 981 { |
997 if (subscription.url == acceptableAdsUrl) | 982 subscription.disabled = true; |
998 { | 983 updateSubscription(subscription); |
999 subscription.disabled = true; | 984 } |
1000 updateSubscription(subscription); | 985 else |
986 { | |
987 if (subscription.url in recommendationsMap) | |
988 knownSubscription.disabled = true; | |
989 else | |
990 { | |
991 collections.custom.removeItem(knownSubscription); | |
992 delete subscriptionsMap[subscription.url]; | |
1001 } | 993 } |
1002 else | 994 } |
1003 { | 995 updateShareLink(); |
1004 if (subscription.url in recommendationsMap) | 996 collections.filterLists.removeItem(knownSubscription); |
1005 knownSubscription.disabled = true; | 997 break; |
1006 else | 998 default: |
1007 { | 999 updateSubscription(subscription); |
1008 collections.custom.removeItem(knownSubscription); | |
1009 delete subscriptionsMap[subscription.url]; | |
1010 } | |
1011 } | |
1012 updateShareLink(); | |
1013 collections.filterLists.removeItem(knownSubscription); | |
1014 }); | |
1015 break; | |
1016 case "title": | |
1017 // TODO: NYI | |
1018 break; | 1000 break; |
1019 } | 1001 } |
1020 } | 1002 } |
1021 | 1003 |
1022 function hidePref(key, value) | 1004 function hidePref(key, value) |
1023 { | 1005 { |
1024 var element = document.querySelector("[data-pref='" + key + "']"); | 1006 var element = document.querySelector("[data-pref='" + key + "']"); |
1025 if (element) | 1007 if (element) |
1026 element.setAttribute("aria-hidden", value); | 1008 element.setAttribute("aria-hidden", value); |
1027 } | 1009 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1119 | 1101 |
1120 for (var i = 0; i < shareResources.length; i++) | 1102 for (var i = 0; i < shareResources.length; i++) |
1121 checkShareResource(shareResources[i], onResult); | 1103 checkShareResource(shareResources[i], onResult); |
1122 } | 1104 } |
1123 | 1105 |
1124 ext.onMessage.addListener(function(message) | 1106 ext.onMessage.addListener(function(message) |
1125 { | 1107 { |
1126 switch (message.type) | 1108 switch (message.type) |
1127 { | 1109 { |
1128 case "app.respond": | 1110 case "app.respond": |
1129 if (message.action == "addSubscription") | 1111 switch (message.action) |
1130 { | 1112 { |
1131 var subscription = message.args[0]; | 1113 case "addSubscription": |
1132 var dialog = E("dialog-content-predefined"); | 1114 var subscription = message.args[0]; |
1133 dialog.querySelector("h3").textContent = subscription.title || ""; | 1115 var dialog = E("dialog-content-predefined"); |
1134 dialog.querySelector(".url").textContent = subscription.url; | 1116 dialog.querySelector("h3").textContent = subscription.title || ""; |
1135 openDialog("predefined"); | 1117 dialog.querySelector(".url").textContent = subscription.url; |
1118 openDialog("predefined"); | |
1119 break; | |
1120 case "focusSection": | |
1121 document.body.setAttribute("data-tab", message.args[0]); | |
1122 break; | |
1136 } | 1123 } |
1137 break; | 1124 break; |
1138 case "filters.respond": | 1125 case "filters.respond": |
1139 onFilterMessage(message.action, message.args[0]); | 1126 onFilterMessage(message.action, message.args[0]); |
1140 break; | 1127 break; |
1141 case "prefs.respond": | 1128 case "prefs.respond": |
1142 onPrefMessage(message.action, message.args[0], false); | 1129 onPrefMessage(message.action, message.args[0], false); |
1143 break; | 1130 break; |
1144 case "subscriptions.respond": | 1131 case "subscriptions.respond": |
1145 onSubscriptionMessage(message.action, message.args[0]); | 1132 onSubscriptionMessage(message.action, message.args[0]); |
1146 break; | 1133 break; |
1147 } | 1134 } |
1148 }); | 1135 }); |
1149 | 1136 |
1150 ext.backgroundPage.sendMessage( | 1137 ext.backgroundPage.sendMessage( |
1151 { | 1138 { |
1152 type: "app.listen", | 1139 type: "app.listen", |
1153 filter: ["addSubscription"] | 1140 filter: ["addSubscription", "focusSection"] |
1154 }); | 1141 }); |
1155 ext.backgroundPage.sendMessage( | 1142 ext.backgroundPage.sendMessage( |
1156 { | 1143 { |
1157 type: "filters.listen", | 1144 type: "filters.listen", |
1158 filter: ["added", "loaded", "removed"] | 1145 filter: ["added", "loaded", "removed"] |
1159 }); | 1146 }); |
1160 ext.backgroundPage.sendMessage( | 1147 ext.backgroundPage.sendMessage( |
1161 { | 1148 { |
1162 type: "prefs.listen", | 1149 type: "prefs.listen", |
1163 filter: ["notifications_ignoredcategories", "notifications_showui", | 1150 filter: ["notifications_ignoredcategories", "notifications_showui", |
1164 "safari_contentblocker", "show_devtools_panel", | 1151 "safari_contentblocker", "show_devtools_panel", |
1165 "shouldShowBlockElementMenu"] | 1152 "shouldShowBlockElementMenu"] |
1166 }); | 1153 }); |
1167 ext.backgroundPage.sendMessage( | 1154 ext.backgroundPage.sendMessage( |
1168 { | 1155 { |
1169 type: "subscriptions.listen", | 1156 type: "subscriptions.listen", |
1170 filter: ["added", "disabled", "homepage", "lastDownload", "removed", | 1157 filter: ["added", "disabled", "homepage", "lastDownload", "removed", |
1171 "title"] | 1158 "title", "downloadStatus", "downloading"] |
1172 }); | 1159 }); |
1173 | 1160 |
1174 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 1161 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); |
1175 })(); | 1162 })(); |
LEFT | RIGHT |