Created
October 22, 2011 14:28
-
-
Save lumin3000/1306059 to your computer and use it in GitHub Desktop.
transform the 500px images to 1280 images in boutofcontext.com (for tumblr backup)
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
var newScript = document.createElement('script'); | |
newScript.type = 'text/javascript'; | |
newScript.src = ' https://ajax.googleapis.com/ajax/libs/mootools/1.4.1/mootools-yui-compressed.js'; | |
document.getElementsByTagName("body")[0].appendChild(newScript); | |
//###make a bookmarklet using the code before this line### | |
var post = $$('div#post'); | |
var posturl, | |
postid, | |
imageid, | |
image1280url, | |
postfragment; | |
for (var i = 0; i < post.length; i++) | |
{ | |
if ((post[i].innerHTML + '').indexOf('[ Posted <a href=') >= 0) | |
{ | |
try { | |
posturl = (post[i].innerHTML + '').split('[ Posted <a href="')[1].split('">')[0]; | |
postid = posturl.split('/post/')[1]; | |
postfragment = (post[i].innerHTML + '').split('<img src="'); | |
imageid = postfragment[1].split('/tumblr_')[1].split('o1_')[0]; | |
postfragment = [postfragment[0] + '<img src="', '">' + postfragment[1].split('">')[1]]; | |
image1280url = "http://www.tumblr.com/photo/1280/" + postid + "/1/tumblr_" + imageid; | |
post[i].innerHTML = postfragment.join(image1280url); | |
} catch(e) { | |
console.log(e + i + ':' + post[i].innerHTML) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment