Add autobook feature
This commit is contained in:
@@ -20,6 +20,7 @@ let config = {
|
||||
consulates: null,
|
||||
deltaAppt: null,
|
||||
deltaNow: null,
|
||||
autobook: null,
|
||||
};
|
||||
let isRunning = false;
|
||||
|
||||
@@ -168,6 +169,7 @@ async function runner() {
|
||||
config.consulates = result['__consulates'] || null;
|
||||
config.deltaAppt = result['__deltaAppt'] || 1;
|
||||
config.deltaNow = result['__deltaNow'] || 1;
|
||||
config.autobook = result['__autobook'] || false;
|
||||
|
||||
if (prev_config.activate === null) {
|
||||
console.log('Reading config: ' + JSON.stringify(config));
|
||||
@@ -430,8 +432,16 @@ async function runner() {
|
||||
document.getElementById("appointments_submit").removeAttribute("disabled");
|
||||
document.getElementById("appointments_submit").click();
|
||||
|
||||
await sendNotification(`Found better appointment in ${consulate} at ${chosenDate} ${chosenTime}`);
|
||||
}
|
||||
msg = `Found better appointment in ${consulate} at ${chosenDate} ${chosenTime}`;
|
||||
console.log(msg);
|
||||
await sendNotification(msg);
|
||||
|
||||
if (config.autobook) {
|
||||
await delay(PAGE_WAIT_TIME);
|
||||
console.log('Auto booking');
|
||||
document.querySelector(".reveal-overlay:last-child [data-reveal] .button.alert").click();
|
||||
}
|
||||
} // end consulates loop
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user