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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 | 326 |
327 sendResponse(selectors); | 327 sendResponse(selectors); |
328 break; | 328 break; |
329 case "should-collapse": | 329 case "should-collapse": |
330 if (isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT")) | 330 if (isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT")) |
331 { | 331 { |
332 sendResponse(false); | 332 sendResponse(false); |
333 break; | 333 break; |
334 } | 334 } |
335 | 335 |
336 var url = new URL(msg.url); | |
337 var documentHost = extractHostFromFrame(sender.frame); | 336 var documentHost = extractHostFromFrame(sender.frame); |
338 var filter = defaultMatcher.matchesAny( | 337 var blocked = false; |
339 stringifyURL(url), msg.mediatype, | 338 |
340 documentHost, isThirdParty(url, documentHost) | 339 for (var i = 0; i < msg.urls.length; i++) |
341 ); | 340 { |
342 | 341 var url = new URL(msg.urls[i], msg.baseURL); |
343 if (filter instanceof BlockingFilter) | 342 var filter = defaultMatcher.matchesAny( |
344 { | 343 stringifyURL(url), msg.mediatype, |
345 var collapse = filter.collapse; | 344 documentHost, isThirdParty(url, documentHost) |
346 if (collapse == null) | 345 ); |
347 collapse = Prefs.hidePlaceholders; | 346 |
348 sendResponse(collapse); | 347 if (filter instanceof BlockingFilter) |
349 } | 348 { |
350 else | 349 if (filter.collapse != null) |
351 sendResponse(false); | 350 { |
| 351 sendResponse(filter.collapse); |
| 352 return; |
| 353 } |
| 354 |
| 355 blocked = true; |
| 356 } |
| 357 } |
| 358 |
| 359 sendResponse(blocked && Prefs.hidePlaceholders); |
352 break; | 360 break; |
353 case "get-domain-enabled-state": | 361 case "get-domain-enabled-state": |
354 // Returns whether this domain is in the exclusion list. | 362 // Returns whether this domain is in the exclusion list. |
355 // The browser action popup asks us this. | 363 // The browser action popup asks us this. |
356 if(sender.page) | 364 if(sender.page) |
357 { | 365 { |
358 sendResponse({enabled: !isPageWhitelisted(sender.page)}); | 366 sendResponse({enabled: !isPageWhitelisted(sender.page)}); |
359 return; | 367 return; |
360 } | 368 } |
361 break; | 369 break; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 break; | 422 break; |
415 } | 423 } |
416 }); | 424 }); |
417 | 425 |
418 // update icon when page changes location | 426 // update icon when page changes location |
419 ext.pages.onLoading.addListener(function(page) | 427 ext.pages.onLoading.addListener(function(page) |
420 { | 428 { |
421 page.sendMessage({type: "clickhide-deactivate"}); | 429 page.sendMessage({type: "clickhide-deactivate"}); |
422 refreshIconAndContextMenu(page); | 430 refreshIconAndContextMenu(page); |
423 }); | 431 }); |
LEFT | RIGHT |