code formatting for some css and js files

This commit is contained in:
adam j hartz 2025-09-24 21:35:52 -04:00
commit 25b5a0d2ba
Signed by: hz
GPG key ID: B63A0A59F5C82493
4 changed files with 38 additions and 28 deletions

View file

@ -23,14 +23,14 @@
catsoop.switch_buttons = function (qname, enabled) {
for (var b of Array.prototype.slice.call(
document.getElementById(qname + "_buttons").getElementsByTagName("button")
document.getElementById(qname + "_buttons").getElementsByTagName("button"),
))
b.disabled = !enabled;
};
document.addEventListener("DOMContentLoaded", function (event) {
for (var b of Array.prototype.slice.call(
document.getElementsByTagName("button")
document.getElementsByTagName("button"),
))
b.disabled = false;
});
@ -122,7 +122,7 @@ catsoop.ajaxrequest = function (names, action, done_function) {
catsoop.switch_buttons(name, true);
}
}
}
},
);
};
@ -200,7 +200,7 @@ catsoop.ajaxDoneCallback = function (data, path, count) {
}
catsoop.render_all_math(document.getElementById("cs_qdiv_" + name));
catsoop.syntax_highlighting(
document.getElementById("cs_qdiv_" + name)
document.getElementById("cs_qdiv_" + name),
);
catsoop.switch_buttons(name, true);
}
@ -280,7 +280,7 @@ catsoop.send_request = function (names, action, send, done_function) {
var encoded_form_pairs = [];
for (var name in d) {
encoded_form_pairs.push(
encodeURIComponent(name) + "=" + encodeURIComponent(d[name])
encodeURIComponent(name) + "=" + encodeURIComponent(d[name]),
);
}
var form = encoded_form_pairs.join("&").replace(/%20/g, "+");
@ -290,7 +290,7 @@ catsoop.send_request = function (names, action, send, done_function) {
catsoop.ajaxDoneCallback(
d,
catsoop.this_path,
0
0,
)(request.status, request.response);
done_function(true, names, request.status, request.response);
};
@ -324,7 +324,7 @@ catsoop.viewexplanation = function (name) {
catsoop.grade = function (name) {
catsoop.ajaxrequest(
[name, name + "_grading_score", name + "_grading_comments"],
"grade"
"grade",
);
};
catsoop.lock = function (name) {

View file

@ -25,7 +25,7 @@ function _encode_form(d) {
var encoded_form_pairs = [];
for (var name in d) {
encoded_form_pairs.push(
encodeURIComponent(name) + "=" + encodeURIComponent(d[name])
encodeURIComponent(name) + "=" + encodeURIComponent(d[name]),
);
}
return encoded_form_pairs.join("&").replace(/%20/g, "+");
@ -109,7 +109,7 @@ catsoop.update_group_list = function () {
return function () {
catsoop.groups_remove(name, group);
};
})(members[j], grp)
})(members[j], grp),
);
a.classList = "remove";
a.title = grp + " " + members[j];
@ -152,7 +152,7 @@ catsoop.update_group_list = function () {
request.open(
"POST",
catsoop.url_root + "/_util/api/groups/list_groups",
true
true,
);
request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
request.send(form);
@ -171,7 +171,7 @@ catsoop.groups_partner_all = function () {
request.open(
"POST",
catsoop.url_root + "/_util/api/groups/make_all_groups",
true
true,
);
request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
request.send(form);
@ -183,7 +183,7 @@ catsoop.groups_confirm_and_partner_all = function () {
.modal(
"Are you sure?",
"Really repartner all students? This will delete all pre-existing groups and randomly assign everyone a new partner.",
false
false,
)
.then(function (x) {
catsoop.groups_partner_all(name);
@ -206,7 +206,7 @@ catsoop.groups_add = function () {
request.open(
"POST",
catsoop.url_root + "/_util/api/groups/add_to_group",
true
true,
);
request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
request.send(form);
@ -226,7 +226,7 @@ catsoop.groups_remove = function (name, grp) {
request.open(
"POST",
catsoop.url_root + "/_util/api/groups/remove_from_group",
true
true,
);
request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
request.send(form);

View file

@ -31,9 +31,9 @@ document.body.append(timerelt);
document.addEventListener("DOMContentLoaded", function (event) {
var timerelt = document.getElementById("timer");
catsoop.timer_remaining = catsoop.timer_due - catsoop.timer_now;
catsoop.timer_format_num = function(n) {
catsoop.timer_format_num = function (n) {
return ("0" + n).slice(-2);
}
};
catsoop.lti_iframe_handler = function () {
// for LTI
@ -71,19 +71,22 @@ document.addEventListener("DOMContentLoaded", function (event) {
catsoop.ajaxrequest(catsoop.all_questions, "lock");
} else {
if (catsoop.timer_remaining % 20 == 0) {
setTimeout(function () {
var request = new XMLHttpRequest();
request.onload = function () {
catsoop.timer_remaining =
catsoop.timer_due - parseInt(request.response);
};
request.open("GET", catsoop.time_url, true);
request.send();
}, Math.floor(Math.random() * 2000 + 1000));
setTimeout(
function () {
var request = new XMLHttpRequest();
request.onload = function () {
catsoop.timer_remaining =
catsoop.timer_due - parseInt(request.response);
};
request.open("GET", catsoop.time_url, true);
request.send();
},
Math.floor(Math.random() * 2000 + 1000),
);
}
catsoop.timer_hours = Math.floor(catsoop.timer_remaining / 3600);
catsoop.timer_minutes = Math.floor(
(catsoop.timer_remaining - catsoop.timer_hours * 3600) / 60
(catsoop.timer_remaining - catsoop.timer_hours * 3600) / 60,
);
catsoop.timer_seconds =
catsoop.timer_remaining -

View file

@ -96,7 +96,12 @@ kbd,
pre,
samp,
tt {
font-family: Menlo, Consolas, Courier, Courier New, monospace;
font-family:
Menlo,
Consolas,
Courier,
Courier New,
monospace;
font-size: 0.95em;
}
blockquote {
@ -123,7 +128,9 @@ pre {
pre code {
padding: 0px;
}
.catsoop-timer-hours, .catsoop-timer-minutes, .catsoop-timer-seconds {
.catsoop-timer-hours,
.catsoop-timer-minutes,
.catsoop-timer-seconds {
font-variant-numeric: tabular-nums;
}
.catsooplogo {