Skip to content

Instantly share code, notes, and snippets.

@takada-at
Created July 11, 2012 08:09
Show Gist options
  • Save takada-at/3088872 to your computer and use it in GitHub Desktop.
Save takada-at/3088872 to your computer and use it in GitHub Desktop.
prevent twitter's popup
// ==UserScript==
// @name prevent twitter popup
// @author at_akada
// @namespace http://d.hatena.ne.jp/at_akada/
// @include https://twitter.com/*
// ==/UserScript==
function bind(arg, f){
return function(){
return f(arg, arguments);
};
}
function main(){
var list = document.body.getElementsByTagName('a');
for(var i=0; i<list.length;++i){
if(list[i].className.indexOf('js-action-profile') >= 0 || list[i].className.indexOf('twitter-atreply') >= 0){
list[i].className = '';
list[i].addEventListener('click',
bind(list[i], function(link, args){
document.location = link.href;
args[0].stopPropagation();
args[0].preventDefault();
}));
}
}
}
setInterval(main, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment