// grkillstart.user.js
//
// ==UserScript==
// @name          Google Reader Kill Stars
// @namespace     http://www.devoresoftware.com/gm/gris
// @description	  Remove all stars from visible Google Reader items
// @include       http://www.google.com/reader/*
// @include       https://www.google.com/reader/*
// ==/UserScript==
//

function main()
{
//	var xpath = "//DIV[@id='entries']//DIV[@class='entry-icons']/DIV[@class='item-star-active']";
	var xpath = "//DIV[@id='entries']//DIV[@class='entry-icons']/DIV[contains(@class,'item-star-active')]";
	var starDivs = document.evaluate(
		xpath,
		document,
		null,
		XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
		null
	);

	for (var i = 0; i < starDivs.snapshotLength; i++)
	{
 		var candidate = starDivs.snapshotItem(i);
		var oEvent = document.createEvent("MouseEvents");
		oEvent.initMouseEvent("click", true, true, window, 1, 1, 1, 1, 1, false, false, false, false, 0, null);
		candidate.dispatchEvent(oEvent);
	}
}

GM_registerMenuCommand("Remove stars in Google Reader", main, "", "", "R");

