Kongregate Passive Auto Rater + SWF Download Script

I came up with a simple script (updated a very old version) to autorate a game, art, or sound on Kongregate that doesn't overwrite a previous rating when you're on that page.

Last night, I also decided to add a link that will automatically extract the SWF link and be quickly available for you to simply click and download the SWF file for the game.
(broken image removed)

I've minimalized the script as much as possible to be small as possible (since I had to embed MooTools, which is also optimized). And yes, it does go through a 3rd party link so that I could properly set the headers to download with the link instead of viewing it.


For newbies that don't know how to implement this:

If you are using Chrome, or already have Greasemonkey, skip Step 1.

Yes, I know there's probably another rater like this out there, but all the ones I've seen are outdated and don't work properly with Kong's recent site revamp.

TODO: Work on detecting Shift-Click and Ctrl-Click to open the Flash in another window. Currently you'll need to right click the link for this functionality.
TODO: Find links for Unity-based games.

Code: [Select]
if( location.pathname.match( //w+// )[0] == "/games/" ) {
try {
var dlLink = document.createElement( "a" );
dlLink.appendChild( document.createTextNode( "Download Game" ) );
dlLink.href = decodeURIComponent($$("#game script")[1].innerHTML.replace(/s*/g,"").replace(/.*"game_swf":"([^"]*)",.*/,"$1").replace(/.*swfobject.embedSWF("([^"]*)".*/,"$1"));
dlLink.setAttribute( 'onclick', "window.location.assign('http://laughdonor.com/" + dlLink.href + "'); return false;" );
dlLink.alt = dlLink.title = "Download this Game!";
var dlli = document.createElement( "li" );
dlli.appendChild( dlLink );
document.getElementById('quicklinks').appendChild( dlli );
} catch (e) {}
delete dlli, dlLink;
setTimeout('if( $$('#gameinfo #game_rating .star-rating li.current-rating')[0].innerHTML.substr(10,1)=="0" ) $$('#gameinfo #game_rating .star-rating li a[class|="star"]')[Math.floor(Math.random()*5)].onclick();', 3000 );}
else setTimeout('if( $$('.star-rating-big .current-rating')[0].innerHTML.substr(10,1)=="0" ) $$('.star-rating-big a[class|="star"]')[Math.floor(Math.random()*5)].onclick();', 3000 );

Edit: Thanks VxD! :mrgreen:
cum here

Thats awesome. (broken image removed) Karma4U
Every time I try to download a game it redirects me to the site "LaughDonor" & says "Access Denied", the auto-rater works perfect, though is there any way to get it to work without making it go to the "game" tab? I know it's easy to re-click the achievements tab, but that defeats the purpose of having a program click something for you automatically..


EDIT: If you right click the "Download" button and choose "Save As..", you can download it that way  (broken image removed) Thanks!
It worked perfectly (the autorater part, which I used) until today. But it seems there was some changes in the gamepage's code, so the autorater not works anymore.
Please update it, if possible. Thanks.

Works perfectly again for 1-2 weks ago.