Skip to content

Instantly share code, notes, and snippets.

@arikui
Created May 22, 2010 01:19
Show Gist options
  • Save arikui/409653 to your computer and use it in GitHub Desktop.
Save arikui/409653 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name mobile to pc
// @namespace d.hatena.ne.jp/arikui
// @include http://twitter.com/*
// ==/UserScript==
for each(var a in document.querySelectorAll('.entry-content a')) (function(a){
if(!a.href.match("http://mobile.twitter.com/statuses/")) return;
GM_xmlhttpRequest({
method: "GET",
url: a.href,
onload: function(responseDetails){
if(responseDetails.status == 404){
a.parentNode.removeChild(a);
return;
}
var match = responseDetails.responseText.match(/href="([^"]+)"\sclass="status_link"/);
a.href = "http://twitter.com" + match[1];
a.textContent = a.href;
}
});
})(a);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment