|
@ -154,7 +154,6 @@ var collapser = (function() { |
|
|
var pendingRequests = {}; |
|
|
var pendingRequests = {}; |
|
|
var pendingRequestCount = 0; |
|
|
var pendingRequestCount = 0; |
|
|
var srcProps = { |
|
|
var srcProps = { |
|
|
'iframe': 'src', |
|
|
|
|
|
'img': 'src' |
|
|
'img': 'src' |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
@ -194,24 +193,36 @@ var collapser = (function() { |
|
|
entry = pendingRequests[request.id]; |
|
|
entry = pendingRequests[request.id]; |
|
|
delete pendingRequests[request.id]; |
|
|
delete pendingRequests[request.id]; |
|
|
pendingRequestCount -= 1; |
|
|
pendingRequestCount -= 1; |
|
|
|
|
|
|
|
|
|
|
|
// Not blocked
|
|
|
if ( !request.blocked ) { |
|
|
if ( !request.blocked ) { |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
target = entry.target; |
|
|
target = entry.target; |
|
|
|
|
|
|
|
|
|
|
|
// No placeholders
|
|
|
if ( collapse ) { |
|
|
if ( collapse ) { |
|
|
target.style.setProperty('display', 'none', 'important'); |
|
|
target.style.setProperty('display', 'none', 'important'); |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
tagName = target.localName; |
|
|
tagName = target.localName; |
|
|
|
|
|
|
|
|
|
|
|
// Special case: iframe
|
|
|
|
|
|
if ( tagName === 'iframe' ) { |
|
|
target.setAttribute( |
|
|
target.setAttribute( |
|
|
srcProps[tagName], |
|
|
|
|
|
placeholders[tagName].replace('{{url}}', request.url) |
|
|
|
|
|
|
|
|
'src', |
|
|
|
|
|
'data:text/html,' + encodeURIComponent(placeholders.iframe.replace('{{url}}', request.url)) |
|
|
); |
|
|
); |
|
|
if ( tagName !== 'iframe' ) { |
|
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Everything else
|
|
|
|
|
|
target.setAttribute(srcProps[tagName], placeholders[tagName]); |
|
|
target.style.setProperty('border', placeholders.border, 'important'); |
|
|
target.style.setProperty('border', placeholders.border, 'important'); |
|
|
target.style.setProperty('background', placeholders.background, 'important'); |
|
|
target.style.setProperty('background', placeholders.background, 'important'); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Renew map: I believe that even if all properties are deleted, an
|
|
|
// Renew map: I believe that even if all properties are deleted, an
|
|
|
// object will still use more memory than a brand new one.
|
|
|
// object will still use more memory than a brand new one.
|
|
|