Skip to content

Instantly share code, notes, and snippets.

@marlun
Last active July 25, 2016 02:33
Show Gist options
  • Save marlun/a0125587d23a68089ff7 to your computer and use it in GitHub Desktop.
Save marlun/a0125587d23a68089ff7 to your computer and use it in GitHub Desktop.
Temporary fix for images not being loaded on readability.com
// On readability.com images are delivered through a secure-assets domain
// but for some reason they aren't loading. Every image is linked to their
// original source so I made this greasemonkey script which switches
// the src out for the original and it seems to work.
var imgs = document.querySelectorAll('img[src*="secure-asset"]');
for (var i = 0; i < imgs.length; i++) {
var oldImg = imgs[i];
var parentNode = oldImg.parentNode;
var newImg = new Image();
newImg.src = parentNode.href.match(/\/\/.*/)[0];
parentNode.replaceChild(newImg, oldImg);
}
@marlun
Copy link
Author

marlun commented Aug 22, 2014

Didn't work very well on Aurora because of mixed content block.

@marlun
Copy link
Author

marlun commented Aug 22, 2014

Updated to use protocol relative links to get away from mixed content blocks. Works when the source supports the protocol that ends up being used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment