Forked from taizooo/tumblr_dashboard_high-re.user.js
Last active
June 13, 2017 17:34
-
-
Save rwilkes/ebf4b5498a4a1aeee32e86af8b2070de to your computer and use it in GitHub Desktop.
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
// ==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