Skip to content

Instantly share code, notes, and snippets.

@uyjulian
Created March 9, 2014 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uyjulian/9454274 to your computer and use it in GitHub Desktop.
Save uyjulian/9454274 to your computer and use it in GitHub Desktop.
var allowedNames = ["DaMrNelson", "Shedletsky", "ROBLOX", "YourName"]; // Models by these people will not be removed
var buttons = document.getElementsByClassName("noranslate");
var productInfoUrl = "https://api.roblox.com/marketplace/productinfo?assetId=";
var i = 0;
function doStuff() // My function naming is glorious
{
if (buttons[i] != null)
{
var urlBack = buttons[i].getAttribute("href");
var itemWindow = window.open(urlBack);
itemWindow.addEventListener("load", function()
{
var creator = itemWindow.document.getElementById("ctl00_cphRoblox_CreatorHyperLink").innerHTML;
var allowed = false;
for (var j = 0; j < allowedNames.length; j++)
{
var name = allowedNames[j];
if (creator.toLowerCase() == name.toLowerCase())
allowed = true;
}
if (!allowed)
{
console.log("Deleting model by " + creator + " : " + urlBack);
itemWindow.document.getElementById("ctl00_cphRoblox_btnDelete").click();
var confirms = itemWindow.document.getElementsByClassName("btn-large btn-neutral");
for (var j = 0; j < confirms.length; j++) // Just because there seems to be three sometimes
{
if (confirms[j].innerHTML == "OK<span class=\"btn-text\">OK</span>")
{
confirms[j].click();
}
}
setTimeout(function()
{
itemWindow.close();
i++;
doStuff();
}, 500)
}
else
{
itemWindow.close();
i++;
doStuff();
}
});
}
else
{
console.log("Switching pages!");
i = 0;
document.getElementsByClassName("pager next")[0].click();
setTimeout(doStuff, 1000);
}
}
doStuff();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment