Created
January 28, 2009 07:54
-
-
Save 958/53859 to your computer and use it in GitHub Desktop.
[Sleipnir]twitter followers checker for SeaHorse
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name twitter followers checker for SeaHorse | |
// @include http://twitter.com/home* | |
// @include https://twitter.com/home* | |
// ==/UserScript== | |
// modified for seahorse by 958 | |
// base on http://d.hatena.ne.jp/Cherenkov/20081128/p2 | |
(function(){ | |
Array.prototype.contains = function(value){ | |
for(var i in this){ | |
if( this.hasOwnProperty(i) && this[i] === value) | |
return true; | |
} | |
return false; | |
} | |
var myURL = 'http://twitter.com/'+jQuery.trim(document.getElementById('me_name').innerText); | |
var thumbURL = $(".thumb>a").get(); | |
var URLs = []; | |
for(var i=0,l=thumbURL.length;i<l;i++){ | |
if(!URLs.contains(thumbURL[i].href) && thumbURL[i].href!=myURL) | |
URLs.push(thumbURL[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){ | |
//URLs[i].firstChild.style.MozOutline = '4px double pink'; //Moz仕様のほうが優れている! | |
URLs[i].firstChild.style.border = '4px pink double'; //こっちはずれる。 | |
} | |
} | |
}); | |
})(i); | |
} | |
function GM_xmlhttpRequest(opt) { | |
var http = null; | |
http = new ActiveXObject('Microsoft.XMLHTTP'); | |
http.open(opt.method.toUpperCase(), opt.url, true); | |
if (opt.headers) { | |
for (var i in opt.headers) { | |
if (!opt.headers.hasOwnProperty(i)) continue; | |
http.setRequestHeader(i, opt.headers[i]); | |
} | |
} | |
http.onreadystatechange = function() { | |
if(http.readyState == 4){ | |
if(http.status == 200){//succeed | |
if (opt.onload) opt.onload(http); | |
} else { | |
if (opt.onerror) opt.onerror(http); | |
} | |
http = null; | |
} | |
}; | |
var send = null; | |
if (opt.data) send = opt.data; | |
http.send(send); | |
} | |
})(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment