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

Side by Side Diff: composer.postload.js

Issue 29365529: Noissue - Improve comments for composer code (Closed)
Patch Set: Created Nov. 28, 2016, 1:40 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 <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 111 }
112 } 112 }
113 113
114 // We reached the document root without finding a blockable element. 114 // We reached the document root without finding a blockable element.
115 callback(null); 115 callback(null);
116 } 116 }
117 117
118 118
119 /* Element highlighting */ 119 /* Element highlighting */
120 120
121 // Adds an overlay to an element, which is probably a Flash object. 121 // Adds an overlay to an element in order to highlight it.
122 function addElementOverlay(element) 122 function addElementOverlay(element)
123 { 123 {
124 let position = "absolute"; 124 let position = "absolute";
125 let offsetX = window.scrollX; 125 let offsetX = window.scrollX;
126 let offsetY = window.scrollY; 126 let offsetY = window.scrollY;
127 127
128 for (let e = element; e; e = e.parentElement) 128 for (let e = element; e; e = e.parentElement)
129 { 129 {
130 let style = getComputedStyle(e); 130 let style = getComputedStyle(e);
131 131
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 element.style.removeProperty("background-color"); 208 element.style.removeProperty("background-color");
209 element.style.setProperty( 209 element.style.setProperty(
210 "background-color", 210 "background-color",
211 originalBackgroundColor, 211 originalBackgroundColor,
212 originalBackgroundColorPriority 212 originalBackgroundColorPriority
213 ); 213 );
214 }; 214 };
215 }; 215 };
216 216
217 // If this element is an overlay that we've created previously then we need
218 // to give it a background colour. Otherwise we need to create an overlay
219 // and then recurse in order to set the overlay's background colour.
217 if ("prisoner" in element) 220 if ("prisoner" in element)
218 highlightWithStyleAttribute(); 221 highlightWithStyleAttribute();
219 else 222 else
220 highlightWithOverlay(); 223 highlightWithOverlay();
221 } 224 }
222 225
223 function unhighlightElement(element) 226 function unhighlightElement(element)
224 { 227 {
225 if (element && "_unhighlight" in element) 228 if (element && "_unhighlight" in element)
226 { 229 {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 340
338 341
339 /* Element selection */ 342 /* Element selection */
340 343
341 // Start highlighting elements yellow as the mouse moves over them, when one is 344 // Start highlighting elements yellow as the mouse moves over them, when one is
342 // chosen launch the popup dialog for the user to confirm the generated filters. 345 // chosen launch the popup dialog for the user to confirm the generated filters.
343 function startPickingElement() 346 function startPickingElement()
344 { 347 {
345 currentlyPickingElement = true; 348 currentlyPickingElement = true;
346 349
347 // Add overlays for blockable elements that don't emit mouse events, 350 // Add (currently invisible) overlays for blockable elements that don't emit
348 // so that they can still be selected. 351 // mouse events, so that they can still be selected.
349 Array.prototype.forEach.call( 352 Array.prototype.forEach.call(
350 document.querySelectorAll("object,embed,iframe,frame"), 353 document.querySelectorAll("object,embed,iframe,frame"),
351 element => 354 element =>
352 { 355 {
353 getFiltersForElement(element, filters => 356 getFiltersForElement(element, filters =>
354 { 357 {
355 if (filters.length > 0) 358 if (filters.length > 0)
356 addElementOverlay(element); 359 addElementOverlay(element);
357 }); 360 });
358 } 361 }
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 } 580 }
578 }); 581 });
579 } 582 }
580 break; 583 break;
581 } 584 }
582 }); 585 });
583 586
584 if (window == window.top) 587 if (window == window.top)
585 ext.backgroundPage.sendMessage({type: "composer.ready"}); 588 ext.backgroundPage.sendMessage({type: "composer.ready"});
586 } 589 }
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