-
Notifications
You must be signed in to change notification settings - Fork 0
JS (web)
alex [dot] kramer [at] g_m_a_i_l [dot] com edited this page Oct 4, 2019
·
44 revisions
Delete entire page of reddit comments:
// Uses a basic for loop instead of $.each() in order to delay clicks by awaiting promises
for (index = 0; index < 25; index++) {
console.log("Erasing " + index);
$($("a.edit-usertext")[index]).trigger("click");
$($(".usertext-edit textarea")[index]).text("🤡");
$($(".usertext-buttons button.save")[index]).click();
console.log("Erased " + index);
await new Promise(resolve => setTimeout(resolve, 800));
console.log("Deleting " + index);
$($(".del-button .togglebutton")[0]).trigger("click");
$($(".del-button .yes")[0]).trigger("click");
console.log("Deleted " + index);
await new Promise(resolve => setTimeout(resolve, 800));
}
location.reload();
Download entire NHIS dataset:
// Uses a basic for loop instead of $.each() in order to delay clicks by awaiting timeouts
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
currentVariableCountString = $($("#dcs .number")[0]).text().trim() || "0";
currentVariableCount = parseInt(currentVariableCountString);
buttons = $(".variablesList .checkbox-column .add_variable:visible");
buttonCount = buttons.size();
targetVariableCount = buttonCount + currentVariableCount
console.log("=====> CURRENT: " + currentVariableCount + ", NEW: " + buttonCount + ", SUM: " + targetVariableCount);
for (index = 0; index < buttonCount; index++) {
$(buttons[index]).trigger("click");
await sleep(200);
}
noUpdateWaitCount = 0
while (noUpdateWaitCount < 8) {
newVariableCountString = $($("#dcs .number")[0]).text().trim() || "0";
newVariableCount = parseInt(newVariableCountString);
// console.log("====> CURRENT: " + currentVariableCount + ", NEW: " + newVariableCount)
if (newVariableCount == targetVariableCount) {
console.log("\n\n\n=====> 👍👍👍: GREAT SUCCESS! ON TO THE NEXT PAGE...\n\n\n");
$("a.next_page")[0].click();
break;
}
if (newVariableCount == currentVariableCount) {
noUpdateWaitCount++;
} else {
currentVariableCount = newVariableCount;
noUpdateWaitCount = 0;
}
await sleep(1000);
}
if (noUpdateWaitCount >= 8) {
console.log("\n\n\n=====> 🔥🔥🔥: DIDN'T ADD ALL VARIABLES! TRY AGAIN!\n\n\n");
location.reload()
}
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
stop = false;
while (stop != true) {
document.getElementById("bigCookie").click();
await sleep(.0001);
}