Created
February 27, 2011 06:12
-
-
Save uu59/845954 to your computer and use it in GitHub Desktop.
This file contains 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
// ==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