Advertisement
Deliteplays

Wishlist Remover

Dec 22nd, 2016
1,303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function()
  2. {
  3.     jQuery.ajax({
  4.         type: 'GET',
  5.         url: '//api.steampowered.com/ISteamApps/GetAppList/v2',
  6.         dataType: 'jsonp',
  7.         success: function(result) {
  8.         var wishlist = [];
  9.         jQuery.each(result['applist']['apps'], function(key, value){
  10.             wishlist.push( value['appid'] );
  11.         });
  12.                
  13.         var i = 0,
  14.             loaded = 0,
  15.             total = wishlist.length,
  16.             modal = ShowBlockingWaitDialog( 'Removing...',
  17.                 'Please wait until all requests finish.' );
  18.  
  19.         var ExecuteRequest = function( )
  20.         {
  21.             jQuery.ajax(
  22.             {
  23.                 type: 'POST',
  24.                 dataType: 'text',
  25.                 url: '//store.steampowered.com/api/removefromwishlist',
  26.                 data:
  27.                 {
  28.                     appid: wishlist[ i ],
  29.                     sessionid: g_sessionID,
  30.                 }
  31.             }
  32.             ).always( function( )
  33.                 {
  34.                     loaded++;
  35.                    
  36.                     modal.Dismiss();
  37.                    
  38.                     if( loaded >= total )
  39.                     {
  40.                         ShowAlertDialog( 'All done!', 'Enjoy.' );
  41.                     }
  42.                     else
  43.                     {
  44.                         modal = ShowBlockingWaitDialog( 'Removing...',
  45.                             'Loaded ' + loaded + '/' + total + '. Ignore all the errors, let it finish.' );
  46.                        
  47.                         i++;
  48.                        
  49.                         ExecuteRequest();
  50.                     }
  51.                 }
  52.             );
  53.         };
  54.  
  55.         setTimeout( ExecuteRequest, 1500 );
  56.  
  57.         },
  58.         error : function(httpReq,status,exception){
  59.         ShowAlertDialog( status, 'An Error has Occured! Please refresh the page and re-execute this script' );
  60.         },
  61.        
  62.         jsonp: 'jsonp'
  63.     });
  64. }());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement