Skip to content

Instantly share code, notes, and snippets.

@cherenkov
Created November 27, 2008 22:14
Show Gist options
  • Save cherenkov/29842 to your computer and use it in GitHub Desktop.
Save cherenkov/29842 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name twitter_followers_checker
// @namespace http://d.hatena.ne.jp/Cherenkov/
// @include http*://twitter.com/home*
// @include http*://twitter.com/friends*
// @include http*://twitter.com/followers*
// ==/UserScript==
Array.prototype.contains = function(value){
for(var i in this){
if( this.hasOwnProperty(i) && this[i].toString() === value.toString()){ //
return true;
}
}
return false;
}
var myURL = 'http://twitter.com/'+document.getElementById('me_name').textContent;
var thumbURL = document.evaluate("//td[contains(@class,'thumb')]/a", document, null, 7, null);
var URLs = [];
for(var i=0;i<thumbURL.snapshotLength;i++){
if(!URLs.contains(thumbURL.snapshotItem(i)) && thumbURL.snapshotItem(i).href!=myURL){
URLs.push(thumbURL.snapshotItem(i));
}
}
for(var i=0;i<URLs.length;i++){
(function(i){
GM_xmlhttpRequest({
method: 'GET',
url: URLs[i].href,
onload: function(res){
var id = URLs[i].href.replace(/https*\:\/\/twitter\.com\//,'');
if(/<a href\="\/direct_messages\/create/.test(res.responseText) === false){
for(var j=0;j<thumbURL.snapshotLength;j++){
if(thumbURL.snapshotItem(j).href===URLs[i].href){
thumbURL.snapshotItem(j).firstChild.style.MozOutline = '4px double pink';
}
}
unsafeWindow.console.log('not follower. > '+id);
}else{
unsafeWindow.console.log('follower! > '+id);
}
}
});
})(i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment