Skip to content

Instantly share code, notes, and snippets.

@taizooo
Created October 20, 2010 06:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save taizooo/635884 to your computer and use it in GitHub Desktop.
Save taizooo/635884 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Tumblr Dashboard High-Res Photos
// @namespace http://cxx.tumblr.com/
// @include http://www.tumblr.com/*
// @version 0.0.5.2.20101020
// ==/UserScript==
// original : http://userscripts.org/scripts/source/43621.user.js?
(function(){
function $(selectors, context) {
return Array.prototype.slice.call((context || document).querySelectorAll(selectors), 0);
}
function replaceImage(post) {
var img = $('img[width="500"], img[height="700"]', post)[0];
if (!img || !img.src.match(/(\w+)o1_500\./))
return;
var hash = RegExp.$1;
var postId = post.id.replace('post_', '');
var host = $('a.post_avatar', post)[0].href;
var highResPath = host + 'photo/1280/' + postId + '/1/' + hash;
img.src = highResPath;
img.style.width = img.style.height = 'auto';
img.style.maxWidth = '999999px';
}
$('#posts')[0].addEventListener('DOMNodeInserted', function(e) {
replaceImage(e.target);
}, false);
var container = $('#container')[0];
if (container)
container.style.marginLeft = '0';
$('li.post').forEach(replaceImage);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment