| 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-2017 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 |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 13 * | 13 * |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 modules.prefs = {Prefs: new EventEmitter()}; | 100 modules.prefs = {Prefs: new EventEmitter()}; |
| 101 let prefs = { | 101 let prefs = { |
| 102 notifications_ignoredcategories: (params.showNotificationUI) ? ["*"] : [], | 102 notifications_ignoredcategories: (params.showNotificationUI) ? ["*"] : [], |
| 103 notifications_showui: params.showNotificationUI, | 103 notifications_showui: params.showNotificationUI, |
| 104 shouldShowBlockElementMenu: true, | 104 shouldShowBlockElementMenu: true, |
| 105 show_devtools_panel: true, | 105 show_devtools_panel: true, |
| 106 subscriptions_exceptionsurl: "https://easylist-downloads.adblockplus.org/exc
eptionrules.txt" | 106 subscriptions_exceptionsurl: "https://easylist-downloads.adblockplus.org/exc
eptionrules.txt", |
| 107 subscriptions_exceptionsurl_privacy: "https://easylist-downloads.adblockplus
.org/exceptionrules-privacy.txt" |
| 107 }; | 108 }; |
| 108 for (let key of Object.keys(prefs)) | 109 for (let key of Object.keys(prefs)) |
| 109 { | 110 { |
| 110 Object.defineProperty(modules.prefs.Prefs, key, { | 111 Object.defineProperty(modules.prefs.Prefs, key, { |
| 111 get() | 112 get() |
| 112 { | 113 { |
| 113 return prefs[key]; | 114 return prefs[key]; |
| 114 }, | 115 }, |
| 115 set(value) | 116 set(value) |
| 116 { | 117 { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 128 let index = categories.indexOf(category); | 129 let index = categories.indexOf(category); |
| 129 if (index == -1) | 130 if (index == -1) |
| 130 categories.push(category); | 131 categories.push(category); |
| 131 else | 132 else |
| 132 categories.splice(index, 1); | 133 categories.splice(index, 1); |
| 133 modules.prefs.Prefs.notifications_ignoredcategories = categories; | 134 modules.prefs.Prefs.notifications_ignoredcategories = categories; |
| 134 } | 135 } |
| 135 } | 136 } |
| 136 }; | 137 }; |
| 137 | 138 |
| 139 let subscriptionServer = "https://easylist-downloads.adblockplus.org"; |
| 140 let subscriptionDetails = { |
| 141 [`${subscriptionServer}/easylistgermany+easylist.txt`]: { |
| 142 title: "EasyList Germany+EasyList", |
| 143 installed: true |
| 144 }, |
| 145 [`${subscriptionServer}/exceptionrules.txt`]: { |
| 146 title: "Allow non-intrusive advertising", |
| 147 installed: true |
| 148 }, |
| 149 [`${subscriptionServer}/exceptionrules-privacy.txt`]: { |
| 150 title: "Allow only nonintrusive ads that are privacy-friendly" |
| 151 }, |
| 152 [`${subscriptionServer}/fanboy-social.txt`]: { |
| 153 title: "Fanboy's Social Blocking List", |
| 154 installed: true |
| 155 }, |
| 156 [`${subscriptionServer}/antiadblockfilters.txt`]: { |
| 157 title: "Adblock Warning Removal List", |
| 158 installed: true, |
| 159 disabled: true |
| 160 }, |
| 161 "~user~786254": { |
| 162 installed: true |
| 163 } |
| 164 }; |
| 165 |
| 138 function Subscription(url) | 166 function Subscription(url) |
| 139 { | 167 { |
| 140 this.url = url; | 168 this.url = url; |
| 141 this._disabled = false; | 169 this._disabled = false; |
| 142 this._lastDownload = 1234; | 170 this._lastDownload = 1234; |
| 143 this.homepage = "https://easylist.adblockplus.org/"; | 171 this.homepage = "https://easylist.adblockplus.org/"; |
| 144 this.downloadStatus = params.downloadStatus; | 172 this.downloadStatus = params.downloadStatus; |
| 173 |
| 174 let details = subscriptionDetails[this.url]; |
| 175 if (details) |
| 176 { |
| 177 this.disabled = !!details.disabled; |
| 178 this.title = details.title || ""; |
| 179 } |
| 145 } | 180 } |
| 146 Subscription.prototype = | 181 Subscription.prototype = |
| 147 { | 182 { |
| 148 get disabled() | 183 get disabled() |
| 149 { | 184 { |
| 150 return this._disabled; | 185 return this._disabled; |
| 151 }, | 186 }, |
| 152 set disabled(value) | 187 set disabled(value) |
| 153 { | 188 { |
| 154 this._disabled = value; | 189 this._disabled = value; |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 "###Werbung_Sky", | 467 "###Werbung_Sky", |
| 433 "###Werbung_Wide", | 468 "###Werbung_Wide", |
| 434 "###__ligatus_placeholder__", | 469 "###__ligatus_placeholder__", |
| 435 "###ad-bereich1-08", | 470 "###ad-bereich1-08", |
| 436 "###ad-bereich1-superbanner", | 471 "###ad-bereich1-superbanner", |
| 437 "###ad-bereich2-08", | 472 "###ad-bereich2-08", |
| 438 "###ad-bereich2-skyscrapper" | 473 "###ad-bereich2-skyscrapper" |
| 439 ]; | 474 ]; |
| 440 let knownFilters = filters.map(modules.filterClasses.Filter.fromText); | 475 let knownFilters = filters.map(modules.filterClasses.Filter.fromText); |
| 441 | 476 |
| 442 let subscriptionServer = "https://easylist-downloads.adblockplus.org"; | |
| 443 let subscriptions = [ | |
| 444 { | |
| 445 title: "EasyList Germany+EasyList", | |
| 446 url: `${subscriptionServer}/easylistgermany+easylist.txt` | |
| 447 }, | |
| 448 { | |
| 449 title: "Allow non-intrusive advertising", | |
| 450 url: `${subscriptionServer}/exceptionrules.txt` | |
| 451 }, | |
| 452 { | |
| 453 title: "Fanboy's Social Blocking List", | |
| 454 url: `${subscriptionServer}/fanboy-social.txt` | |
| 455 }, | |
| 456 { | |
| 457 title: null, | |
| 458 url: "~user~786254" | |
| 459 } | |
| 460 ]; | |
| 461 let knownSubscriptions = Object.create(null); | 477 let knownSubscriptions = Object.create(null); |
| 462 for (let {title, url} of subscriptions) | 478 for (let url in subscriptionDetails) |
| 463 { | 479 { |
| 464 let subscription = | 480 if (!subscriptionDetails[url].installed) |
| 481 continue; |
| 482 |
| 483 knownSubscriptions[url] = |
| 465 modules.subscriptionClasses.Subscription.fromURL(url); | 484 modules.subscriptionClasses.Subscription.fromURL(url); |
| 466 subscription.title = title; | |
| 467 knownSubscriptions[url] = subscription; | |
| 468 } | 485 } |
| 469 let customSubscription = knownSubscriptions["~user~786254"]; | 486 let customSubscription = knownSubscriptions["~user~786254"]; |
| 470 | 487 |
| 471 if (params.addSubscription) | 488 if (params.addSubscription) |
| 472 { | 489 { |
| 473 // We don't know how long it will take for the page to fully load | 490 // We don't know how long it will take for the page to fully load |
| 474 // so we'll post the message after one second | 491 // so we'll post the message after one second |
| 475 setTimeout(() => | 492 setTimeout(() => |
| 476 { | 493 { |
| 477 window.postMessage({ | 494 window.postMessage({ |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 }, | 599 }, |
| 583 filter: { | 600 filter: { |
| 584 text: "||example.com/some-annoying-popup$popup", | 601 text: "||example.com/some-annoying-popup$popup", |
| 585 whitelisted: false, | 602 whitelisted: false, |
| 586 userDefined: true, | 603 userDefined: true, |
| 587 subscription: null | 604 subscription: null |
| 588 } | 605 } |
| 589 }); | 606 }); |
| 590 }); | 607 }); |
| 591 }()); | 608 }()); |
| LEFT | RIGHT |