LEFT | RIGHT |
(no file at all) | |
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-2016 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 |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 window.postMessage({ | 298 window.postMessage({ |
299 type: "message", | 299 type: "message", |
300 payload: { | 300 payload: { |
301 title: "Custom subscription", | 301 title: "Custom subscription", |
302 url: "http://example.com/custom.txt", | 302 url: "http://example.com/custom.txt", |
303 type: "add-subscription" | 303 type: "add-subscription" |
304 } | 304 } |
305 }, "*"); | 305 }, "*"); |
306 }, 1000); | 306 }, 1000); |
307 } | 307 } |
| 308 |
| 309 ext.devtools.onCreated.addListener(function(panel) |
| 310 { |
| 311 // blocked request |
| 312 panel.sendMessage({ |
| 313 type: "add-record", |
| 314 request: { |
| 315 url: "http://adserver.example.com/ad_banner.png", |
| 316 type: "IMAGE", |
| 317 docDomain: "example.com" |
| 318 }, |
| 319 filter: { |
| 320 text: "/ad_banner*$domain=example.com", |
| 321 whitelisted: false, |
| 322 userDefined: false, |
| 323 subscription: "EasyList" |
| 324 } |
| 325 }); |
| 326 |
| 327 // whitelisted request |
| 328 panel.sendMessage({ |
| 329 type: "add-record", |
| 330 request: { |
| 331 url: "http://example.com/looks_like_an_ad_but_isnt_one.html", |
| 332 type: "SUBDOCUMENT", |
| 333 docDomain: "example.com" |
| 334 }, |
| 335 filter: { |
| 336 text: "@@||example.com/looks_like_an_ad_but_isnt_one.html", |
| 337 whitelisted: true, |
| 338 userDefined: false, |
| 339 subscription: "EasyList" |
| 340 } |
| 341 }); |
| 342 |
| 343 // request with long URL and no filter matches |
| 344 panel.sendMessage({ |
| 345 type: "add-record", |
| 346 request: { |
| 347 url: "https://this.url.has.a.long.domain/and_a_long_path_maybe_not_long_
enough_so_i_keep_typing?there=are&a=couple&of=parameters&as=well&and=even&some=m
ore", |
| 348 type: "XMLHTTPREQUEST", |
| 349 docDomain: "example.com" |
| 350 }, |
| 351 filter: null |
| 352 }); |
| 353 |
| 354 // matching element hiding filter |
| 355 panel.sendMessage({ |
| 356 type: "add-record", |
| 357 request: { |
| 358 type: "ELEMHIDE", |
| 359 docDomain: "example.com" |
| 360 }, |
| 361 filter: { |
| 362 text: "example.com##.ad_banner", |
| 363 whitelisted: false, |
| 364 userDefined: false, |
| 365 subscription: "EasyList" |
| 366 } |
| 367 }); |
| 368 |
| 369 // user-defined filter |
| 370 panel.sendMessage({ |
| 371 type: "add-record", |
| 372 request: { |
| 373 url: "http://example.com/some-annoying-popup", |
| 374 type: "POPUP", |
| 375 docDomain: "example.com" |
| 376 }, |
| 377 filter: { |
| 378 text: "||example.com/some-annoying-popup$popup", |
| 379 whitelisted: false, |
| 380 userDefined: true, |
| 381 subscription: null |
| 382 } |
| 383 }); |
| 384 }); |
308 })(this); | 385 })(this); |
LEFT | RIGHT |