Skip to content

Instantly share code, notes, and snippets.

@juanbrujo
Created March 12, 2014 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanbrujo/9508030 to your computer and use it in GitHub Desktop.
Save juanbrujo/9508030 to your computer and use it in GitHub Desktop.
Get Image from Twitter: bookmarklet that get's the image shown on certain timeline within Twitter
// The Code:
var url = $('.cards-media-container .media').attr('data-url');
if(url){
window.open(url,'_self');
} else {
alert('There\'s no photo.');
}
// The bookmarklet:
javascript:(function(e,a,g,h,f,c,b,d)%7Bif(!(f%3De.jQuery)%7C%7Cg>f.fn.jquery%7C%7Ch(f))%7Bc%3Da.createElement("script")%3Bc.type%3D"text/javascript"%3Bc.src%3D"http://ajax.googleapis.com/ajax/libs/jquery/"%2Bg%2B"/jquery.min.js"%3Bc.onload%3Dc.onreadystatechange%3Dfunction()%7Bif(!b%26%26(!(d%3Dthis.readyState)%7C%7Cd%3D%3D"loaded"%7C%7Cd%3D%3D"complete"))%7Bh((f%3De.jQuery).noConflict(1),b%3D1)%3Bf(c).remove()%7D%7D%3Ba.documentElement.childNodes%5B0%5D.appendChild(c)%7D%7D)(window,document,"1.6.2",function(%24,L)%7Bvar url %3D %24(%27.cards-media-container .media%27).attr(%27data-url%27)%3Bif(url)%7Bwindow.open(url,%27_self%27)%3B%7D else %7Balert(%27There%5C%27s no photo.%27)%3B%7D%7D)%3B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment