Created
August 16, 2014 08:59
-
-
Save retvil/b666e95f0cce6bfd9f3f to your computer and use it in GitHub Desktop.
[IOC] Free Steam (Remove Modification)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///Workerd on Script: lunboks | |
///Editor: Nod33Eset | |
///Tester: | |
(function () { | |
var NUKE_REGEX = /\b(?:trailer|teaser|demo|cinematic|pegi|esrb)\b/i; | |
var PACKAGE_ID_REGEX = /javascript:\s*RemoveFreeLicense\s*\(\s*(\d+)/; | |
var REMOVE_LICENSE_API = "/account/removelicense"; | |
var RUN_ON_PAGE = "https://store.steampowered.com/account/"; | |
if (location.href !== RUN_ON_PAGE) { | |
if (confirm("You're not on your licenses page. Go now?")) { | |
location.assign(RUN_ON_PAGE); | |
} | |
return; | |
} | |
var idsToRemove = [ | |
1092, // Dystopia Comp | |
1148, // Dystopia Beta | |
1534, // Smashball | |
17500, // Zombie Panic! Source | |
1870, // Pirates, Vikings and Knights II | |
25518, // Arma II: DayZ Mod | |
32938, // Just Cause 2: Multiplayer Mod | |
33841, // Estranged: Act I | |
33842, // Estranged: Act I Beta Package | |
34512, // Just Cause 2: Multiplayer Mod Beta Testing | |
35420, // Defence Alliance 2 | |
360, // Half-Life Deathmatch: Source | |
4115, // Empires Mod | |
9008, // International Online Soccer | |
9014, // Half-Life 2: Capture the Flag 2.0 | |
9018, // Science and Industry | |
9106, // Rock 24 | |
9109, // Synergy | |
]; | |
var rows; | |
var licensesTable = document.getElementById("licenses"); | |
var packageId; | |
if (licensesTable && window.g_sessionID) { | |
licensesTable = licensesTable.getElementsByClassName("account_table")[0]; | |
rows = licensesTable.rows; | |
for (var i = 0, l = rows.length; i < l; i++) { | |
if (NUKE_REGEX.test(rows[i].cells[0].textContent)) { | |
packageId = PACKAGE_ID_REGEX.exec(rows[i].cells[1].innerHTML); | |
if (packageId !== null) { | |
idsToRemove.push(packageId[1]); | |
} | |
} | |
} | |
function removePackageAndQueueNext(packages, index) { | |
if (index >= packages.length) { | |
console.log("Packages Removed."); | |
return; // done | |
} | |
var parameters = "?sessionid=" + encodeURIComponent(g_sessionID) + "&packageid=" + encodeURIComponent(packages[index]); | |
var xhr = new XMLHttpRequest(); | |
xhr.open("HEAD", REMOVE_LICENSE_API + parameters, true); | |
xhr.onreadystatechange = function () { | |
if (this.readyState === 4) { | |
console.log("Removed Package %d/%d", index + 1, packages.length); | |
removePackageAndQueueNext(packages, index + 1); | |
} | |
}; | |
xhr.send(); | |
} | |
if (idsToRemove.length > 0) { | |
removePackageAndQueueNext(idsToRemove, 0); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment