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

Unified Diff: options.js

Issue 29339654: Issue 3915 - Properly handle special subscriptions (Closed)
Patch Set: Created April 12, 2016, 12:20 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: options.js
diff --git a/options.js b/options.js
index 2d01e713331036259ac4423439a4b31d600d6e64..b5656b0ad0f0d363be84bad1d9690eeb68e88056 100644
--- a/options.js
+++ b/options.js
@@ -192,6 +192,21 @@ function loadOptions()
}
$(loadOptions);
+function convertSpecialSubscription(subscription)
+{
+ getFilters(subscription.url, function(filters)
+ {
+ for (var j = 0; j < filters.length; j++)
+ {
+ var filter = filters[j].text;
+ if (whitelistedDomainRegexp.test(filter))
+ appendToListBox("excludedDomainsBox", RegExp.$1);
Sebastian Noack 2016/04/12 12:26:06 RegExp.$* is deprecated. However, since this is co
kzar 2016/04/12 12:31:49 I would rather not mess with it. (Note this is not
Sebastian Noack 2016/04/12 12:43:21 I know that the logic here isn't new. But this wou
+ else
+ appendToListBox("userFiltersBox", filter);
+ }
+ });
+}
+
// Reloads the displayed subscriptions and filters
function reloadFilters()
{
@@ -219,17 +234,7 @@ function reloadFilters()
clearListBox("excludedDomainsBox");
for (var i = 0; i < subscriptions.length; i++)
- getFilters(subscriptions[i].url, function(filters)
- {
- for (var j = 0; j < filters.length; j++)
- {
- var filter = filters[j].text;
- if (whitelistedDomainRegexp.test(filter))
- appendToListBox("excludedDomainsBox", RegExp.$1);
- else
- appendToListBox("userFiltersBox", filter);
- }
- });
+ convertSpecialSubscription(subscriptions[i]);
});
}
@@ -469,7 +474,9 @@ function onSubscriptionMessage(action, subscription)
updateSubscriptionInfo(element, subscription);
break;
case "added":
- if (subscription.url == acceptableAdsUrl)
+ if (subscription.special)
Sebastian Noack 2016/04/12 12:26:06 If we add this property it should be isSpecial.
kzar 2016/04/12 12:31:49 I disagree as this way it's consistent with the `s
Sebastian Noack 2016/04/12 12:43:21 What does have the semantics of query parameters h
kzar 2016/04/13 08:15:13 Fair enough, I renamed these in the new review.
+ convertSpecialSubscription(subscription);
+ else if (subscription.url == acceptableAdsUrl)
$("#acceptableAds").prop("checked", true);
else if (!element)
addSubscriptionEntry(subscription);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld