Last active
July 25, 2016 02:33
-
-
Save marlun/a0125587d23a68089ff7 to your computer and use it in GitHub Desktop.
Temporary fix for images not being loaded on readability.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} |
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
Didn't work very well on Aurora because of mixed content block.