Index: include.postload.js |
=================================================================== |
--- a/include.postload.js |
+++ b/include.postload.js |
@@ -219,7 +219,7 @@ |
return; |
var target = e.target; |
- while (target.parentNode && !(target.id || target.className || target.src)) |
+ while (target.parentNode && !(target.id || target.className || target.src || /:.+:/.test(target.getAttribute("style")))) |
target = target.parentNode; |
if (target == document.documentElement || target == document.body) |
target = null; |
@@ -294,34 +294,44 @@ |
clickHideFilters = new Array(); |
selectorList = new Array(); |
- if (elementId) |
+ |
+ var addSelector = function(selector) |
{ |
- clickHideFilters.push(document.domain + "###" + elementId); |
- selectorList.push("#" + elementId); |
- } |
- if (elementClasses && elementClasses.length > 0) |
- { |
- var selector = elementClasses.map(function(elClass) |
- { |
- return "." + elClass.replace(/([^\w-])/, "\\$1"); |
- }).join(""); |
- |
clickHideFilters.push(document.domain + "##" + selector); |
selectorList.push(selector); |
+ }; |
+ |
+ if (elementId) |
+ addSelector("#" + elementId); |
+ |
+ if (elt.classList.length > 0) |
+ { |
+ var selector = ""; |
+ |
+ for (var i = 0; i < elt.classList.length; i++) |
+ selector += "." + elt.classList[i].replace(/([^\w-])/, "\\$1"); |
+ |
+ addSelector(selector); |
} |
+ |
if (url) |
{ |
clickHideFilters.push(relativeToAbsoluteUrl(url)); |
selectorList.push(elt.localName + '[src="' + url + '"]'); |
} |
+ // restore the original style, before generating the fallback filter that |
+ // will include the style, and to prevent highlightElements from saving those |
+ currentElement.style.setProperty("-webkit-box-shadow", currentElement_boxShadow); |
+ currentElement.style.backgroundColor = currentElement_backgroundColor; |
+ |
+ // as last resort, create a filter based on inline styles |
+ if (clickHideFilters.length == 0 && elt.hasAttribute("style")) |
+ addSelector(elt.localName + '[style="' + elt.getAttribute("style") + '"]'); |
+ |
// Show popup |
clickHide_showDialog(e.clientX, e.clientY, clickHideFilters); |
- // Highlight the unlucky elements |
- // Restore currentElement's box-shadow and bgcolor so that highlightElements won't save those |
- currentElement.style.setProperty("-webkit-box-shadow", currentElement_boxShadow); |
- currentElement.style.backgroundColor = currentElement_backgroundColor; |
// Highlight the elements specified by selector in yellow |
highlightElements(selectorList.join(",")); |
// Now, actually highlight the element the user clicked on in red |