Skip to content

Instantly share code, notes, and snippets.

@wsanchez
Last active July 16, 2019 23:14
Show Gist options
  • Save wsanchez/67b1d4552dbdefab4b8685de1564340e to your computer and use it in GitHub Desktop.
Save wsanchez/67b1d4552dbdefab4b8685de1564340e to your computer and use it in GitHub Desktop.
function check_all_on_page() {
for (const checkbox of document.getElementsByClassName("checkbox")) {
if (checkbox.checked == false) {
checkbox.click();
}
}
}
function open_approve_dialog() {
const approve = document.getElementById("utility_6f7351657f795bc1357a53142b1184cc");
if (approve === null) {
window.requestAnimationFrame(open_approve_dialog);
} else {
approve.click();
allow_requested();
}
}
function allow_requested() {
const yes = document.getElementById("give_requested");
if (yes === null) {
window.requestAnimationFrame(allow_requested);
} else {
yes.click();
submit_approval();
}
}
function submit_approval() {
const buttons = document.getElementsByClassName("button_input");
if (buttons.length == 0) {
window.requestAnimationFrame(submit_approval);
} else {
buttons[0].click();
}
// // This works, but doesn't return you to the list, gives you an empty JSON dict instead
// const form = document.getElementById("status_form");
// if (form === null) {
// window.requestAnimationFrame(submit_approval);
// } else {
// form.submit();
// }
}
function approve_checked() {
open_approve_dialog();
}
function approve() {
check_all_on_page();
approve_checked();
}
approve();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment