| Left: | ||
| Right: |
| 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-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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 464 { | 464 { |
| 465 switch (msg.type) | 465 switch (msg.type) |
| 466 { | 466 { |
| 467 case "get-selectors": | 467 case "get-selectors": |
| 468 var selectors = []; | 468 var selectors = []; |
| 469 | 469 |
| 470 if (!isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT") && | 470 if (!isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT") && |
| 471 !isFrameWhitelisted(sender.page, sender.frame, "ELEMHIDE")) | 471 !isFrameWhitelisted(sender.page, sender.frame, "ELEMHIDE")) |
| 472 { | 472 { |
| 473 var noStyleRules = false; | 473 var noStyleRules = false; |
| 474 var specificOnly = isFrameWhitelisted(sender.page, sender.frame, "GENERI CHIDE"); | |
|
Sebastian Noack
2015/03/12 12:36:12
I'm concerned about the performance implications r
kzar
2015/03/12 19:22:45
That sound sensible to me but as you mentioned to
| |
| 474 var host = extractHostFromFrame(sender.frame); | 475 var host = extractHostFromFrame(sender.frame); |
| 476 | |
| 475 for (var i = 0; i < noStyleRulesHosts.length; i++) | 477 for (var i = 0; i < noStyleRulesHosts.length; i++) |
| 476 { | 478 { |
| 477 var noStyleHost = noStyleRulesHosts[i]; | 479 var noStyleHost = noStyleRulesHosts[i]; |
| 478 if (host == noStyleHost || (host.length > noStyleHost.length && | 480 if (host == noStyleHost || (host.length > noStyleHost.length && |
| 479 host.substr(host.length - noStyleHost.leng th - 1) == "." + noStyleHost)) | 481 host.substr(host.length - noStyleHost.leng th - 1) == "." + noStyleHost)) |
| 480 { | 482 { |
| 481 noStyleRules = true; | 483 noStyleRules = true; |
| 482 } | 484 } |
| 483 } | 485 } |
| 484 selectors = ElemHide.getSelectorsForDomain(host, false); | 486 selectors = ElemHide.getSelectorsForDomain(host, specificOnly); |
| 485 if (noStyleRules) | 487 if (noStyleRules) |
| 486 { | 488 { |
| 487 selectors = selectors.filter(function(s) | 489 selectors = selectors.filter(function(s) |
| 488 { | 490 { |
| 489 return !/\[style[\^\$]?=/.test(s); | 491 return !/\[style[\^\$]?=/.test(s); |
| 490 }); | 492 }); |
| 491 } | 493 } |
| 492 } | 494 } |
| 493 | 495 |
| 494 sendResponse(selectors); | 496 sendResponse(selectors); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 577 page.sendMessage({type: "clickhide-deactivate"}); | 579 page.sendMessage({type: "clickhide-deactivate"}); |
| 578 refreshIconAndContextMenu(page); | 580 refreshIconAndContextMenu(page); |
| 579 }); | 581 }); |
| 580 | 582 |
| 581 setTimeout(function() | 583 setTimeout(function() |
| 582 { | 584 { |
| 583 var notificationToShow = NotificationStorage.getNextToShow(); | 585 var notificationToShow = NotificationStorage.getNextToShow(); |
| 584 if (notificationToShow) | 586 if (notificationToShow) |
| 585 showNotification(notificationToShow); | 587 showNotification(notificationToShow); |
| 586 }, 3 * 60 * 1000); | 588 }, 3 * 60 * 1000); |
| OLD | NEW |