There are 1 previous version of this script.
// ==UserScript==
// @name Image Expander
// @namespace http://blog.bcse.info/image-expander
// @description Expand *.jpg, *.jpeg, *.png and *.gif
// @version 0.3.2
// @include *
// ==/UserScript==
var prefix = document.documentElement.namespaceURI ? 'xhtml:' : '';
var imgLinks = document.evaluate(
'//' + prefix + 'a[' + prefix + 'img and not(preceding-sibling::' + prefix + 'img) and not(following-sibling::' + prefix + 'img) and not(text()) and ((substring(@href, string-length(@href) - 2) = "jpg") or (substring(@href, string-length(@href) - 3) = "jpeg") or (substring(@href, string-length(@href) - 2) = "png") or (substring(@href, string-length(@href) - 2) = "gif"))]',
document,
function(){ return document.documentElement.namespaceURI; },
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
for (var i = 0; i < imgLinks.snapshotLength; i++) {
var showImage = false;
thisLink = imgLinks.snapshotItem(i);
var imageUri = thisLink.getAttribute('href');
(function(imageUri, thisLink){
var img = document.createElement('img');
img.addEventListener('load', function(){thisLink.parentNode.replaceChild(img, thisLink)}, false);
img.setAttribute('src', imageUri);
})(imageUri, thisLink);
}
