This file contains 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
expandLinks: { | |
func: function (shortLink) { | |
if (shortLink.context.href.length < 30 && shortLink.context.hostname !="twitter.com") { | |
$.getJSON('http://almaer.com/endpoint/resolver.php?callback=?', | |
{url: shortLink.context.href}, function (url) { | |
if (url.length > 45) { //an URL with > 45 chars can break streamies tweet box layout, 45 is chosen randomly | |
lastAppearance = url.lastIndexOf("/"); | |
if (lastAppearance < 45 && lastAppearance > 7) { //"http://".length == 7; | |
url = url.slice(0, lastAppearance+1) + "…"; //generate friendlier URLs by slicing afer the last '/' | |
} |