| OLD | NEW |
| 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: "", |
| 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: params.additionalSubscriptions.split(","), |
| 112 subscriptions_exceptionsurl_privacy: "https://easylist-downloads.adblockplus
.org/exceptionrules-privacy-friendly.txt" | 120 subscriptions_exceptionsurl: acceptableAds, |
| 121 subscriptions_exceptionsurl_privacy: acceptableAdsPrivacyFriendly |
| 113 }; | 122 }; |
| 114 for (let key of Object.keys(prefs)) | 123 for (let key of Object.keys(prefs)) |
| 115 { | 124 { |
| 116 Object.defineProperty(modules.prefs.Prefs, key, { | 125 Object.defineProperty(modules.prefs.Prefs, key, { |
| 117 get() | 126 get() |
| 118 { | 127 { |
| 119 return prefs[key]; | 128 return prefs[key]; |
| 120 }, | 129 }, |
| 121 set(value) | 130 set(value) |
| 122 { | 131 { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 144 modules.notificationHelper = { | 153 modules.notificationHelper = { |
| 145 getActiveNotification() | 154 getActiveNotification() |
| 146 { | 155 { |
| 147 }, | 156 }, |
| 148 shouldDisplay() | 157 shouldDisplay() |
| 149 { | 158 { |
| 150 return true; | 159 return true; |
| 151 } | 160 } |
| 152 }; | 161 }; |
| 153 | 162 |
| 154 let subscriptionServer = "https://easylist-downloads.adblockplus.org"; | |
| 155 let subscriptionDetails = { | 163 let subscriptionDetails = { |
| 156 [`${subscriptionServer}/easylistgermany+easylist.txt`]: { | 164 [easyListGermany]: { |
| 157 title: "EasyList Germany+EasyList", | 165 title: "EasyList Germany+EasyList", |
| 158 installed: true | 166 installed: true |
| 159 }, | 167 }, |
| 160 [`${subscriptionServer}/exceptionrules.txt`]: { | 168 [acceptableAds]: { |
| 161 title: "Allow non-intrusive advertising", | 169 title: "Allow non-intrusive advertising", |
| 162 installed: true | 170 installed: true |
| 163 }, | 171 }, |
| 164 [`${subscriptionServer}/exceptionrules-privacy-friendly.txt`]: { | 172 [acceptableAdsPrivacyFriendly]: { |
| 165 title: "Allow only nonintrusive ads that are privacy-friendly" | 173 title: "Allow only nonintrusive ads that are privacy-friendly" |
| 166 }, | 174 }, |
| 167 [`${subscriptionServer}/fanboy-social.txt`]: { | 175 [`${subscriptionServer}/fanboy-social.txt`]: { |
| 168 title: "Fanboy's Social Blocking List", | 176 title: "Fanboy's Social Blocking List", |
| 169 installed: true | 177 installed: true |
| 170 }, | 178 }, |
| 171 [`${subscriptionServer}/antiadblockfilters.txt`]: { | 179 [`${subscriptionServer}/antiadblockfilters.txt`]: { |
| 172 title: "Adblock Warning Removal List", | 180 title: "Adblock Warning Removal List", |
| 173 installed: true, | 181 installed: true, |
| 174 disabled: true | 182 disabled: true |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 }, | 620 }, |
| 613 filter: { | 621 filter: { |
| 614 text: "||example.com/some-annoying-popup$popup", | 622 text: "||example.com/some-annoying-popup$popup", |
| 615 whitelisted: false, | 623 whitelisted: false, |
| 616 userDefined: true, | 624 userDefined: true, |
| 617 subscription: null | 625 subscription: null |
| 618 } | 626 } |
| 619 }); | 627 }); |
| 620 }); | 628 }); |
| 621 }()); | 629 }()); |
| OLD | NEW |