Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: options.js

Issue 29479615: Issue 4978 - Read special subscription filters directly in options page (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Update adblockplusui dependency Created July 5, 2017, 12:02 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dependencies ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: options.js
===================================================================
--- a/options.js
+++ b/options.js
@@ -64,17 +64,16 @@
const addSubscription = wrapper({type: "subscriptions.add"},
"url", "title", "homepage");
const toggleSubscription = wrapper({type: "subscriptions.toggle"},
"url", "keepInstalled");
const updateSubscription = wrapper({type: "subscriptions.update"}, "url");
const importRawFilters = wrapper({type: "filters.importRaw"},
"text", "removeExisting");
const addFilter = wrapper({type: "filters.add"}, "text");
-const getFilters = wrapper({type: "filters.get"}, "subscriptionUrl");
const removeFilter = wrapper({type: "filters.remove"}, "text");
const whitelistedDomainRegexp = /^@@\|\|([^/:]+)\^\$document$/;
const statusMessages = new Map([
["synchronize_invalid_url",
"filters_subscription_lastDownload_invalidURL"],
["synchronize_connection_error",
"filters_subscription_lastDownload_connectionError"],
@@ -182,26 +181,23 @@
// Show user's filters
reloadFilters();
}
$(loadOptions);
function convertSpecialSubscription(subscription)
{
- getFilters(subscription.url, filters =>
+ for (let filter of subscription.filters)
{
- for (let filter of filters)
- {
- if (whitelistedDomainRegexp.test(filter.text))
- appendToListBox("excludedDomainsBox", RegExp.$1);
- else
- appendToListBox("userFiltersBox", filter.text);
- }
- });
+ if (whitelistedDomainRegexp.test(filter.text))
+ appendToListBox("excludedDomainsBox", RegExp.$1);
+ else
+ appendToListBox("userFiltersBox", filter.text);
+ }
}
// Reloads the displayed subscriptions and filters
function reloadFilters()
{
// Load user filter URLs
let container = document.getElementById("filterLists");
while (container.lastChild)
« no previous file with comments | « dependencies ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld