Excess GMail invites? Script them away!

Amazingly, people are still looking for free GMail invites. (You'd think there'd be enough floating around, but apparently not.) There are several sites that accept invites and spool them back out to anyone who asks, my favorite of which is ByteTest. Sending invite after invite to ginvites@xn0.org is not my idea of fun, but I still like the anonymizing effect of the spooler, and I wanted to help. So, I hacked together a clod of javascript to automate the process.

I present here the base code, which works in Mozilla Firefox 1.5. If you remove all the line breaks, you can enter it the FireBug console while at the address https://mail.google.com/.

var spooler = 'ginvites@xn0.org';
var waitTime = 1000;
var frames = document.getElementsByTagName("frame");
var main = undefined;
for(var i=0; i<frames.length; i++)
{
	if(frames[i].getAttribute('name') === 'main') 
	{
		main = frames[i];
		break;
	}
};
var inmain = main.contentDocument;
var v1frame = inmain.getElementById('v1');
var invitebox = v1frame.contentDocument.getElementById('nvi');
var inviter = invitebox.getElementsByTagName('form')[0];
var addybox = v1frame.contentDocument.getElementById('if');
var addysend = v1frame.contentDocument.getElementById('ib');
var lefttext = addysend.nextSibling.nextSibling.firstChild.nodeValue;
var matches = /[0-9]+/.exec(lefttext);
var remaining = (matches.length > 0 ? matches[0] : 0);
function chainOne(left)
{
	if(left==0)
	{
		return;
	}
	addybox.value = spooler;
	addysend.click();
	setTimeout(function(){chainOne(left-1)}, waitTime);
};
chainOne(remaining);

I can't figure out how to make this into a bookmarklet, though. I tried wrapping it in the standard bookmarklet code:

void(function(){ /*code goes here*/ }())

...and it would only send one invite, then stop without errors. If anyone can figure it out, please let me know! I'd like to present this as an easy-to-use bookmarklet.

I will delete on sight any comments asking for invites. Go wait in line at ByteTest.com like everyone else.


Responses: One so far

  1. Pim’s page • News » archief » Gmail invites doneren says:

    [...] Wij hebben een javascript code gemaakt, waarmee je makkelijker Gmail invites kunt doneren aan ons. Deze code in gebasseerd op de code gemaakt door Tim McCormack. [...]