| Index: options.js |
| =================================================================== |
| --- a/options.js |
| +++ b/options.js |
| @@ -747,6 +747,16 @@ |
| focusedBeforeDialog.focus(); |
| } |
| + function toggleUserLists(e) |
| + { |
| + e.preventDefault(); |
| + ext.backgroundPage.sendMessage( |
| + { |
| + type: "app.userSubscriptionsToggle", |
| + state: e.target.getAttribute("aria-checked") == "true" |
| + }); |
| + } |
| + |
| function populateLists() |
| { |
| subscriptionsMap = Object.create(null); |
| @@ -757,6 +767,8 @@ |
| for (var property in collections) |
| collections[property].clearAll(); |
| + var userListsControl = document.querySelector("#user-filter-lists .control"); |
| + userListsControl.addEventListener("click", toggleUserLists, false); |
| ext.backgroundPage.sendMessage( |
| { |
| type: "subscriptions.get", |
| @@ -764,9 +776,12 @@ |
| }, |
| function(subscriptions) |
| { |
| + var specialEnabled = false; |
| // Load filters |
| for (var i = 0; i < subscriptions.length; i++) |
| { |
| + if (!specialEnabled) |
| + specialEnabled = !subscriptions[i].disabled; |
| ext.backgroundPage.sendMessage( |
| { |
| type: "filters.get", |
| @@ -778,6 +793,7 @@ |
| updateFilter(filters[i]); |
| }); |
| } |
| + userListsControl.setAttribute("aria-checked", specialEnabled); |
| }); |
| loadRecommendations(); |
| getAcceptableAdsURL(function(acceptableAdsUrl) |
| @@ -865,6 +881,27 @@ |
| ext.backgroundPage.sendMessage(message); |
| } |
| + function onAppMessage(action, args) |
| + { |
| + switch (action) |
| + { |
| + case "addSubscription": |
| + var subscription = args[0]; |
| + var dialog = E("dialog-content-predefined"); |
| + dialog.querySelector("h3").textContent = subscription.title || ""; |
| + dialog.querySelector(".url").textContent = subscription.url; |
| + openDialog("predefined"); |
| + break; |
| + case "error": |
| + alert(args.join("\n")); |
| + break; |
| + case "userSubscriptionsToggle": |
| + document.querySelector("#user-filter-lists .control"). |
| + setAttribute("aria-checked", !args[0]); |
| + break; |
| + } |
| + } |
| + |
| function onFilterMessage(action, filter) |
| { |
| switch (action) |
| @@ -985,18 +1022,7 @@ |
| switch (message.type) |
| { |
| case "app.listen": |
| - if (message.action == "addSubscription") |
| - { |
| - var subscription = message.args[0]; |
| - var dialog = E("dialog-content-predefined"); |
| - dialog.querySelector("h3").textContent = subscription.title || ""; |
| - dialog.querySelector(".url").textContent = subscription.url; |
| - openDialog("predefined"); |
| - } |
| - else if (message.action == "error") |
| - { |
| - alert(message.args.join("\n")); |
| - } |
| + onAppMessage(message.action, message.args); |
| break; |
| case "filters.listen": |
| onFilterMessage(message.action, message.args[0]); |
| @@ -1010,7 +1036,7 @@ |
| ext.backgroundPage.sendMessage( |
| { |
| type: "app.listen", |
| - filter: ["addSubscription", "error"] |
| + filter: ["addSubscription", "error", "userSubscriptionsToggle"] |
|
saroyanm
2016/02/26 11:31:22
It's bit inconsistent, but the chrome implementat
Thomas Greiner
2016/03/01 12:11:22
Yes, that feature will be added for Firefox. Howev
|
| }); |
| ext.backgroundPage.sendMessage( |
| { |