 Issue 29333819:
  Issue 2375 - Implement "Blocking lists" section in new options page  (Closed)
    
  
    Issue 29333819:
  Issue 2375 - Implement "Blocking lists" section in new options page  (Closed) 
  | 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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 filters: text.split("\n") | 197 filters: text.split("\n") | 
| 198 .filter(function(filter) {return !!filter;}) | 198 .filter(function(filter) {return !!filter;}) | 
| 199 .map(modules.filterClasses.Filter.fromText), | 199 .map(modules.filterClasses.Filter.fromText), | 
| 200 errors: [] | 200 errors: [] | 
| 201 }; | 201 }; | 
| 202 } | 202 } | 
| 203 }; | 203 }; | 
| 204 | 204 | 
| 205 modules.synchronizer = { | 205 modules.synchronizer = { | 
| 206 Synchronizer: { | 206 Synchronizer: { | 
| 207 downloading: false, | |
| 
Thomas Greiner
2016/02/04 20:23:46
Detail: Since this is a "private" property I'd sug
 | |
| 207 execute: function(subscription, manual) | 208 execute: function(subscription, manual) | 
| 208 { | 209 { | 
| 209 subscription.lastDownload = Date.now() / 1000; | 210 subscription.lastDownload = 0; | 
| 211 modules.synchronizer.Synchronizer.downloading = true; | |
| 212 setTimeout(function() | |
| 213 { | |
| 214 modules.synchronizer.Synchronizer.downloading = false; | |
| 215 subscription.lastDownload = Date.now() / 1000; | |
| 216 }, 500); | |
| 217 }, | |
| 218 isExecuting: function(url) | |
| 219 { | |
| 220 return modules.synchronizer.Synchronizer.downloading; | |
| 210 } | 221 } | 
| 211 } | 222 } | 
| 212 }; | 223 }; | 
| 213 | 224 | 
| 214 modules.matcher = { | 225 modules.matcher = { | 
| 215 defaultMatcher: { | 226 defaultMatcher: { | 
| 216 matchesAny: function(url, requestType, docDomain, thirdParty) | 227 matchesAny: function(url, requestType, docDomain, thirdParty) | 
| 217 { | 228 { | 
| 218 var blocked = params.blockedURLs.split(","); | 229 var blocked = params.blockedURLs.split(","); | 
| 219 if (blocked.indexOf(url) >= 0) | 230 if (blocked.indexOf(url) >= 0) | 
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 | 312 | 
| 302 var subscriptions = [ | 313 var subscriptions = [ | 
| 303 "https://easylist-downloads.adblockplus.org/easylistgermany+easylist.txt", | 314 "https://easylist-downloads.adblockplus.org/easylistgermany+easylist.txt", | 
| 304 "https://easylist-downloads.adblockplus.org/exceptionrules.txt", | 315 "https://easylist-downloads.adblockplus.org/exceptionrules.txt", | 
| 305 "https://easylist-downloads.adblockplus.org/fanboy-social.txt", | 316 "https://easylist-downloads.adblockplus.org/fanboy-social.txt", | 
| 306 "~user~786254" | 317 "~user~786254" | 
| 307 ]; | 318 ]; | 
| 308 var knownSubscriptions = Object.create(null); | 319 var knownSubscriptions = Object.create(null); | 
| 309 for (var subscriptionUrl of subscriptions) | 320 for (var subscriptionUrl of subscriptions) | 
| 310 knownSubscriptions[subscriptionUrl] = modules.subscriptionClasses.Subscripti on.fromURL(subscriptionUrl); | 321 knownSubscriptions[subscriptionUrl] = modules.subscriptionClasses.Subscripti on.fromURL(subscriptionUrl); | 
| 322 | |
| 
Thomas Greiner
2016/02/04 20:23:45
Detail: This empty line has been added without tou
 | |
| 311 var customSubscription = knownSubscriptions["~user~786254"]; | 323 var customSubscription = knownSubscriptions["~user~786254"]; | 
| 312 | 324 | 
| 313 global.seenDataCorruption = params.seenDataCorruption; | 325 global.seenDataCorruption = params.seenDataCorruption; | 
| 314 global.filterlistsReinitialized = params.filterlistsReinitialized; | 326 global.filterlistsReinitialized = params.filterlistsReinitialized; | 
| 315 | 327 | 
| 316 if (params.addSubscription) | 328 if (params.addSubscription) | 
| 317 { | 329 { | 
| 318 // We don't know how long it will take for the page to fully load | 330 // We don't know how long it will take for the page to fully load | 
| 319 // so we'll post the message after one second | 331 // so we'll post the message after one second | 
| 320 setTimeout(function() | 332 setTimeout(function() | 
| 321 { | 333 { | 
| 322 window.postMessage({ | 334 window.postMessage({ | 
| 323 type: "message", | 335 type: "message", | 
| 324 payload: { | 336 payload: { | 
| 325 title: "Custom subscription", | 337 title: "Custom subscription", | 
| 326 url: "http://example.com/custom.txt", | 338 url: "http://example.com/custom.txt", | 
| 327 type: "add-subscription" | 339 type: "add-subscription" | 
| 328 } | 340 } | 
| 329 }, "*"); | 341 }, "*"); | 
| 330 }, 1000); | 342 }, 1000); | 
| 331 } | 343 } | 
| 332 })(this); | 344 })(this); | 
| LEFT | RIGHT |