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(/([^a-z0-9_-])/i, "\\$1"); |
307 selectorList.push("." + elementClasses[i]); | 307 }).join(""); |
308 } | 308 |
| 309 clickHideFilters.push(document.domain + "##" + selector); |
| 310 selectorList.push(selector); |
| 311 console.log(selector); |
309 } | 312 } |
310 if (url) | 313 if (url) |
311 { | 314 { |
312 clickHideFilters.push(relativeToAbsoluteUrl(url)); | 315 clickHideFilters.push(relativeToAbsoluteUrl(url)); |
313 selectorList.push(elt.localName + '[src="' + url + '"]'); | 316 selectorList.push(elt.localName + '[src="' + url + '"]'); |
314 } | 317 } |
315 | 318 |
316 // Show popup | 319 // Show popup |
317 clickHide_showDialog(e.clientX, e.clientY, clickHideFilters); | 320 clickHide_showDialog(e.clientX, e.clientY, clickHideFilters); |
318 | 321 |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 | 586 |
584 clickHide_deactivate(); | 587 clickHide_deactivate(); |
585 } | 588 } |
586 break; | 589 break; |
587 default: | 590 default: |
588 sendResponse({}); | 591 sendResponse({}); |
589 break; | 592 break; |
590 } | 593 } |
591 }); | 594 }); |
592 } | 595 } |
OLD | NEW |