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

Unified Diff: options.js

Issue 29339717: Issue 3915 - Properly handle special subscriptions (Closed)
Patch Set: Created April 14, 2016, 9:52 a.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..3055baa441154856edac4c5b9f556150d27fbb6c 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);
+ 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.url.indexOf("~user") == 0)
kzar 2016/04/14 09:55:22 I decided to go with your approach in the end, rat
+ 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