Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 Loading... | |
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 additionalSubscriptions: "", |
Thomas Greiner
2018/03/02 11:33:35
Detail: Please also mention this new parameter in
Thomas Greiner
2018/03/02 11:33:35
Why not implement this the same way as "blockedURL
saroyanm
2018/03/02 13:50:29
Done.
saroyanm
2018/03/02 13:50:29
Done.
| |
72 blockedURLs: "", | 72 blockedURLs: "", |
73 filterlistsReinitialized: false, | 73 filterlistsReinitialized: false, |
74 addSubscription: false, | 74 addSubscription: false, |
75 filterError: false, | 75 filterError: false, |
76 downloadStatus: "synchronize_ok", | 76 downloadStatus: "synchronize_ok", |
77 showNotificationUI: false, | 77 showNotificationUI: false, |
78 showPageOptions: false | 78 showPageOptions: false |
79 }; | 79 }; |
80 updateFromURL(params); | 80 updateFromURL(params); |
81 | 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 | |
82 let modules = {}; | 89 let modules = {}; |
83 window.require = function(module) | 90 window.require = function(module) |
84 { | 91 { |
85 return modules[module]; | 92 return modules[module]; |
86 }; | 93 }; |
87 | 94 |
88 modules.utils = { | 95 modules.utils = { |
89 Utils: { | 96 Utils: { |
90 getDocLink(link) | 97 getDocLink(link) |
91 { | 98 { |
92 return "https://adblockplus.org/redirect?link=" + encodeURIComponent(lin k); | 99 return `${redirectLink}${encodeURIComponent(link)}`; |
93 }, | 100 }, |
94 get appLocale() | 101 get appLocale() |
95 { | 102 { |
96 return browser.i18n.getUILanguage(); | 103 return browser.i18n.getUILanguage(); |
97 }, | 104 }, |
98 get readingDirection() | 105 get readingDirection() |
99 { | 106 { |
100 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"; |
101 } | 108 } |
102 } | 109 } |
103 }; | 110 }; |
104 | 111 |
105 modules.prefs = {Prefs: new EventEmitter()}; | 112 modules.prefs = {Prefs: new EventEmitter()}; |
106 let prefs = { | 113 let prefs = { |
107 notifications_ignoredcategories: (params.showNotificationUI) ? ["*"] : [], | 114 notifications_ignoredcategories: params.showNotificationUI ? ["*"] : [], |
Thomas Greiner
2018/03/02 17:00:02
Detail: This change is unrelated to this issue and
| |
108 notifications_showui: params.showNotificationUI, | 115 notifications_showui: params.showNotificationUI, |
109 shouldShowBlockElementMenu: true, | 116 shouldShowBlockElementMenu: true, |
110 show_devtools_panel: true, | 117 show_devtools_panel: true, |
111 ui_warn_tracking: true, | 118 ui_warn_tracking: true, |
112 additional_subscriptions: (params.additionalSubscriptions) ? ["https://easyl ist-downloads.adblockplus.org/easylistgermany+easylist.txt"] : [], | 119 additional_subscriptions: params.additionalSubscriptions.split(","), |
kzar
2018/03/02 09:57:01
Nit: The paranthesis around params.additionalSubsc
Thomas Greiner
2018/03/02 11:33:35
Sounds like a personal preference which I usually
saroyanm
2018/03/02 13:50:29
Done.
kzar
2018/03/05 13:23:21
Thanks
| |
113 subscriptions_exceptionsurl: "https://easylist-downloads.adblockplus.org/exc eptionrules.txt", | 120 subscriptions_exceptionsurl: acceptableAds, |
114 subscriptions_exceptionsurl_privacy: "https://easylist-downloads.adblockplus .org/exceptionrules-privacy-friendly.txt" | 121 subscriptions_exceptionsurl_privacy: acceptableAdsPrivacyFriendly |
115 }; | 122 }; |
116 for (let key of Object.keys(prefs)) | 123 for (let key of Object.keys(prefs)) |
117 { | 124 { |
118 Object.defineProperty(modules.prefs.Prefs, key, { | 125 Object.defineProperty(modules.prefs.Prefs, key, { |
119 get() | 126 get() |
120 { | 127 { |
121 return prefs[key]; | 128 return prefs[key]; |
122 }, | 129 }, |
123 set(value) | 130 set(value) |
124 { | 131 { |
(...skipping 21 matching lines...) Expand all Loading... | |
146 modules.notificationHelper = { | 153 modules.notificationHelper = { |
147 getActiveNotification() | 154 getActiveNotification() |
148 { | 155 { |
149 }, | 156 }, |
150 shouldDisplay() | 157 shouldDisplay() |
151 { | 158 { |
152 return true; | 159 return true; |
153 } | 160 } |
154 }; | 161 }; |
155 | 162 |
156 let subscriptionServer = "https://easylist-downloads.adblockplus.org"; | |
157 let subscriptionDetails = { | 163 let subscriptionDetails = { |
158 [`${subscriptionServer}/easylistgermany+easylist.txt`]: { | 164 [easyListGermany]: { |
159 title: "EasyList Germany+EasyList", | 165 title: "EasyList Germany+EasyList", |
160 installed: true | 166 installed: true |
161 }, | 167 }, |
162 [`${subscriptionServer}/exceptionrules.txt`]: { | 168 [acceptableAds]: { |
163 title: "Allow non-intrusive advertising", | 169 title: "Allow non-intrusive advertising", |
164 installed: true | 170 installed: true |
165 }, | 171 }, |
166 [`${subscriptionServer}/exceptionrules-privacy-friendly.txt`]: { | 172 [acceptableAdsPrivacyFriendly]: { |
167 title: "Allow only nonintrusive ads that are privacy-friendly" | 173 title: "Allow only nonintrusive ads that are privacy-friendly" |
168 }, | 174 }, |
169 [`${subscriptionServer}/fanboy-social.txt`]: { | 175 [`${subscriptionServer}/fanboy-social.txt`]: { |
170 title: "Fanboy's Social Blocking List", | 176 title: "Fanboy's Social Blocking List", |
171 installed: true | 177 installed: true |
172 }, | 178 }, |
173 [`${subscriptionServer}/antiadblockfilters.txt`]: { | 179 [`${subscriptionServer}/antiadblockfilters.txt`]: { |
174 title: "Adblock Warning Removal List", | 180 title: "Adblock Warning Removal List", |
175 installed: true, | 181 installed: true, |
176 disabled: true | 182 disabled: true |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
614 }, | 620 }, |
615 filter: { | 621 filter: { |
616 text: "||example.com/some-annoying-popup$popup", | 622 text: "||example.com/some-annoying-popup$popup", |
617 whitelisted: false, | 623 whitelisted: false, |
618 userDefined: true, | 624 userDefined: true, |
619 subscription: null | 625 subscription: null |
620 } | 626 } |
621 }); | 627 }); |
622 }); | 628 }); |
623 }()); | 629 }()); |
LEFT | RIGHT |