Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
825
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. (function()
  2. {
  3. if( !location.href.startsWith( 'https://store.steampowered.com/account/licenses' ) )
  4. {
  5. alert( 'Please run this on Steam\'s account licenses page.' );
  6.  
  7. window.location = 'https://store.steampowered.com/account/licenses/';
  8.  
  9. return;
  10. }
  11.  
  12. let freePackages = new Set( [
  13. 251040
  14. 251041
  15. 21230
  16. ] );
  17.  
  18. [ ...document.querySelectorAll( 'a[href^="javascript:RemoveFreeLicense"]' ) ].forEach( ( element ) =>
  19. {
  20. const match = element.href.match( /javascript:RemoveFreeLicense\( ([0-9]+), '/ );
  21.  
  22. if( match !== null )
  23. {
  24. freePackages.delete( +match[ 1 ] );
  25. }
  26. } );
  27.  
  28. let loaded = 0;
  29. let modal = window.ShowBlockingWaitDialog(
  30. 'Executing…',
  31. 'Please wait until all requests finish. Ignore all the errors, let it finish.'
  32. );
  33.  
  34. const fetched = ( res ) =>
  35. {
  36. modal.Dismiss();
  37.  
  38. if( ++loaded >= freePackages.length )
  39. {
  40. modal = window.ShowBlockingWaitDialog(
  41. 'Reloading…',
  42. 'Keep in mind only 50 packages can be activated per hour.'
  43. );
  44.  
  45. location.reload();
  46. }
  47. else
  48. {
  49. modal = window.ShowBlockingWaitDialog(
  50. 'Executing…',
  51. `Loaded <b>${loaded}</b>/${freePackages.length}.`
  52. );
  53. }
  54. };
  55.  
  56. freePackages = [ ...freePackages ].slice( -50 );
  57.  
  58. for( const subid of freePackages )
  59. {
  60. window.jQuery.post(
  61. 'https://store.steampowered.com/checkout/addfreelicense/' + subid,
  62. {
  63. ajax: true,
  64. sessionid: window.g_sessionID,
  65. }
  66. ).always( fetched );
  67. }
  68. }());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement