Index: include.postload.js |
=================================================================== |
--- a/include.postload.js |
+++ b/include.postload.js |
@@ -309,7 +309,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; |
@@ -374,21 +374,26 @@ |
clickHideFilters = new Array(); |
selectorList = new Array(); |
+ |
+ var addSelector = function(selector) |
+ { |
+ clickHideFilters.push(document.domain + "##" + selector); |
+ selectorList.push(selector); |
+ }; |
+ |
if (elementId) |
- { |
- clickHideFilters.push(document.domain + "###" + elementId); |
- selectorList.push("#" + elementId); |
- } |
+ addSelector("#" + elementId); |
+ |
if (elementClasses && elementClasses.length > 0) |
{ |
- var selector = elementClasses.map(function(elClass) |
- { |
- return "." + elClass.replace(/([^\w-])/, "\\$1"); |
- }).join(""); |
+ var selector = ""; |
- clickHideFilters.push(document.domain + "##" + selector); |
- selectorList.push(selector); |
+ for (var i = 0; i < elt.classList.length; i++) |
+ selector += "." + elt.classList[i].replace(/([^\w-])/, "\\$1"); |
+ |
+ addSelector(selector); |
} |
+ |
if (url) |
{ |
clickHideFilters.push(url.replace(/^[\w\-]+:\/+(?:www\.)?/, "||")); |
@@ -398,9 +403,14 @@ |
// 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 |
+ // restore the original style, before generating the fallback filter that |
+ // will include the style, and to prevent highlightElements from saving those |
unhighlightElement(currentElement); |
+ |
+ // as last resort, create a filter based on inline styles |
+ if (clickHideFilters.length == 0 && elt.hasAttribute("style")) |
+ addSelector(elt.localName + '[style="' + elt.getAttribute("style").replace(/"/g, '\\"') + '"]'); |
+ |
// Highlight the elements specified by selector in yellow |
highlightElements(selectorList.join(",")); |
// Now, actually highlight the element the user clicked on in red |