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

Side by Side Diff: include.postload.js

Issue 5089087581061120: Issue 1867 - Inject "Block element" dialog and overlays in root element to avoid issues with frames… (Closed)
Patch Set: Created Jan. 26, 2015, 10:14 a.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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 overlay.setAttribute('style', 'opacity:0.4; display:inline-box; overflow:hidde n; box-sizing:border-box;'); 288 overlay.setAttribute('style', 'opacity:0.4; display:inline-box; overflow:hidde n; box-sizing:border-box;');
289 var pos = getAbsolutePosition(elt); 289 var pos = getAbsolutePosition(elt);
290 overlay.style.width = elt.offsetWidth + "px"; 290 overlay.style.width = elt.offsetWidth + "px";
291 overlay.style.height = elt.offsetHeight + "px"; 291 overlay.style.height = elt.offsetHeight + "px";
292 overlay.style.left = pos[0] + "px"; 292 overlay.style.left = pos[0] + "px";
293 overlay.style.top = pos[1] + "px"; 293 overlay.style.top = pos[1] + "px";
294 overlay.style.position = position; 294 overlay.style.position = position;
295 overlay.style.zIndex = zIndex; 295 overlay.style.zIndex = zIndex;
296 296
297 // elt.parentNode.appendChild(overlay, elt); 297 // elt.parentNode.appendChild(overlay, elt);
298 document.body.appendChild(overlay); 298 document.documentElement.appendChild(overlay);
299 return overlay; 299 return overlay;
300 } 300 }
301 301
302 // Show dialog asking user whether she wants to add the proposed filters derived 302 // Show dialog asking user whether she wants to add the proposed filters derived
303 // from selected page element 303 // from selected page element
304 function clickHide_showDialog(left, top, filters) 304 function clickHide_showDialog(left, top, filters)
305 { 305 {
306 // If we are already selecting, abort now 306 // If we are already selecting, abort now
307 if (clickHide_activated || clickHideFiltersDialog) 307 if (clickHide_activated || clickHideFiltersDialog)
308 clickHide_deactivate(true); 308 clickHide_deactivate(true);
(...skipping 16 matching lines...) Expand all
325 { 325 {
326 if (clickHideFiltersDialog) 326 if (clickHideFiltersDialog)
327 clickHideFiltersDialog.style.setProperty("opacity", "0.7"); 327 clickHideFiltersDialog.style.setProperty("opacity", "0.7");
328 }; 328 };
329 clickHideFiltersDialog.onmouseover = function() 329 clickHideFiltersDialog.onmouseover = function()
330 { 330 {
331 if (clickHideFiltersDialog) 331 if (clickHideFiltersDialog)
332 clickHideFiltersDialog.style.setProperty("opacity", "1.0"); 332 clickHideFiltersDialog.style.setProperty("opacity", "1.0");
333 }; 333 };
334 334
335 document.body.appendChild(clickHideFiltersDialog); 335 document.documentElement.appendChild(clickHideFiltersDialog);
336 } 336 }
337 337
338 // Turn on the choose element to create filter thing 338 // Turn on the choose element to create filter thing
339 function clickHide_activate() { 339 function clickHide_activate() {
340 if(document == null) 340 if(document == null)
341 return; 341 return;
342 342
343 // If we are already selecting, abort now 343 // If we are already selecting, abort now
344 if (clickHide_activated || clickHideFiltersDialog) 344 if (clickHide_activated || clickHideFiltersDialog)
345 clickHide_deactivate(); 345 clickHide_deactivate();
(...skipping 22 matching lines...) Expand all
368 document.removeEventListener("mouseout", clickHide_mouseOut, true); 368 document.removeEventListener("mouseout", clickHide_mouseOut, true);
369 document.removeEventListener("click", clickHide_mouseClick, true); 369 document.removeEventListener("click", clickHide_mouseClick, true);
370 document.removeEventListener("keydown", clickHide_keyDown, true); 370 document.removeEventListener("keydown", clickHide_keyDown, true);
371 } 371 }
372 372
373 // Turn off click-to-hide 373 // Turn off click-to-hide
374 function clickHide_deactivate(keepOverlays) 374 function clickHide_deactivate(keepOverlays)
375 { 375 {
376 if (clickHideFiltersDialog) 376 if (clickHideFiltersDialog)
377 { 377 {
378 document.body.removeChild(clickHideFiltersDialog); 378 document.documentElement.removeChild(clickHideFiltersDialog);
379 clickHideFiltersDialog = null; 379 clickHideFiltersDialog = null;
380 } 380 }
381 381
382 clickHide_activated = false; 382 clickHide_activated = false;
383 clickHide_filters = null; 383 clickHide_filters = null;
384 if(!document) 384 if(!document)
385 return; // This can happen inside a nuked iframe...I think 385 return; // This can happen inside a nuked iframe...I think
386 document.removeEventListener("mouseover", clickHide_mouseOver, true); 386 document.removeEventListener("mouseover", clickHide_mouseOver, true);
387 document.removeEventListener("mouseout", clickHide_mouseOut, true); 387 document.removeEventListener("mouseout", clickHide_mouseOut, true);
388 document.removeEventListener("click", clickHide_mouseClick, true); 388 document.removeEventListener("click", clickHide_mouseClick, true);
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 lastRightClickEventValid = false; 729 lastRightClickEventValid = false;
730 else 730 else
731 lastRightClickEvent = null; 731 lastRightClickEvent = null;
732 break; 732 break;
733 } 733 }
734 }); 734 });
735 735
736 if (window == window.top) 736 if (window == window.top)
737 ext.backgroundPage.sendMessage({type: "report-html-page"}); 737 ext.backgroundPage.sendMessage({type: "report-html-page"});
738 } 738 }
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