Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ImBIOS/b527f3728fb5f7f8f65350030f62fd25 to your computer and use it in GitHub Desktop.
Save ImBIOS/b527f3728fb5f7f8f65350030f62fd25 to your computer and use it in GitHub Desktop.
(
function() {
let div = '<div id="progress" style="position: fixed; z-index: 1000; background-color: #424c59; padding: 1em; bottom: 1em; left: 1em; border-radius: 4px; box-shadow: 1px 2px 12px 0 black">Clearing wishlist...</div>';
document.querySelector("body").innerHTML+=div;
let progress = document.getElementById("progress");
let promises = [], count = 0;
for (let id of g_Wishlist.rgAllApps) {
let form = new FormData();
form.append('sessionid', g_sessionID);
form.append('appid', id);
promises.push(fetch(g_strWishlistBaseURL+'remove', {method: 'POST', body: form}).then(() => {
let msg = "removed app "+id+", total removed: "+count;
console.log(msg);
progress.innerHTML=msg;
count++;
}));
}
Promise.all(promises).then(() => {
console.log("done removing. refreshing...");
progress.parentNode.removeChild(progress);
location.reload();
});
}
)();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment