Index: include.postload.js |
=================================================================== |
--- a/include.postload.js |
+++ b/include.postload.js |
@@ -279,11 +279,6 @@ |
else if (elt.src) |
url = elt.src; |
- // Only normalize when the element contains a URL (issue 328.) |
- // The URL is not always normalized, so do it here |
- if (url) |
- url = normalizeURL(relativeToAbsoluteUrl(url)); |
- |
// Construct filters. The popup will retrieve these. |
// Only one ID |
var elementId = elt.id ? elt.id.split(' ').join('') : null; |
@@ -301,6 +296,13 @@ |
selectorList.push(selector); |
}; |
+ var addSelectorFromAttribute = function(element, attribute) |
+ { |
+ var value = element.getAttribute(attribute); |
+ if (value) |
+ addSelector(element.localName + "[" + attribute + '="' + value.replace(/"/g, '\\"') + '"]'); |
+ }; |
+ |
if (elementId) |
addSelector("#" + elementId); |
@@ -316,8 +318,14 @@ |
if (url) |
{ |
- clickHideFilters.push(url); |
- selectorList.push(elt.localName + '[src="' + url + '"]'); |
+ url = relativeToAbsoluteUrl(url); |
+ if (/^https?:/.test(url)) |
+ { |
+ clickHideFilters.push(normalizeURL(url)); |
+ selectorList.push(elt.localName + '[src="' + url + '"]'); |
+ } |
+ else |
+ addSelectorFromAttribute(elt, "src"); |
} |
// restore the original style, before generating the fallback filter that |
@@ -326,8 +334,8 @@ |
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") + '"]'); |
+ if (clickHideFilters.length == 0) |
+ addSelectorFromAttribute(elt, "style"); |
// Show popup |
clickHide_showDialog(e.clientX, e.clientY, clickHideFilters); |