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.
http://userscripts.org/scripts/show/60734
For newbies that don't know how to implement this:
- Firefox users download Greasemonkey if you don't have it already.
- Goto the above link at Userscripts.org and download and install the script to your browser.
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.
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:
