chacham / Woot new message notify

// ==UserScript==
// @name	Woot new message notify
// @namespace	http://www.example.com/chacham/
// @description	Notify user that a new message has arrived in the Woot forums.
// @include	http://*.woot.com/forums/*
// @grant	GM_getValue
// @grant	GM_setValue
// @version	1.0
// ==/UserScript==

// Get the stored and current message counts.
var amount_stored = GM_getValue('woot_pm_count', 0);
var amount_now = document.getElementById('ContentPlaceHolderPrimaryContent_ForumTabView_ForumGroupRepeater_A1_0').childNodes[1].textContent;

// Alert if the number is greater.
if(amount_now > amount_stored) alert('Message amount has grown since last time: ' + (amount_now - amount_stored));

// Only write to the db if we need to:
if(amount_now != amount_stored) GM_setValue('woot_pm_count', amount_now);