Skip to content

Instantly share code, notes, and snippets.

@GarrettS
Created January 29, 2012 18:58
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save GarrettS/1700145 to your computer and use it in GitHub Desktop.
Save GarrettS/1700145 to your computer and use it in GitHub Desktop.
UsurpTCO
javascript: void(function(){document.addEventListener("mousedown", tcoToLinkTitleURL, true); function tcoToLinkTitleURL(ev) { var target = ev.target; if(/^http(?:s?):\/\/t.co\//.test(target.href)) target.href=target.title; } }());
@GarrettS
Copy link
Author

Save this javascript: location as a bookmark. Give it a good name like "un tco".
When visiting twitter.com, click on the bookmark.
All of your links will open without being filtered through t.co

@GarrettS
Copy link
Author

Benefits:
Avoids tracking/spying, improves performance, avoids t.co downage problems.

@GarrettS
Copy link
Author

TODO: Make a plugin for browser that us automatically activated when twitter.com is loaded, thus avoiding the need for the user to remember to activate bookmarklet. E.g. instead of:

  1. visit twitter.com
  2. click bookmarklet

With an add-on, it would be just

  1. visit twitter.com

@GarrettS
Copy link
Author

Added (?:s?) to regexp for https.

@GarrettS
Copy link
Author

Updated based on gist by @tagawa

document.addEventListener("mousedown",function(e){var%20t=e.target,u=t.getAttribute("data-expanded-url");if(t.host=="t.co"&&u)t.href=u;},true);

@GarrettS
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment