Skip to content

Instantly share code, notes, and snippets.

@rickcnagy
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save rickcnagy/9611925 to your computer and use it in GitHub Desktop.

Select an option

Save rickcnagy/9611925 to your computer and use it in GitHub Desktop.
Refresh attendance (including previously unenrolled students) for all days starting at the next day visible.
//
// RefreshAttendance_SchoolDaysOnly.js
// Rick Nagy
// 2014-03-17
//
// run via js console
refreshCount = -1;
function nextDay() {
refreshCount++;
if (!(refreshCount % 10) && !confirm("Next day?")) return
if (!$(".nextCanvas").is(":visible")) return;
$(".nextCanvas").click()
afterLoad(function() {
refreshList();
});
}
function refreshList() {
var refreshLink = $(".linkWidget:contains('Refresh')")
if (refreshLink.is(":visible")) {
refreshLink.click()
$(".theCheckBox").prop("checked", true)
$(".ui-button:contains('Ok')").click()
}
afterLoad(nextDay)
}
function afterLoad(callback, param) {
var loading = setInterval(function() {
if ($("*[class^='load']:not('.ribbonSelectorWidget *'):visible").length === 0) {
clearInterval(loading);
callback(param);
}
}, 10, param);
}
nextDay()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment