Stack Overflow profile for md5sum

Thursday, December 25, 2008

I'm Back! + Woot Auto Buy 3 on Random Crap

It's been a while since I've posted, and while I've been gone, I've done a few interesting things, and will be posting more bits and pieces of code here now. Sorry to anyone who was hoping I was a stable blogger, and would be posting more regularly, and I will try to do better as time goes on. So now, I'm going to post one piece I spent some time on: The Woot Auto Buy 3 on Random Crap.

This script can be found and installed on Userscripts.org, using the Firefox web browser, and the Greasemonkey add-on. It will automatically click the "I want 1" button, upgrade to 3, and fill out the information on the purchase page. It doesn't yet work with PayPal, but when I make that upgrade, I will also update this post. You need to be signed in to Woot.com for this script to function properly. Enjoy!


Edit (28 Oct, 2009 14:18 GMT-0600): I'm keeping the newest version number of this script on this page now, since the script has now had 1500+ installs!

Current version:
0.20



//
// by njkrut (njkrut{at}gmail.com)
// heavily modified by (md5sum{at}yahoo.com)
// ==UserScript==
// @name Woot.com Auto Refresh and Buy 3 on Random Crap
// @namespace http://nikru.com
// @description Auto Refreshes during WootOff, then Buys 3 items on BoCs
// @include https://www.woot.com/Member/Order.aspx
// @include http://www.woot.com/
// ==/UserScript==
var doMyPostBack = function()
{
if(theForm && wantthreebutton)
{
eventTarget.value = 'ctl00$ContentPlaceHolder$ShoppingCartControl$WantedThreeButton';
eventArgument.value = '';
theForm.submit();
} else {
alert('Could Not Select Three for Unknown Reasons');
}
}

var pageItem = document.getElementById('TitleHeader');
var wantOne = document.getElementById('ctl00_ContentPlaceHolder_OrderButton');
var wantOne2 = document.getElementById('ctl00_ContentPlaceHolder_OrderButton2');
var eventTarget = document.getElementById('__EVENTTARGET');
var eventArgument = document.getElementById('__EVENTARGUMENT');
var item = document.getElementById('ctl00_ContentPlaceHolder_ShoppingCartControl_SaleTitleLabel');
var wantthreebutton = document.getElementById('ctl00_ContentPlaceHolder_ShoppingCartControl_WantedThreeButton');
var theForm = document.getElementById('aspnetForm');
var cardSecurity = document.getElementById('ctl00_ContentPlaceHolder_SecurityCodeTextBox');

if (document.location == "http://www.woot.com/" && document.getElementById("PriceSpan").innerHTML == "$0.99" && pageItem.innerHTML.substring(0,11) == "Random Crap")
{
try{
document.location = "http://www.woot.com/" + wantOne.getAttribute("href");
}catch(a){
try{
document.location = "http://www.woot.com/" + wantOne2.getAttribute("href");
}catch(e){
alert(e);
}
}
}else{
if (document.location == "http://www.woot.com/" && document.getElementById("ctl00_ContentPlaceHolder_WootOffPanel"))
{
setTimeout("document.location = document.location", 30000);
}
}

if (item.innerHTML.substring(0, 11) == "Random Crap" && wantthreebutton)
{
doMyPostBack();
}else{
if (item.innerHTML.substring(0, 11) == "Random Crap")
{
cardSecurity.value = '';
if (cardSecurity.value != '')
{
WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder$BuyButton", "", true, "", "", false, false));
}
}
}

No comments: