Skip to content

Instantly share code, notes, and snippets.

@baptx
Created October 12, 2014 13:33
Embed
What would you like to do?
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