Index: include.postload.js |
=================================================================== |
--- a/include.postload.js |
+++ b/include.postload.js |
@@ -381,6 +381,13 @@ |
selectorList.push(selector); |
}; |
+ var addSelectorFromAttribute = function(element, attribute) |
+ { |
+ var value = element.getAttribute(attribute); |
+ if (value) |
+ addSelector(element.localName + "[" + attribute + '="' + value.replace(/"/g, '\\"') + '"]'); |
Wladimir Palant
2014/10/24 17:56:55
This isn't a sufficient escaping approach. First o
Sebastian Noack
2014/10/30 16:36:24
The attribute name is hard-coded in the calling co
|
+ }; |
+ |
if (elementId) |
addSelector("#" + elementId); |
@@ -396,8 +403,13 @@ |
if (url) |
{ |
- clickHideFilters.push(url.replace(/^[\w\-]+:\/+(?:www\.)?/, "||")); |
- selectorList.push('[src="' + elt.getAttribute("src") + '"]'); |
+ if (/^https?:/i.test(url)) |
+ { |
+ clickHideFilters.push(url.replace(/^[\w\-]+:\/+(?:www\.)?/, "||")); |
+ selectorList.push('[src="' + elt.getAttribute("src") + '"]'); |
+ } |
+ else |
+ addSelectorFromAttribute(elt, "src"); |
} |
// Show popup |
@@ -408,8 +420,8 @@ |
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, '\\"') + '"]'); |
+ if (clickHideFilters.length == 0) |
+ addSelectorFromAttribute(elt, "style"); |
// Highlight the elements specified by selector in yellow |
highlightElements(selectorList.join(",")); |