There are 5 previous versions of this script.
// ==UserScript==
// By Rob
// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html
// created: 10/13/2006
// updated: 2/18/09 to reflect the changes in woot's web site code
// updated: 6/23/09 to reflect even more changes in woot's web site code
// updated: 10/28/09 to reflect even more changes in woot's web site code, I know it's ugly but it works
// updated: 3/8/11 to reflect object name changes in woot's site's code
// ==UserScript==
// @name WootPercentage
// @description displays the numeric percentage from the sales bar
// @include http://*.woot.com*
// --------------------------------------------------------------------
//
// This is a Greasemonkey user script.
//
// To install, you need Greasemonkey: http://greasemonkey.mozdev.org/
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to "Install User Script".
// Accept the default configuration and install.
//
// To uninstall, go to Tools/Manage User Scripts,
// select "WootPercentage", and click Uninstall.
//
// --------------------------------------------------------------------
//
// WHAT IT DOES:
// 1) This script finds the percentage of woot item left and adjusts the Title appropriately
// 2) The tab will say Sold Out when necessary
// 3) If neither is found the title is left alone
// ==/UserScript==
var mainString = document.title;
var origMainString = document.title;
var reLoad = "No";
// first - is there a percentage to report ?
var percent = document.getElementById("ContentPlaceHolderLeadIn_ContentPlaceHolderLeadIn_SaleControl_PanelWootOffProgressBar"); //get the total percent bar value
if(percent != null) {
var htmlSearch = percent.innerHTML;
var pbStart = htmlSearch.indexOf("wootOffProgressBarValue", 0);
var pbValue = htmlSearch.indexOf("width:", pbStart);
var pbEnd = htmlSearch.indexOf("%", pbValue);
var percentStr = htmlSearch.substring(pbValue + 6, pbEnd);
var splitPoint = mainString.indexOf(": ", 0);
if(splitPoint > 0) {
splitPoint += 2;
mainString = mainString.substring(0, splitPoint) + "(" + percentStr + "%) " + mainString.substring(splitPoint);
} else {
mainString = "Woot: (" + percentStr + "%) One Day, One Deal (SM)";
}
if(origMainString != mainString) {
document.title = mainString;
}
reLoad = "YES";
} // end percentage check
if(reLoad == "No") {
// second - is woot sold out??
var soldoutHTML = document.body.innerHTML;
// var soldout = soldoutHTML.indexOf("ctl00_ctl00_ContentPlaceHolderLeadIn_ContentPlaceHolderLeadIn_SaleControl_HyperLinkWantOne", 0); // look for sold out
// if(soldout > 0) {
// var soStart = soldoutHTML.indexOf("soldOut", soldout);
var soStart = soldoutHTML.indexOf("soldOut", 0);
if(soStart > 0) {
document.title = "Woot: (Sold Out!) One Day, One Deal (SM)";
reLoad = "YES";
}
// }
} // end if we had to look for SoldOut
//if (document.location == "http://www.woot.com/" && reLoad == "YES")
if (reLoad == "YES")
{
setTimeout("document.location = document.location", 20000);
}