Skip to content

Instantly share code, notes, and snippets.

@reacuna
Forked from pbausch/pinpoptweets.js
Last active November 10, 2016 22:27
Show Gist options
  • Save reacuna/524989a434173c18df0e3772fcc90e1e to your computer and use it in GitHub Desktop.
Save reacuna/524989a434173c18df0e3772fcc90e1e to your computer and use it in GitHub Desktop.
Embed Tweets on the Pinboard Popular Page with a bookmarklet
// Bookmarklet for Pinboard
// Show tweets in popular page
// Copied from https://www.onfocus.com/2016/11/6842/pinboard-popular-tweets
javascript:(function(){var%20s=document.createElement("script");s.type="text/javascript";s.src="https://platform.twitter.com/widgets.js";s.async=true;document.head.append(s);setTimeout(function(){var%20bookmarks=document.getElementsByClassName("bookmark_title");var%20tweets=new%20Array();for(var%20i=0;i<bookmarks.length;i++){var%20burl=bookmarks[i].getAttribute("href");var%20re=new%20RegExp("status\/(\\d{15,20})");var%20e=re.exec(burl);if(e!==null){bookmarks[i].innerHTML+='<div%20id="t'+e[1]+'"%20tweetID="'+e[1]+'"%20style="width:500px;"></div>';var%20id=e[1];var%20tweet=document.getElementById('t'+id);if(!tweets.includes(e[1])){twttr.widgets.createTweet(id,tweet,{conversation:'none',cards:'visible',linkColor:'#cc0000',theme:'light'});}tweets.push(e[1]);}}},500);})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment