| 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-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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 66       } | 66       } | 
| 67     } | 67     } | 
| 68   } | 68   } | 
| 69 | 69 | 
| 70   let params = { | 70   let params = { | 
| 71     blockedURLs: "", | 71     blockedURLs: "", | 
| 72     filterlistsReinitialized: false, | 72     filterlistsReinitialized: false, | 
| 73     addSubscription: false, | 73     addSubscription: false, | 
| 74     filterError: false, | 74     filterError: false, | 
| 75     downloadStatus: "synchronize_ok", | 75     downloadStatus: "synchronize_ok", | 
| 76     showNotificationUI: false | 76     showNotificationUI: false, | 
|  | 77     showPageOptions: false | 
| 77   }; | 78   }; | 
| 78   updateFromURL(params); | 79   updateFromURL(params); | 
| 79 | 80 | 
| 80   let modules = {}; | 81   let modules = {}; | 
| 81   window.require = function(module) | 82   window.require = function(module) | 
| 82   { | 83   { | 
| 83     return modules[module]; | 84     return modules[module]; | 
| 84   }; | 85   }; | 
| 85 | 86 | 
| 86   modules.utils = { | 87   modules.utils = { | 
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 431     "###Werbung_Sky", | 432     "###Werbung_Sky", | 
| 432     "###Werbung_Wide", | 433     "###Werbung_Wide", | 
| 433     "###__ligatus_placeholder__", | 434     "###__ligatus_placeholder__", | 
| 434     "###ad-bereich1-08", | 435     "###ad-bereich1-08", | 
| 435     "###ad-bereich1-superbanner", | 436     "###ad-bereich1-superbanner", | 
| 436     "###ad-bereich2-08", | 437     "###ad-bereich2-08", | 
| 437     "###ad-bereich2-skyscrapper" | 438     "###ad-bereich2-skyscrapper" | 
| 438   ]; | 439   ]; | 
| 439   let knownFilters = filters.map(modules.filterClasses.Filter.fromText); | 440   let knownFilters = filters.map(modules.filterClasses.Filter.fromText); | 
| 440 | 441 | 
|  | 442   let subscriptionServer = "https://easylist-downloads.adblockplus.org"; | 
| 441   let subscriptions = [ | 443   let subscriptions = [ | 
| 442     "https://easylist-downloads.adblockplus.org/easylistgermany+easylist.txt", | 444     { | 
| 443     "https://easylist-downloads.adblockplus.org/exceptionrules.txt", | 445       title: "EasyList Germany+EasyList", | 
| 444     "https://easylist-downloads.adblockplus.org/fanboy-social.txt", | 446       url: `${subscriptionServer}/easylistgermany+easylist.txt` | 
| 445     "~user~786254" | 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     } | 
| 446   ]; | 460   ]; | 
| 447   let knownSubscriptions = Object.create(null); | 461   let knownSubscriptions = Object.create(null); | 
| 448   for (let subscriptionUrl of subscriptions) | 462   for (let {title, url} of subscriptions) | 
| 449   { | 463   { | 
| 450     knownSubscriptions[subscriptionUrl] = | 464     let subscription = | 
| 451       modules.subscriptionClasses.Subscription.fromURL(subscriptionUrl); | 465       modules.subscriptionClasses.Subscription.fromURL(url); | 
|  | 466     subscription.title = title; | 
|  | 467     knownSubscriptions[url] = subscription; | 
| 452   } | 468   } | 
| 453   let customSubscription = knownSubscriptions["~user~786254"]; | 469   let customSubscription = knownSubscriptions["~user~786254"]; | 
| 454 | 470 | 
| 455   if (params.addSubscription) | 471   if (params.addSubscription) | 
| 456   { | 472   { | 
| 457     // We don't know how long it will take for the page to fully load | 473     // We don't know how long it will take for the page to fully load | 
| 458     // so we'll post the message after one second | 474     // so we'll post the message after one second | 
| 459     setTimeout(() => | 475     setTimeout(() => | 
| 460     { | 476     { | 
| 461       window.postMessage({ | 477       window.postMessage({ | 
| 462         type: "message", | 478         type: "message", | 
| 463         payload: { | 479         payload: { | 
| 464           title: "Custom subscription", | 480           title: "Custom subscription", | 
| 465           url: "http://example.com/custom.txt", | 481           url: "http://example.com/custom.txt", | 
| 466           confirm: true, | 482           confirm: true, | 
| 467           type: "subscriptions.add" | 483           type: "subscriptions.add" | 
| 468         } | 484         } | 
| 469       }, "*"); | 485       }, "*"); | 
| 470     }, 1000); | 486     }, 1000); | 
| 471   } | 487   } | 
| 472 | 488 | 
|  | 489   if (params.showPageOptions) | 
|  | 490   { | 
|  | 491     // We don't know how long it will take for the page to fully load | 
|  | 492     // so we'll post the message after one second | 
|  | 493     setTimeout(() => | 
|  | 494     { | 
|  | 495       let host = "example.com"; | 
|  | 496       let isWhitelisted = customSubscription.filters | 
|  | 497         .some((filter) => filter.text == `@@||${host}^$document`); | 
|  | 498       window.postMessage({ | 
|  | 499         type: "message", | 
|  | 500         payload: { | 
|  | 501           type: "app.open", | 
|  | 502           what: "options", | 
|  | 503           action: "showPageOptions", | 
|  | 504           args: [ | 
|  | 505             { | 
|  | 506               host, | 
|  | 507               whitelisted: isWhitelisted | 
|  | 508             } | 
|  | 509           ] | 
|  | 510         } | 
|  | 511       }, "*"); | 
|  | 512     }, 1000); | 
|  | 513   } | 
|  | 514 | 
| 473   ext.devtools.onCreated.addListener((panel) => | 515   ext.devtools.onCreated.addListener((panel) => | 
| 474   { | 516   { | 
| 475     // blocked request | 517     // blocked request | 
| 476     panel.sendMessage({ | 518     panel.sendMessage({ | 
| 477       type: "add-record", | 519       type: "add-record", | 
| 478       request: { | 520       request: { | 
| 479         url: "http://adserver.example.com/ad_banner.png", | 521         url: "http://adserver.example.com/ad_banner.png", | 
| 480         type: "IMAGE", | 522         type: "IMAGE", | 
| 481         docDomain: "example.com" | 523         docDomain: "example.com" | 
| 482       }, | 524       }, | 
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 540       }, | 582       }, | 
| 541       filter: { | 583       filter: { | 
| 542         text: "||example.com/some-annoying-popup$popup", | 584         text: "||example.com/some-annoying-popup$popup", | 
| 543         whitelisted: false, | 585         whitelisted: false, | 
| 544         userDefined: true, | 586         userDefined: true, | 
| 545         subscription: null | 587         subscription: null | 
| 546       } | 588       } | 
| 547     }); | 589     }); | 
| 548   }); | 590   }); | 
| 549 }()); | 591 }()); | 
| OLD | NEW | 
|---|