Skip to content

Instantly share code, notes, and snippets.

@wadetb
Created December 29, 2015 16:14
Show Gist options
  • Select an option

  • Save wadetb/2fdf2e063f4028a5f11f to your computer and use it in GitHub Desktop.

Select an option

Save wadetb/2fdf2e063f4028a5f11f to your computer and use it in GitHub Desktop.
//
// ReserveAmerica auto clicker v2
// Wade Brainerd <wadeb@wadeb.com>
//
// This script repeatedly clicks the Book these Dates button
// for a ReserveAmerica campsite, e.g. Bahia Honda. Given a
// start time and duration, it will repeatdly click the button
// until the button disappears or the duration expires.
//
// Usage:
//
// 1. Install the Custom Javascript for Websites Chrome extension.
// 2. Login to ReserveAmerica using your account.
// 3. Search for your site, date and stay length.
// 4. Navigate to the campsite Details page; there should be a
// "Book these Dates" button with a yellow dot.
// 5. Open the Custom Javascript extension and paste this code.
// 6. Edit the click date/time and other parameters below.
// 7. Open the Chrome console and check Preserve log.
//
var y = 2015;
var M = 12; // january=1
var d = 29; // 1st=1
var h = 11; // 24h time
var m = 12;
var s = 0;
// How long after the target to stop clicking, in milliseconds.
var duration = 10000;
// How long prior to the start time to click, in milliseconds, to
// account for network latency.
var networkLatency = 150;
// HTML ID of the button to click.
var element = "btnbookdates";
// =====================================
// End configuration section
// =====================================
function getMillisecondsLeft() {
var nowDate = new Date();
var targetDate = new Date(y,M-1,d,h,m,s);
return targetDate - nowDate;
}
function click() {
var button = document.getElementById('btnbookdates');
if ( button ) {
window.console.log('clicked at '+getMillisecondsLeft());
button.click();
} else {
window.console.log('nothing to click at '+getMillisecondsLeft());
}
}
if (getMillisecondsLeft() > 0) {
window.console.log('queueing at '+getMillisecondsLeft());
setTimeout(click, getMillisecondsLeft() - networkLatency);
} else if (-getMillisecondsLeft() <= duration) {
click();
} else {
window.console.log('all done at '+getMillisecondsLeft());
}
@numba5
Copy link
Copy Markdown

numba5 commented Oct 17, 2017

OP or anyone else... could you help me .. does this still work.? I know I'm a noob but I really want to make reservations and tried this and I must be doing something wrong.
Any help would be GREATLY appreciated.

@numba5
Copy link
Copy Markdown

numba5 commented Oct 17, 2017

Ok well I got it to work - thank you OP!

@johnjp100
Copy link
Copy Markdown

Any update on if this still works?
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment