Skip to content

Instantly share code, notes, and snippets.

@uu59
Created February 27, 2011 06:12
Show Gist options
  • Save uu59/845954 to your computer and use it in GitHub Desktop.
Save uu59/845954 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Tumblr Auto Image Expansion
// @namespace http://twitter.com/uu59
// @include http://www.tumblr.com/*
// ==/UserScript==
(function(){
function auto_image_expansion(target) {
var doc = target || document;
var img = doc.querySelectorAll('div.post_content p img.inline_external_image');
var click = unsafeWindow.document.createEvent('MouseEvent');
click.initEvent('click', false, true);
Array.prototype.forEach.call(img, function(im) {
im.dispatchEvent(click);
});
}
unsafeWindow.addEventListener('AutoPagerize_DOMNodeInserted', function(ev){
GM_log('AutoPagerize_DOMNodeInserted');
auto_image_expansion(ev.target);
}, false);
auto_image_expansion(document);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment