Skip to content

Instantly share code, notes, and snippets.

@fuglede
Last active May 1, 2018 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fuglede/bbc426d5699dfe15ae22738e9459a2ec to your computer and use it in GitHub Desktop.
Save fuglede/bbc426d5699dfe15ae22738e9459a2ec to your computer and use it in GitHub Desktop.
VCTA auto-filler
// Fills in information on a 2018 vcta.dk profile page.
// To run,
// 1) Navigate to your team profile page in Chrome (seems to have issues on Firefox).
// 2) Right click one of the checkboxes and click "Inspect".
// 3) Go to the "Console" tab.
// 4) Paste the code below and click return.
var distance = prompt("How many km did you bike on weekdays?", 5);
for (var i = 3; i < 65; i += 2) {
var w = Math.floor((i-3)/2);
if (w % 7 == 4 || w % 7 == 5 || i == 21 || i == 43) continue;
$("input")[i].checked = true;
$("input")[i+1].style = "visibility: visible";
$("input")[i+1].value = distance;
}
@jfcorbett
Copy link

On firefox, get:

TypeError: $(...)[i] is undefined[Learn More] debugger eval code:6:5

@jfcorbett
Copy link

jfcorbett commented May 1, 2018

Works on Chrome, but get a few off-by-one misses... Maybe because trying to fill checkboxes for future days that can't be legally filled yet :-)
image

@fuglede
Copy link
Author

fuglede commented May 1, 2018

@jfcorbett: Thanks. Looks like the assumption that VCTA was based on the Old Norse calendar, in which months always start on a specific weekday across years, does not hold. And someone moved Ascension. Guess you'll have to work weekends this year.

@fuglede
Copy link
Author

fuglede commented May 1, 2018

Updated to take 2018-specific features into account. See you next year.

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