I am going to start by doing that with Twitter. Thanks to a post on the MT.org forums, posts now have a quicker way to add links to Twitter. It uses the bit.ly API. You just need to signup for an account to get an API key. Hit the jump to see my modified code.
Another option is to use TweetMeme but their badge is pretty big, and I wanted something less obtrusive.
<script type="text/javascript">
BitlyCB.shortenResponse = function(data) {
var s = '';
var first_result;
// Results are keyed by longUrl, so we need to grab the first one.
for (var r in data.results) {
first_result = data.results[r]; break;
}
// Now get the shortURL
shortURL = first_result["shortUrl"];
document.location = "http://www.twitter.com/home/?status=" + document.title.replace(/ /g,"+") + "+" + shortURL + "+(via+@bgviews)";
}
</script>
<img src="/path/to/image.gif" title="Tweet about <$MTEntryTitle encode_html="0">" onClick="BitlyClient.shorten(document.location, 'BitlyCB.shortenResponse');">


Leave a comment