Skip to content

Instantly share code, notes, and snippets.

@GarrettS
Created June 21, 2012 23:46
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 GarrettS/2969301 to your computer and use it in GitHub Desktop.
Save GarrettS/2969301 to your computer and use it in GitHub Desktop.
tco no
document.addEventListener("mouseover", function(e) {
var t=e.target, u;
if(!t.href) t = t.parentNode;
if(t.href) {
if(t.host=="t.co"){
u=t.getAttribute("data-expanded-url");
if(!u && t.search) {
u=(u=t.search.match(/\burl=(.+)?&/))&&unescape(u[1]);
} else if(!u && t.title.indexOf("http") == 0) {
u = t.title;
}
if(u) t.href=u;
}
}
}, false);
/* Tersely compiled for bookmarklet use:
javascript:document.addEventListener("mouseover",function(a){var a=a.target,b;a.href||(a=a.parentNode);if(a.href&&"t.co"==a.host&&(b=a.getAttribute("data-expanded-url"),!b&&a.search?b=(b=a.search.match(/\burl=(.+)?&/))&&unescape(b[1]):!b&&0==a.title.indexOf("http")&&(b=a.title),b))a.href=b},!1);
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment