From d83c6b7efe0c870f2c705294212062c4e238401d Mon Sep 17 00:00:00 2001 From: Timo Hocker Date: Wed, 26 Jun 2024 13:05:30 +0200 Subject: [PATCH] init --- .gitignore | 1 + README.md | 5 ++ icons/icon.png | Bin 0 -> 11375 bytes manifest.json | 31 ++++++++ site_script.js | 210 +++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 247 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 icons/icon.png create mode 100644 manifest.json create mode 100644 site_script.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bde2dfc --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/web-ext-artifacts diff --git a/README.md b/README.md new file mode 100644 index 0000000..fb18117 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# Steam Game Deleter + +- Unter about:debugging#/runtime/this-firefox -> Temporäres Addon laden -> manifest.json auswählen. +- https://store.steampowered.com/account/licenses/ (mit abschließendem slash) aufrufen +- Skript sollte laufen diff --git a/icons/icon.png b/icons/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..83f126f61a8b079d04c9b64ddd86697e37da6e49 GIT binary patch literal 11375 zcmZ{KXH*mK6D}xKeuPd?K?Et%LQ&~ODN0vSdO|OPAVeT^5Tpo^UINlYdJhRD5Q>!0 zLPtuZ2ay_jm3H~xZ}-F9FS9#)=6!e1p4oZkc_!+W{tNnBcW#l9kue>&Cam)a$ZSE4(iZ&Y?0$l|42QAoGP9Na693?T=7Hg#QPTN$$SrQs8A&M z(=t=AX+_@%y`PxE#~iNXPQxolt(BN=eSZ0xI@lv&t#qq&UB1Y#YQ^{Jn`0wZpLD!g zI~g>Im6tb2=0%Ba(D3|svx~No|4~~g=qwD*&#(Mo>KPKfAQ74LF;fs@=i93hAip?nA&Vz$L@L8_YBY2lQdfYi z(&k(yiUJWd4vju@xK=6}ajef%;;l$apJf~pfv;mKe?WMgE=KlMf8HjV)sQz#f(l*0 zCCwi2hG+s@!D8BQYM{B>Pd^^BZ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bv26ZujTsUj+WR95aL8&sHMvqR+-r}u_z&9K4z;62WdzSUP^Y|pSr)jj-A5k zMAck$m4PZfpvib;256g|UBZtZg)5p~c29yMIN$|Q7+A&6J1Hg9^}%B|5aG&0NPH^w zUH7%{p0~EN_Wk};woQIQ4wt_I8~Ig?Hw0F+;2!k^B5jJQ&JQ|bbv=^0CW653x1hpY&B zSmHH*CpZ9cU&HCqJyXyJJ5>TRLk)&nR9>YY8iMR~u6tYt5_@ zRl8#oPU?^(unRBY8$ieZD-~a}e>7{%*XYMn&;70kG(zn_Ca;iR;3c3!Ef?OYT{R40 z4j^d!*=myEiec(`dn&X#-xj{yYMZEbz|oySDCYAOb39k^x_S9LexM$4J%!8fsbS)2 zXYFY(Z~M{y+K@>}NJ)xGJQ0(UeJdd?FZEbnQdUGlLS91Rt29l{{}bTqX6NMK`~MHP Uc#nK=9YCg~p|4)4Y8Co_0N~1+SpWb4 literal 0 HcmV?d00001 diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..7506a6c --- /dev/null +++ b/manifest.json @@ -0,0 +1,31 @@ +{ + "manifest_version": 2, + "name": "Steam Game Delete", + "description": "Deletes Free Steam games from library", + "version": "0.0.1", + "icons": { + "128": "icons/icon.png" + }, + "permissions": [ + "tabs", + "https://store.steampowered.com/account/licenses/" + ], + "background": { + "scripts": ["parsers.js", "background.js"] + }, + "browser_specific_settings": { + "gecko": { + "id": "steam-games-delete@scode.ovh" + } + }, + "content_scripts": [ + { + "matches": ["https://store.steampowered.com/account/licenses/"], + "js": ["site_script.js"] + } + ], + "browser_action": { + "default_icon": "icons/icon.png", + "default_title": "Steam Game Deleter" + } +} diff --git a/site_script.js b/site_script.js new file mode 100644 index 0000000..4206408 --- /dev/null +++ b/site_script.js @@ -0,0 +1,210 @@ +(function() { +const delay = 500; +const licensesUrl = `https://store.steampowered.com/account/licenses/`; +const removeLicensesUrl = `https://store.steampowered.com/account/removelicense`; + const warningString = 'Code cannot be executed here. You will be automatically redirected to the correct page. Please run this code on Steam\'s account page details: store.steampowered.com/account/licenses'; + const analysisHeader = 'Analyzing...'; + const analysisText = 'Please wait until analysis is complete.'; + const headerString = 'Games removing'; + const okString = 'Remove'; + const cancelString = 'Cancel'; + const mainInfo = 'You have game(s) can be removed.
Enter the number of games you want to remove.'; + const errorMessage = 'Enter number from 0 to '; + const removingHeader = 'In Progress...'; + const removingText = 'Don\'t forget to say thanks if you like the script ;) Removed:'; +const noGamesToRemoveMessage = 'There are no games available for removing.' + const rateLimitedMessage = 'You have been rate limited, try again later!' + const errorMessage2 = 'An error was encountered while processing your request:' +if (location.href != (licensesUrl)) { + alert(warningString); +window.location = (licensesUrl); +return; +} + + var freeLicensePackages = []; + var modal = ShowBlockingWaitDialog(analysisHeader, analysisText); + +jQuery('.free_license_remove_link a').each(function(i, el) { +var matched = decodeURI(el.href).match(/\d{4,}/); +if (matched !== null) { +freeLicensePackages.push(+matched); +} +}); +modal.Dismiss(); + + var total = freeLicensePackages.length; + if (total == 0) { + alert(noGamesToRemoveMessage); + return; + } + var enteredNumber = total; + + var desc = jQuery(`
${mainInfo}
${errorMessage}${total}
`); + var main = jQuery(`
${headerString}
${okString}
${cancelString}
`); + + jQuery('body').append(main); + jQuery('#cancelButton').on('click', function (event) { + jQuery('.newmodal').remove(); + jQuery('.newmodal_background').remove(); + }); + jQuery('#mainDiv').html(desc); + jQuery('#numberGames').text(total); + jQuery('#games_number').val(total); + jQuery('#games_number').on('change', function (event) { + var input = jQuery(this); + var value = +input.val(); + if (!Number.isInteger(value) || value > total || value <= 0) { + input.css('border-color', 'red'); + input.next('span').show(); + jQuery('#okButton').hide(); + } + else { + enteredNumber = value; + input.css('border-color', ''); + input.next('span').hide(); + jQuery('#okButton').show(); + } +}); + +var removed = 0; +jQuery('#okButton').on('click', function (event) { +jQuery('.newmodal').remove(); + jQuery('.newmodal_background').remove(); + proceed(); + }); +const proceed = () => { + if (modal) { + modal.Dismiss(); + } + if (removed >= enteredNumber) { +location.reload(); +} +else { +modal = ShowBlockingWaitDialog(removingHeader, `${removingText} ${removed}/${enteredNumber}.`); + deleteFunc(removed++); +} +}; + const deleteFunc = (index) => { + jQuery.ajax({url: removeLicensesUrl, +type: 'POST', + data: { packageid: freeLicensePackages[index], sessionid: g_sessionID }, + success: function ( response ) { + if ( response.success == 1 ) { + setTimeout(() => proceed(), delay) + } + else { + modal.Dismiss(); + if (response.success = 84) + ShowAlertDialog( 'Error', rateLimitedMessage + ' Error: ' + response.success); + else + ShowAlertDialog( 'Error', errorMessage2 + ' ' + response.success); +... (5 lines left) +Collapse +message.txt +5 KB + +(function() { + const delay = 500; + const licensesUrl = `https://store.steampowered.com/account/licenses/`; + const removeLicensesUrl = `https://store.steampowered.com/account/removelicense`; + const warningString = 'Code cannot be executed here. You will be automatically redirected to the correct page. Please run this code on Steam\'s account page details: store.steampowered.com/account/licenses'; + const analysisHeader = 'Analyzing...'; + const analysisText = 'Please wait until analysis is complete.'; + const headerString = 'Games removing'; + const okString = 'Remove'; + const cancelString = 'Cancel'; + const mainInfo = 'You have game(s) can be removed.
Enter the number of games you want to remove.'; + const errorMessage = 'Enter number from 0 to '; + const removingHeader = 'In Progress...'; + const removingText = 'Don\'t forget to say thanks if you like the script ;) Removed:'; + const noGamesToRemoveMessage = 'There are no games available for removing.' + const rateLimitedMessage = 'You have been rate limited, try again later!' + const errorMessage2 = 'An error was encountered while processing your request:' + if (location.href != (licensesUrl)) { + alert(warningString); + window.location = (licensesUrl); + return; + } + + var freeLicensePackages = []; + var modal = ShowBlockingWaitDialog(analysisHeader, analysisText); + + jQuery('.free_license_remove_link a').each(function(i, el) { + var matched = decodeURI(el.href).match(/\d{4,}/); + if (matched !== null) { + freeLicensePackages.push(+matched); + } + }); + modal.Dismiss(); + + var total = freeLicensePackages.length; + if (total == 0) { + alert(noGamesToRemoveMessage); + return; + } + var enteredNumber = total; + + var desc = jQuery(`
${mainInfo}
${errorMessage}${total}
`); + var main = jQuery(`
${headerString}
${okString}
${cancelString}
`); + + jQuery('body').append(main); + jQuery('#cancelButton').on('click', function (event) { + jQuery('.newmodal').remove(); + jQuery('.newmodal_background').remove(); + }); + jQuery('#mainDiv').html(desc); + jQuery('#numberGames').text(total); + jQuery('#games_number').val(total); + jQuery('#games_number').on('change', function (event) { + var input = jQuery(this); + var value = +input.val(); + if (!Number.isInteger(value) || value > total || value <= 0) { + input.css('border-color', 'red'); + input.next('span').show(); + jQuery('#okButton').hide(); + } + else { + enteredNumber = value; + input.css('border-color', ''); + input.next('span').hide(); + jQuery('#okButton').show(); + } + }); + + var removed = 0; + jQuery('#okButton').on('click', function (event) { + jQuery('.newmodal').remove(); + jQuery('.newmodal_background').remove(); + proceed(); + }); + const proceed = () => { + if (modal) { + modal.Dismiss(); + } + if (removed >= enteredNumber) { + location.reload(); + } + else { + modal = ShowBlockingWaitDialog(removingHeader, `${removingText} ${removed}/${enteredNumber}.`); + deleteFunc(removed++); + } + }; + const deleteFunc = (index) => { + jQuery.ajax({url: removeLicensesUrl, + type: 'POST', + data: { packageid: freeLicensePackages[index], sessionid: g_sessionID }, + success: function ( response ) { + if ( response.success == 1 ) { + setTimeout(() => proceed(), delay) + } + else { + modal.Dismiss(); + if (response.success = 84) + ShowAlertDialog( 'Error', rateLimitedMessage + ' Error: ' + response.success); + else + ShowAlertDialog( 'Error', errorMessage2 + ' ' + response.success); + } + } + }) + }; +}()); \ No newline at end of file