Skip to content

Instantly share code, notes, and snippets.

@baptx
Created October 12, 2014 13:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baptx/c43a38709bb87fb80702 to your computer and use it in GitHub Desktop.
Save baptx/c43a38709bb87fb80702 to your computer and use it in GitHub Desktop.
Twitter URI resolver (t.co links)
var linksLength = document.getElementsByClassName("twitter-timeline-link").length;
for (var i = 0; i < linksLength; i++) {
var link = document.getElementsByClassName("twitter-timeline-link")[i];
if (link.getAttribute("data-ultimate-url"))
link.setAttribute("href", link.getAttribute("data-ultimate-url"));
else
link.setAttribute("href", link.getAttribute("data-expanded-url"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment