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

Unified Diff: include.postload.js

Issue 4923599135703040: Issue 1610 - Don't remove overlays before the "Block element" dialog is closed (Closed)
Patch Set: Rebased and addressed comments Created Nov. 26, 2014, 2:40 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include.postload.js
===================================================================
--- a/include.postload.js
+++ b/include.postload.js
@@ -309,11 +309,7 @@
{
// If we are already selecting, abort now
if (clickHide_activated || clickHideFiltersDialog)
- {
- var savedElement = (currentElement.prisoner ? currentElement.prisoner : currentElement);
- clickHide_deactivate();
- currentElement = savedElement;
- }
+ clickHide_deactivate(true);
clickHide_filters = filters;
@@ -375,7 +371,7 @@
}
// Turn off click-to-hide
-function clickHide_deactivate()
+function clickHide_deactivate(keepOverlays)
{
if (clickHideFiltersDialog)
{
@@ -383,15 +379,6 @@
clickHideFiltersDialog = null;
}
- if(currentElement) {
- currentElement.removeEventListener("contextmenu", clickHide_elementClickHandler, true);
- unhighlightElements();
- unhighlightElement(currentElement);
- currentElement = null;
- clickHideFilters = null;
- }
- unhighlightElements();
-
clickHide_activated = false;
clickHide_filters = null;
if(!document)
@@ -401,11 +388,21 @@
document.removeEventListener("click", clickHide_mouseClick, true);
document.removeEventListener("keydown", clickHide_keyDown, true);
- // Remove overlays
- // For some reason iterating over the array returend by getElementsByClassName() doesn't work
- var elt;
- while(elt = document.querySelector('.__adblockplus__overlay'))
- elt.parentNode.removeChild(elt);
+ if (!keepOverlays)
+ {
+ if (currentElement) {
+ currentElement.removeEventListener("contextmenu", clickHide_elementClickHandler, true);
+ unhighlightElements();
+ unhighlightElement(currentElement);
+ currentElement = null;
+ clickHideFilters = null;
+ }
+ unhighlightElements();
+
+ var overlays = document.getElementsByClassName("__adblockplus__overlay");
+ while (overlays.length > 0)
+ overlays[0].parentNode.removeChild(overlays[0]);
+ }
}
function clickHide_elementClickHandler(ev) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld