diff --git a/ReadMe.md b/ReadMe.md
index a9cdc07..d31103a 100644
--- a/ReadMe.md
+++ b/ReadMe.md
@@ -6,43 +6,39 @@
- Version: 1.1
+ Version: 1.2
-
-
-
-
-# Description:
+# Description
This Script will remove any "Free" games from your Steam Library by removing the game's license from your account. In this way, these games will no longer appear in your library.
-# Usage:
+# Usage
1. Copy the script to your clipboard.
-2. Open your browser and go to https://store.steampowered.com/account/licenses/
+2. Open your browser and go to
3. Open the developer console (F12)
4. Paste the script into the console and press enter.
5. Wait for the script to finish.
6. Refresh the page. ( You may need to do this refresh with the cache, you can do this by pressing CTRL + F5 )
-# Notes:
+# Notes
- This script will not remove any games that you have purchased.
- This script will not remove any games that you have been gifted.
-# Disclaimer:
+# Disclaimer
- This script is provided as is. I am not responsible for any damage that may occur to your account. Use at your own risk.
- Don't change the script, especially the interval time, if you do, your browser's access to your profile settings page may be blocked by Steam for a few seconds or minutes.
+# Changelog
-# Changelog:
-
- - 1.0 - Initial Release
- - 1.1 - Added a delay between each request to avoid being blocked by Steam.
+- 1.0 - Initial Release
+- 1.1 - Added a delay between each request to avoid being blocked by Steam.
+- 1.2 - Fixed delay not working + added ETA + vanilla javascript (no jQuery)
-# Credits:
+# Credits
-- SteamDB - https://steamdb.info/
+- SteamDB -
diff --git a/SteamLicenseRemover.js b/SteamLicenseRemover.js
index 24b1f37..c6eb5a7 100644
--- a/SteamLicenseRemover.js
+++ b/SteamLicenseRemover.js
@@ -1,42 +1,39 @@
// ==UserScript==
// @name Steam License Remover
// @namespace
- // @version 1.1
- // @description Remove any "Free" games from your Steam Library by removing the game's license from your account.
+ // @version 1.2
+ // @description Remove any "Free" games from your Steam Library by removing the game's license from your account.
// @author IroN404
// @match https://store.steampowered.com/account/licenses/
-const table = document.querySelector('.account_table');
-const rows = table.querySelectorAll('tr');
-const total = rows.length;
+const removeLinkEls = document.querySelectorAll('.free_license_remove_link > a');
+let itemIds = [];
+
+removeLinkEls.forEach(el => itemIds.push(el.getAttribute('href').match(/\d+/)[0]));
+
+const total = itemIds.length;
+console.log(`Starting removal of ${total} entries`);
+const start = Date.now();
let removed = 0;
-const intervalId = setInterval(() => {
- rows.forEach(row => {
- const div = row.querySelector('.free_license_remove_link');
- if(div) {
- const removeLink = div.querySelector('a');
- if (removeLink) {
- removed += 1;
- const link = removeLink.getAttribute('href');
- const id = link.split('(')[1].split(',')[0].trim();
- jQuery.post(
- 'https://store.steampowered.com/account/removelicense',
- {
- sessionid: g_sessionID,
- packageid: id
- }
- );
- }
- }
+const intervalId = setInterval(async () => {
+ const currentId = itemIds.pop();
+ const response = await fetch('https://store.steampowered.com/account/removelicense', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+ body: `sessionid=${g_sessionID}&packageid=${currentId}`
});
+ if (!response.ok) console.error(response);
- if (removed === total) {
- console.log(`All ${total} licenses removed!`);
+ removed++;
+
+ if (!itemIds.length) {
+ console.info(`All ${total} licenses removed!`);
clearInterval(intervalId);
- }
- if (removed < total) {
- console.log(`Removed ${removed} of ${total} licenses.`);
+ } else {
+ const now = Date.now();
+ const remaining = Math.floor((now - start) / removed * (total - removed));
+ console.info(`Removed ${removed} of ${total} licenses. ETA: ${new Date(now + remaining).toLocaleTimeString()}`);
}
}, 2000);