| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 401 var selector = ""; | 401 var selector = ""; |
| 402 | 402 |
| 403 for (var i = 0; i < elt.classList.length; i++) | 403 for (var i = 0; i < elt.classList.length; i++) |
| 404 selector += "." + elt.classList[i].replace(/([^\w-])/, "\\$1"); | 404 selector += "." + elt.classList[i].replace(/([^\w-])/, "\\$1"); |
| 405 | 405 |
| 406 addSelector(selector); | 406 addSelector(selector); |
| 407 } | 407 } |
| 408 | 408 |
| 409 if (url) | 409 if (url) |
| 410 { | 410 { |
| 411 clickHideFilters.push(url.replace(/^[\w\-]+:\/+(?:www\.)?/, "||")); | 411 var src = elt.getAttribute("src"); |
| 412 var selector = src && elt.localName + '[src=' + quote(src) + ']'; | |
|
Wladimir Palant
2014/10/30 22:36:28
elt.localName still needs escaping, DOM methods al
Sebastian Noack
2014/10/31 13:52:49
The syntax for valid tag names is very restrictive
Wladimir Palant
2014/11/03 18:14:28
document.createElement("foo:bar") might still be p
| |
| 412 | 413 |
| 413 var src = elt.getAttribute("src"); | 414 if (/^https?:/i.test(url)) |
| 414 if (src) | 415 { |
| 415 selectorList.push('[src=' + quote(src) + ']'); | 416 clickHideFilters.push(url.replace(/^[\w\-]+:\/+(?:www\.)?/, "||")); |
| 417 | |
| 418 if (selector) | |
| 419 selectorList.push(selector); | |
| 420 } | |
| 421 else if (selector) | |
| 422 addSelector(selector); | |
| 416 } | 423 } |
| 417 | 424 |
| 418 // restore the original style, before generating the fallback filter that | 425 // restore the original style, before generating the fallback filter that |
| 419 // will include the style, and to prevent highlightElements from saving those | 426 // will include the style, and to prevent highlightElements from saving those |
| 420 unhighlightElement(currentElement); | 427 unhighlightElement(currentElement); |
| 421 | 428 |
| 422 // as last resort, create a filter based on inline styles | 429 // as last resort, create a filter based on inline styles |
| 423 if (clickHideFilters.length == 0) | 430 if (clickHideFilters.length == 0) |
| 424 { | 431 { |
| 425 var style = elt.getAttribute("style"); | 432 var style = elt.getAttribute("style"); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 652 break; | 659 break; |
| 653 default: | 660 default: |
| 654 sendResponse({}); | 661 sendResponse({}); |
| 655 break; | 662 break; |
| 656 } | 663 } |
| 657 }); | 664 }); |
| 658 | 665 |
| 659 if (window == window.top) | 666 if (window == window.top) |
| 660 ext.backgroundPage.sendMessage({type: "report-html-page"}); | 667 ext.backgroundPage.sendMessage({type: "report-html-page"}); |
| 661 } | 668 } |
| OLD | NEW |