Auto Login + Auto Rater + Auto Rater Counter
Ok, so from another topic, I realized we could make a script (even a GreaseMonkey script) to automate some things for us. So I'd like to present an Auto Login (if your credentials are stored by the browser [i.e. Username/Pass]), and an Auto Rater script. You just have to visit the game page to automatically rate it.
Code to just click the "Sign In" Button on any kongregate page. (Include: http://*.kongregate.com/*). You may download/install from userscripts.org.
if( document.getElementById("welcome_box_sign_in_button") )
document.getElementById( "welcome_box_sign_in_button" ).click();
Code to autorate (after 3 seconds, you can change the 3000 milliseconds in the code if you wish to change this) a game, sound, or art for a page you visit. If a rating exists, it doesn't do anything. If you wish to rate on top of it, you can rate it normally by clicking. Recommended to download/install the script from userscripts.org.
if( location.pathname.match( //w+// )[0] == "/games/" ) setTimeout('if( document.getElementById("below_game_star_ratings_block").childNodes[1].childNodes[1].firstChild.nodeValue=="Currently 0.0/5 Stars.") document.getElementById("below_game_star_ratings_block").childNodes[1].childNodes[Math.floor(Math.random()*5)*2+3].firstChild.onclick();', 3000 );
else setTimeout('if( document.getElementById("feature").childNodes[3].childNodes[5].childNodes[1].innerHTML=="Currently 0.0/5 Stars.") document.getElementById("feature").childNodes[3].childNodes[5].childNodes[Math.floor(Math.random()*5)*2+3].childNodes[1].onclick();', 3000 );
Edit: I finished working on a counter which uses cookies and expires them at Midnight US Pacific Time. There may be a bug depending on how daylight savings may affect it, but other than that, I don't think so.
Usage: Goto your points page, and go through the first few pages until you're finished with today's points. It will automatically count and post the total games rated for which you have received points for. It will avoid duplicates and only work on your points page. (Include: http://*.kongregate.com/accounts/*/rewards*). Recommended to download/install from userscripts.org.
var ratings=0;
var rated="";
var rc=document.cookie.split(";");
for(var i in rc){
rc[i]=unescape(rc[i]);
if(match=rc[i].match(/ratings=d+$/))
ratings=match[0].substr(8);
if(match=rc[i].match(/rated=.*$/))
rated=match[0].substr(6);
if(match=rc[i].match(/kong_user_data=.*$/))
if(location.pathname.match(//w+/g )[1].substr(1)!=match[0].match(/"username":"w*"/)[0].split('"')[3])return;
}
var span=document.createElement("li");
span.innerHTML="Total Rated Games Today: <span id='ratings' style='font-weight:bold;color:black'>"+ratings+"</span>";
span.style.textTransform="capitalize";
document.getElementById("secondary").childNodes[1].appendChild(span);
Date.prototype.getMonthName=function(){return['Jan. ','Feb. ','Mar. ','Apr. ','May. ','Jun. ','Jul. ','Aug. ','Sep. ','Oct. ','Nov. ','Dec. '][this.getUTCMonth()];};
var today=new Date();
today.setUTCHours(today.getUTCHours()-8);
var date=today.getMonthName()+today.getUTCDate()+", "+today.getUTCFullYear();
var row=document.getElementById("secondary").childNodes[5].childNodes[3].firstChild;
do{
row=row.nextSibling;
if(row.className=="summary")break;
if(row.childNodes[1].innerHTML!=date)continue;
if(row.childNodes[5].firstChild.innerHTML!="Rated game")continue;
if(rated.search(row.childNodes[5].childNodes[2].childNodes[1].innerHTML+";")+1)continue;
rated+=row.childNodes[5].childNodes[2].childNodes[1].innerHTML+";";
ratings++;
}while(row=row.nextSibling);
today.setUTCHours(23);
today.setUTCMinutes(59);
today.setUTCSeconds(59);
today.setUTCMilliseconds(999);
today.setUTCHours(today.getUTCHours()+8);
document.cookie="ratings="+ratings+"; expires="+today.toUTCString()+"; path=/";
document.cookie="rated="+escape(rated)+"; expires="+today.toUTCString()+"; path=/";
document.getElementById("ratings").innerHTML=ratings;
Edit2: I updated the auto-rater to include art and sounds. They're found under the Community->Collabs section of Kongregate.
Hopefully this will help out everyone. ^^ Enjoy!
