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

Unified Diff: include.postload.js

Issue 6008293193416704: Issue 2080 - Removed duplicated code from clickHide_deactivate (Closed)
Patch Set: Created March 3, 2015, 3:43 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
@@ -271,7 +271,7 @@
{
// If we are already selecting, abort now
if (clickHide_activated || clickHideFiltersDialog)
- clickHide_deactivate(true);
+ clickHide_rulesPending();
kzar 2015/03/04 10:20:21 Nit: Seems like weird mix of camel case with snake
Sebastian Noack 2015/03/04 10:47:09 Yes, function names should be properly camelcase'd
clickHide_filters = filters;
@@ -348,46 +348,32 @@
}
// Turn off click-to-hide
kzar 2015/03/04 10:20:21 I don't think this comment really adds anything.
Sebastian Noack 2015/03/04 10:47:09 Also not really matter of this change, but fair en
-function clickHide_deactivate(keepOverlays)
+function clickHide_deactivate()
{
+ clickHide_rulesPending();
+
if (clickHideFiltersDialog)
{
document.documentElement.removeChild(clickHideFiltersDialog);
clickHideFiltersDialog = null;
}
- clickHide_activated = false;
clickHide_filters = null;
- if(!document)
- return; // This can happen inside a nuked iframe...I think
+ lastRightClickEvent = null;
- document.removeEventListener("mousedown", clickHide_stopPropagation, true);
- document.removeEventListener("mouseup", clickHide_stopPropagation, true);
- document.removeEventListener("mouseenter", clickHide_stopPropagation, true);
- document.removeEventListener("mouseleave", clickHide_stopPropagation, true);
- document.removeEventListener("mouseover", clickHide_mouseOver, true);
- document.removeEventListener("mouseout", clickHide_mouseOut, true);
- document.removeEventListener("click", clickHide_mouseClick, true);
- document.removeEventListener("keydown", clickHide_keyDown, true);
+ if (currentElement) {
+ currentElement.removeEventListener("contextmenu", clickHide_elementClickHandler, true);
+ unhighlightElements();
+ unhighlightElement(currentElement);
+ currentElement = null;
+ }
+ unhighlightElements();
- if (keepOverlays !== true)
- {
- lastRightClickEvent = null;
+ var overlays = document.getElementsByClassName("__adblockplus__overlay");
+ while (overlays.length > 0)
+ overlays[0].parentNode.removeChild(overlays[0]);
- if (currentElement) {
- currentElement.removeEventListener("contextmenu", clickHide_elementClickHandler, true);
- unhighlightElements();
- unhighlightElement(currentElement);
- currentElement = null;
- }
- unhighlightElements();
-
- var overlays = document.getElementsByClassName("__adblockplus__overlay");
- while (overlays.length > 0)
- overlays[0].parentNode.removeChild(overlays[0]);
-
- ext.onExtensionUnloaded.removeListener(clickHide_deactivate);
- }
+ ext.onExtensionUnloaded.removeListener(clickHide_deactivate);
}
function clickHide_stopPropagation(e)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld