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

Side by Side Diff: background.js

Issue 29712664: Issue 6432 - Hide remove button for additional filter lists (Closed)
Patch Set: Addressed Dave's comments Created March 2, 2018, 11:43 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « README.md ('k') | js/desktop-options.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-present eyeo GmbH 3 * Copyright (C) 2006-present 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 for (let param of params) 61 for (let param of params)
62 { 62 {
63 let parts = param.split("=", 2); 63 let parts = param.split("=", 2);
64 if (parts.length == 2 && parts[0] in data) 64 if (parts.length == 2 && parts[0] in data)
65 data[parts[0]] = decodeURIComponent(parts[1]); 65 data[parts[0]] = decodeURIComponent(parts[1]);
66 } 66 }
67 } 67 }
68 } 68 }
69 69
70 let params = { 70 let params = {
71 additionalSubscriptions: false,
71 blockedURLs: "", 72 blockedURLs: "",
72 filterlistsReinitialized: false, 73 filterlistsReinitialized: false,
73 addSubscription: false, 74 addSubscription: false,
74 filterError: false, 75 filterError: false,
75 downloadStatus: "synchronize_ok", 76 downloadStatus: "synchronize_ok",
76 showNotificationUI: false, 77 showNotificationUI: false,
77 showPageOptions: false 78 showPageOptions: false
78 }; 79 };
79 updateFromURL(params); 80 updateFromURL(params);
80 81
82 const subscriptionServer = "https://easylist-downloads.adblockplus.org";
83 const easyListGermany = `${subscriptionServer}/easylistgermany+easylist.txt`;
84 const acceptableAds = `${subscriptionServer}/exceptionrules.txt`;
85 const acceptableAdsPrivacyFriendly =
86 `${subscriptionServer}/exceptionrules-privacy-friendly.txt`;
87 const redirectLink = "https://adblockplus.org/redirect?link=";
88
81 let modules = {}; 89 let modules = {};
82 window.require = function(module) 90 window.require = function(module)
83 { 91 {
84 return modules[module]; 92 return modules[module];
85 }; 93 };
86 94
87 modules.utils = { 95 modules.utils = {
88 Utils: { 96 Utils: {
89 getDocLink(link) 97 getDocLink(link)
90 { 98 {
91 return "https://adblockplus.org/redirect?link=" + encodeURIComponent(lin k); 99 return `${redirectLink}${encodeURIComponent(link)}`;
92 }, 100 },
93 get appLocale() 101 get appLocale()
94 { 102 {
95 return browser.i18n.getUILanguage(); 103 return browser.i18n.getUILanguage();
96 }, 104 },
97 get readingDirection() 105 get readingDirection()
98 { 106 {
99 return /^(?:ar|fa|he|ug|ur)\b/.test(this.appLocale) ? "rtl" : "ltr"; 107 return /^(?:ar|fa|he|ug|ur)\b/.test(this.appLocale) ? "rtl" : "ltr";
100 } 108 }
101 } 109 }
102 }; 110 };
103 111
104 modules.prefs = {Prefs: new EventEmitter()}; 112 modules.prefs = {Prefs: new EventEmitter()};
105 let prefs = { 113 let prefs = {
106 notifications_ignoredcategories: (params.showNotificationUI) ? ["*"] : [], 114 notifications_ignoredcategories: params.showNotificationUI ? ["*"] : [],
107 notifications_showui: params.showNotificationUI, 115 notifications_showui: params.showNotificationUI,
108 shouldShowBlockElementMenu: true, 116 shouldShowBlockElementMenu: true,
109 show_devtools_panel: true, 117 show_devtools_panel: true,
110 ui_warn_tracking: true, 118 ui_warn_tracking: true,
111 subscriptions_exceptionsurl: "https://easylist-downloads.adblockplus.org/exc eptionrules.txt", 119 additional_subscriptions:
112 subscriptions_exceptionsurl_privacy: "https://easylist-downloads.adblockplus .org/exceptionrules-privacy-friendly.txt" 120 params.additionalSubscriptions ? [`${easyListGermany}`] : [],
121 subscriptions_exceptionsurl: acceptableAds,
122 subscriptions_exceptionsurl_privacy: acceptableAdsPrivacyFriendly
113 }; 123 };
114 for (let key of Object.keys(prefs)) 124 for (let key of Object.keys(prefs))
115 { 125 {
116 Object.defineProperty(modules.prefs.Prefs, key, { 126 Object.defineProperty(modules.prefs.Prefs, key, {
117 get() 127 get()
118 { 128 {
119 return prefs[key]; 129 return prefs[key];
120 }, 130 },
121 set(value) 131 set(value)
122 { 132 {
(...skipping 21 matching lines...) Expand all
144 modules.notificationHelper = { 154 modules.notificationHelper = {
145 getActiveNotification() 155 getActiveNotification()
146 { 156 {
147 }, 157 },
148 shouldDisplay() 158 shouldDisplay()
149 { 159 {
150 return true; 160 return true;
151 } 161 }
152 }; 162 };
153 163
154 let subscriptionServer = "https://easylist-downloads.adblockplus.org";
155 let subscriptionDetails = { 164 let subscriptionDetails = {
156 [`${subscriptionServer}/easylistgermany+easylist.txt`]: { 165 [easyListGermany]: {
157 title: "EasyList Germany+EasyList", 166 title: "EasyList Germany+EasyList",
158 installed: true 167 installed: true
159 }, 168 },
160 [`${subscriptionServer}/exceptionrules.txt`]: { 169 [acceptableAds]: {
161 title: "Allow non-intrusive advertising", 170 title: "Allow non-intrusive advertising",
162 installed: true 171 installed: true
163 }, 172 },
164 [`${subscriptionServer}/exceptionrules-privacy-friendly.txt`]: { 173 [acceptableAdsPrivacyFriendly]: {
165 title: "Allow only nonintrusive ads that are privacy-friendly" 174 title: "Allow only nonintrusive ads that are privacy-friendly"
166 }, 175 },
167 [`${subscriptionServer}/fanboy-social.txt`]: { 176 [`${subscriptionServer}/fanboy-social.txt`]: {
168 title: "Fanboy's Social Blocking List", 177 title: "Fanboy's Social Blocking List",
169 installed: true 178 installed: true
170 }, 179 },
171 [`${subscriptionServer}/antiadblockfilters.txt`]: { 180 [`${subscriptionServer}/antiadblockfilters.txt`]: {
172 title: "Adblock Warning Removal List", 181 title: "Adblock Warning Removal List",
173 installed: true, 182 installed: true,
174 disabled: true 183 disabled: true
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 }, 621 },
613 filter: { 622 filter: {
614 text: "||example.com/some-annoying-popup$popup", 623 text: "||example.com/some-annoying-popup$popup",
615 whitelisted: false, 624 whitelisted: false,
616 userDefined: true, 625 userDefined: true,
617 subscription: null 626 subscription: null
618 } 627 }
619 }); 628 });
620 }); 629 });
621 }()); 630 }());
OLDNEW
« no previous file with comments | « README.md ('k') | js/desktop-options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld