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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
272 var elt = currentElement; | 272 var elt = currentElement; |
273 var url = null; | 273 var url = null; |
274 if (currentElement.className && currentElement.className == "__adblockplus__ov erlay") | 274 if (currentElement.className && currentElement.className == "__adblockplus__ov erlay") |
275 { | 275 { |
276 elt = currentElement.prisoner; | 276 elt = currentElement.prisoner; |
277 url = currentElement.prisonerURL; | 277 url = currentElement.prisonerURL; |
278 } | 278 } |
279 else if (elt.src) | 279 else if (elt.src) |
280 url = elt.src; | 280 url = elt.src; |
281 | 281 |
282 // Only normalize when the element contains a URL (issue 328.) | |
283 // The URL is not always normalized, so do it here | |
284 if (url) | |
285 url = normalizeURL(relativeToAbsoluteUrl(url)); | |
286 | |
287 // Construct filters. The popup will retrieve these. | 282 // Construct filters. The popup will retrieve these. |
288 // Only one ID | 283 // Only one ID |
289 var elementId = elt.id ? elt.id.split(' ').join('') : null; | 284 var elementId = elt.id ? elt.id.split(' ').join('') : null; |
290 // Can have multiple classes, and there might be extraneous whitespace | 285 // Can have multiple classes, and there might be extraneous whitespace |
291 var elementClasses = null; | 286 var elementClasses = null; |
292 if (elt.className) | 287 if (elt.className) |
293 elementClasses = elt.className.replace(/\s+/g, ' ').replace(/^\s+|\s+$/g, '' ).split(' '); | 288 elementClasses = elt.className.replace(/\s+/g, ' ').replace(/^\s+|\s+$/g, '' ).split(' '); |
294 | 289 |
295 clickHideFilters = new Array(); | 290 clickHideFilters = new Array(); |
296 selectorList = new Array(); | 291 selectorList = new Array(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 // No data attribute, look in PARAM child tags for a URL for the swf file | 337 // No data attribute, look in PARAM child tags for a URL for the swf file |
343 var params = elt.querySelectorAll("param[name=\"movie\"]"); | 338 var params = elt.querySelectorAll("param[name=\"movie\"]"); |
344 // This OBJECT could contain an EMBED we already nuked, in which case there' s no URL | 339 // This OBJECT could contain an EMBED we already nuked, in which case there' s no URL |
345 if(params[0]) | 340 if(params[0]) |
346 url = params[0].getAttribute("value"); | 341 url = params[0].getAttribute("value"); |
347 else { | 342 else { |
348 params = elt.querySelectorAll("param[name=\"src\"]"); | 343 params = elt.querySelectorAll("param[name=\"src\"]"); |
349 if(params[0]) | 344 if(params[0]) |
350 url = params[0].getAttribute("value"); | 345 url = params[0].getAttribute("value"); |
351 } | 346 } |
347 | |
348 if (url) | |
349 url = normalizeURL(relativeToAbsoluteUrl(url)); | |
Sebastian Noack
2014/09/22 13:27:49
I just realized that Chrome preserves slashes in U
Sebastian Noack
2014/09/22 13:37:36
Also unencoded special characters aren't encoded b
Thomas Greiner
2014/09/22 15:08:28
The question is whether we need to have a well-for
Sebastian Noack
2014/09/22 15:25:16
I don't say that the we should strip repeated slas
Sebastian Noack
2014/09/22 15:50:59
Actually using an <iframe> element is notable fast
Wladimir Palant
2014/09/22 17:39:21
That should be because Chrome does some caching of
Sebastian Noack
2014/09/23 09:40:34
Very interesting. So I agree with your point for u
Sebastian Noack
2014/09/25 07:53:18
LGTM. I created a separate issue, for using an <a>
| |
352 } else if(!url) { | 350 } else if(!url) { |
353 url = elt.getAttribute("src") || elt.getAttribute("href"); | 351 url = elt.src || elt.href; |
354 } | 352 } |
355 return url; | 353 return url; |
356 } | 354 } |
357 | 355 |
358 // This function Copyright (c) 2008 Jeni Tennison, from jquery.uri.js | 356 // This function Copyright (c) 2008 Jeni Tennison, from jquery.uri.js |
359 // and licensed under the MIT license. See jquery-*.min.js for details. | 357 // and licensed under the MIT license. See jquery-*.min.js for details. |
360 function removeDotSegments(u) { | 358 function removeDotSegments(u) { |
361 var r = '', m = []; | 359 var r = '', m = []; |
362 if (/\./.test(u)) { | 360 if (/\./.test(u)) { |
363 while (u !== undefined && u !== '') { | 361 while (u !== undefined && u !== '') { |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
559 | 557 |
560 clickHide_deactivate(); | 558 clickHide_deactivate(); |
561 } | 559 } |
562 break; | 560 break; |
563 default: | 561 default: |
564 sendResponse({}); | 562 sendResponse({}); |
565 break; | 563 break; |
566 } | 564 } |
567 }); | 565 }); |
568 } | 566 } |
OLD | NEW |