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-2013 Eyeo GmbH | 3 * Copyright (C) 2006-2013 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 if (elt.className) | 292 if (elt.className) |
293 elementClasses = elt.className.replace(/\s+/g, ' ').replace(/^\s+|\s+$/g, ''
).split(' '); | 293 elementClasses = elt.className.replace(/\s+/g, ' ').replace(/^\s+|\s+$/g, ''
).split(' '); |
294 | 294 |
295 clickHideFilters = new Array(); | 295 clickHideFilters = new Array(); |
296 selectorList = new Array(); | 296 selectorList = new Array(); |
297 if (elementId) | 297 if (elementId) |
298 { | 298 { |
299 clickHideFilters.push(document.domain + "###" + elementId); | 299 clickHideFilters.push(document.domain + "###" + elementId); |
300 selectorList.push("#" + elementId); | 300 selectorList.push("#" + elementId); |
301 } | 301 } |
302 if (elementClasses) | 302 if (elementClasses && elementClasses.length > 0) |
303 { | 303 { |
304 for(var i = 0; i < elementClasses.length; i++) | 304 var selector = elementClasses.map(function(elClass) |
305 { | 305 { |
306 clickHideFilters.push(document.domain + "##." + elementClasses[i]); | 306 return "." + elClass.replace(/([^\w-])/, "\\$1"); |
307 selectorList.push("." + elementClasses[i]); | 307 }).join(""); |
308 } | 308 |
| 309 clickHideFilters.push(document.domain + "##" + selector); |
| 310 selectorList.push(selector); |
309 } | 311 } |
310 if (url) | 312 if (url) |
311 { | 313 { |
312 clickHideFilters.push(relativeToAbsoluteUrl(url)); | 314 clickHideFilters.push(relativeToAbsoluteUrl(url)); |
313 selectorList.push(elt.localName + '[src="' + url + '"]'); | 315 selectorList.push(elt.localName + '[src="' + url + '"]'); |
314 } | 316 } |
315 | 317 |
316 // Show popup | 318 // Show popup |
317 clickHide_showDialog(e.clientX, e.clientY, clickHideFilters); | 319 clickHide_showDialog(e.clientX, e.clientY, clickHideFilters); |
318 | 320 |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 | 585 |
584 clickHide_deactivate(); | 586 clickHide_deactivate(); |
585 } | 587 } |
586 break; | 588 break; |
587 default: | 589 default: |
588 sendResponse({}); | 590 sendResponse({}); |
589 break; | 591 break; |
590 } | 592 } |
591 }); | 593 }); |
592 } | 594 } |
OLD | NEW |