Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: include.postload.js

Issue 5960705870135296: Fixed genrated filter rules for elements with CSS class (Closed)
Patch Set: Removed console.log() and simplified regex Created Jan. 24, 2014, 2:52 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld