Skip to content

Instantly share code, notes, and snippets.

@ngs
Last active February 7, 2018 18:11
Show Gist options
  • Select an option

  • Save ngs/2e2f3ef9326aeb9da93a1aba26b268ec to your computer and use it in GitHub Desktop.

Select an option

Save ngs/2e2f3ef9326aeb9da93a1aba26b268ec to your computer and use it in GitHub Desktop.
var rows = document.querySelectorAll('tr.days')
var idx = 0
function fmtDigit(n) {
return n < 10 ? '0' + n : String(n);
}
function fmtTime(time) {
return fmtDigit(Math.floor(time / 60)) + ':' + fmtDigit(time % 60);
}
function fillNext() {
var row = rows[idx++];
if(!row) {
console.info('completed');
return;
}
if(row.className.match(/rowcl\d/)) {
fillNext();
return;
}
row.querySelectorAll('.vst')[0].click();
setTimeout(function() {
var start = 9.5 * 60 + Math.round(60 * Math.random());
var end = start + 9 * 60 + Math.ceil(60 * Math.random());
document.getElementById('startTime').value = fmtTime(start);
document.getElementById('endTime').value = fmtTime(end);
document.getElementById('dlgInpTimeOk').click();
setTimeout(fillNext, 5000)
}, 1000);
}
fillNext();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment