NCPereira

Free on Demand script - OUTDATED

Nov 8th, 2014
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function()
  2. {
  3.         if( location.href.match( /^https:\/\/store\.steampowered\.com\/account\/?$/ ) === null )
  4.         {
  5.                 alert( 'Please run this on Steam\'s account page details: https://store.steampowered.com/account/''.account_table a' ).each( function( i, el )
  6.         {
  7.                 var match = el.href.match( /javascript:RemoveFreeLicense\( ([0-9]+), '/ );
  8.                
  9.                 if( match !== null )
  10.                 {
  11.                         ownedPackages[ +match[ 1 ] ] = true;
  12.                 }
  13.         } );
  14.        
  15.         var i = 0,
  16.             loaded = 0,
  17.             package = 0,
  18.             total = freePackages.length,
  19.             modal = ShowBlockingWaitDialog( 'Executing...', 'Please wait until all requests finish. Ignore all the errors, let it finish.' );
  20.        
  21.         var ExecuteRequest = function( )
  22.         {
  23.                 while( i < total && ownedPackages[ ( package = freePackages[ i ] ) ] )
  24.                 {
  25.                         i++;
  26.                         loaded++;
  27.                 }
  28.                
  29.                 jQuery.ajax(
  30.                         {
  31.                                 type: 'POST',
  32.                                 dataType: 'text',
  33.                                 url: '//store.steampowered.com/checkout/addfreelicense',
  34.                                 data:
  35.                                 {
  36.                                         action: 'add_to_cart',
  37.                                         sessionid: g_sessionID,
  38.                                         subid: package
  39.                                 }
  40.                         }
  41.                 ).always( function( )
  42.                         {
  43.                                 loaded++;
  44.                                
  45.                                 modal.Dismiss();
  46.                                
  47.                                 if( loaded >= total )
  48.                                 {
  49.                                         ShowAlertDialog( 'All done!', 'Enjoy. Original snippet from http://steamdb.info/freepackages/<br /><br />Modified by /id/NCPereira' );
  50.                                 }
  51.                                 else
  52.                                 {
  53.                                         modal = ShowBlockingWaitDialog( 'Executing...', 'Loaded ' + loaded + '/' + total + '. Ignore all the errors, let it finish.' );
  54.                                        
  55.                                         i++;
  56.                                        
  57.                                         ExecuteRequest();
  58.                                 }
  59.                         }
  60.                 );
  61.         };
  62.        
  63.         setTimeout( ExecuteRequest, 1500 );
  64. }());
Add Comment
Please, Sign In to add comment