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

Delta Between Two Patch Sets: options.js

Issue 29458601: Issue 5315 - Add support for Microsoft Edge (Closed)
Left Patch Set: Rephrase the comment Created July 27, 2017, 10:07 a.m.
Right Patch Set: Cosmetic changes Created July 28, 2017, 11:02 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « metadata.edge ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 "downloadable", "special"); 62 "downloadable", "special");
63 const removeSubscription = wrapper({type: "subscriptions.remove"}, "url"); 63 const removeSubscription = wrapper({type: "subscriptions.remove"}, "url");
64 const addSubscription = wrapper({type: "subscriptions.add"}, 64 const addSubscription = wrapper({type: "subscriptions.add"},
65 "url", "title", "homepage"); 65 "url", "title", "homepage");
66 const toggleSubscription = wrapper({type: "subscriptions.toggle"}, 66 const toggleSubscription = wrapper({type: "subscriptions.toggle"},
67 "url", "keepInstalled"); 67 "url", "keepInstalled");
68 const updateSubscription = wrapper({type: "subscriptions.update"}, "url"); 68 const updateSubscription = wrapper({type: "subscriptions.update"}, "url");
69 const importRawFilters = wrapper({type: "filters.importRaw"}, 69 const importRawFilters = wrapper({type: "filters.importRaw"},
70 "text", "removeExisting"); 70 "text", "removeExisting");
71 const addFilter = wrapper({type: "filters.add"}, "text"); 71 const addFilter = wrapper({type: "filters.add"}, "text");
72 const getFilters = wrapper({type: "filters.get"}, "subscriptionUrl");
73 const removeFilter = wrapper({type: "filters.remove"}, "text"); 72 const removeFilter = wrapper({type: "filters.remove"}, "text");
74 const quoteCSS = wrapper({type: "composer.quoteCSS"}, "CSS"); 73 const quoteCSS = wrapper({type: "composer.quoteCSS"}, "CSS");
75 74
76 const whitelistedDomainRegexp = /^@@\|\|([^/:]+)\^\$document$/; 75 const whitelistedDomainRegexp = /^@@\|\|([^/:]+)\^\$document$/;
77 const statusMessages = new Map([ 76 const statusMessages = new Map([
78 ["synchronize_invalid_url", 77 ["synchronize_invalid_url",
79 "filters_subscription_lastDownload_invalidURL"], 78 "filters_subscription_lastDownload_invalidURL"],
80 ["synchronize_connection_error", 79 ["synchronize_connection_error",
81 "filters_subscription_lastDownload_connectionError"], 80 "filters_subscription_lastDownload_connectionError"],
82 ["synchronize_invalid_data", 81 ["synchronize_invalid_data",
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 // Load recommended subscriptions 180 // Load recommended subscriptions
182 loadRecommendations(); 181 loadRecommendations();
183 182
184 // Show user's filters 183 // Show user's filters
185 reloadFilters(); 184 reloadFilters();
186 } 185 }
187 $(loadOptions); 186 $(loadOptions);
188 187
189 function convertSpecialSubscription(subscription) 188 function convertSpecialSubscription(subscription)
190 { 189 {
191 getFilters(subscription.url, filters => 190 for (let filter of subscription.filters)
192 { 191 {
193 for (let filter of filters) 192 if (whitelistedDomainRegexp.test(filter.text))
194 { 193 appendToListBox("excludedDomainsBox", RegExp.$1);
195 if (whitelistedDomainRegexp.test(filter.text)) 194 else
196 appendToListBox("excludedDomainsBox", RegExp.$1); 195 appendToListBox("userFiltersBox", filter.text);
197 else 196 }
198 appendToListBox("userFiltersBox", filter.text);
199 }
200 });
201 } 197 }
202 198
203 // Reloads the displayed subscriptions and filters 199 // Reloads the displayed subscriptions and filters
204 function reloadFilters() 200 function reloadFilters()
205 { 201 {
206 // Load user filter URLs 202 // Load user filter URLs
207 let container = document.getElementById("filterLists"); 203 let container = document.getElementById("filterLists");
208 while (container.lastChild) 204 while (container.lastChild)
209 container.removeChild(container.lastChild); 205 container.removeChild(container.lastChild);
210 206
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 onFilterMessage(message.action, message.args[0]); 735 onFilterMessage(message.action, message.args[0]);
740 break; 736 break;
741 case "prefs.respond": 737 case "prefs.respond":
742 onPrefMessage(message.action, message.args[0]); 738 onPrefMessage(message.action, message.args[0]);
743 break; 739 break;
744 case "subscriptions.respond": 740 case "subscriptions.respond":
745 onSubscriptionMessage(message.action, message.args[0]); 741 onSubscriptionMessage(message.action, message.args[0]);
746 break; 742 break;
747 } 743 }
748 }); 744 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld