Created
December 29, 2015 16:14
-
-
Save wadetb/2fdf2e063f4028a5f11f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ReserveAmerica auto clicker v2 | |
// Wade Brainerd <[email protected]> | |
// | |
// 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()); | |
} |
Ok well I got it to work - thank you OP!
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
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.