Added course's notes
This commit is contained in:
1 parent
e07993262c
commit
dcd2c072ae
191 files changed
+42866
-12
No files matched your search
@@ -0,0 +1,86 @@
|
||||
/* exo — exercise cards, hint folds (sequential unlock), solution fold */
|
||||
|
||||
.exo {
|
||||
margin: 1.2rem 0;
|
||||
padding: 0.6rem 0.9rem;
|
||||
border: 1px solid color-mix(in srgb, var(--calc-notecolor, #B45309) 35%, transparent);
|
||||
border-left: 3px solid var(--calc-notecolor, #B45309);
|
||||
border-radius: 0.35rem;
|
||||
scroll-margin-top: 5rem;
|
||||
}
|
||||
/* keep wide content inside the card: display math (and tables/code) scroll
|
||||
on their own rather than spilling past the border. overflow-y stays hidden
|
||||
so Firefox doesn't add a phantom vertical bar, as in .calc */
|
||||
.exo mjx-container[display="true"],
|
||||
.exo .katex-display {
|
||||
max-width: 100%;
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
padding-bottom: 0.35em; /* keep descenders clear of a horizontal bar */
|
||||
/* a centred overflowing box clips its left side out of reach, so centre
|
||||
only while the formula fits (browsers without `safe` keep plain centring) */
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
justify-content: safe center;
|
||||
}
|
||||
.exo .math.display { display: block; max-width: 100%; }
|
||||
.exo :is(pre, table) { max-width: 100%; overflow-x: auto; }
|
||||
.exo img, .exo svg { max-width: 100%; }
|
||||
|
||||
.exo-head p { margin: 0 0 0.4rem; }
|
||||
.exo-head strong { color: var(--calc-notecolor, #B45309); }
|
||||
|
||||
.exo details {
|
||||
margin: 0.45rem 0;
|
||||
border-radius: 0.3rem;
|
||||
}
|
||||
.exo details > summary {
|
||||
cursor: pointer;
|
||||
list-style: none;
|
||||
user-select: none;
|
||||
font-size: 0.9em;
|
||||
font-weight: 600;
|
||||
}
|
||||
.exo details > summary::-webkit-details-marker { display: none; }
|
||||
.exo details > summary::before { content: "▸ "; }
|
||||
.exo details[open] > summary::before { content: "▾ "; }
|
||||
|
||||
/* hints: small highlight boxes */
|
||||
.exo-hint {
|
||||
background: color-mix(in srgb, var(--calc-notecolor, #B45309) 6%, transparent);
|
||||
border: 1px solid color-mix(in srgb, var(--calc-notecolor, #B45309) 30%, transparent);
|
||||
padding: 0.25rem 0.6rem;
|
||||
}
|
||||
.exo-hint > summary { color: var(--calc-notecolor, #B45309); }
|
||||
|
||||
/* locked hints: unlock one by one */
|
||||
.exo-hint.exo-locked > summary {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.45;
|
||||
}
|
||||
.exo-hint.exo-locked > summary::before { content: "🔒 "; }
|
||||
|
||||
/* solution: closed by default, visually separated */
|
||||
.exo-sol {
|
||||
border-top: 1px dashed color-mix(in srgb, var(--calc-notecolor, #B45309) 40%, transparent);
|
||||
padding: 0.35rem 0.1rem 0.1rem;
|
||||
scroll-margin-top: 5rem;
|
||||
}
|
||||
/* in a numbered part, the fold lines up with the part's text */
|
||||
.exo li > details { margin-left: 0; }
|
||||
|
||||
/* hand-in extracts (handin.sh, html output) */
|
||||
.exo-handin-sol, .exo-handin-hint {
|
||||
margin: 0.6rem 0;
|
||||
padding: 0.2rem 0 0.2rem 0.8rem;
|
||||
border-left: 2px solid var(--calc-notecolor, #B45309);
|
||||
}
|
||||
|
||||
.exo-fold-body { margin-top: 0.3rem; }
|
||||
.exo-fold-body > p:first-child { margin-top: 0; }
|
||||
.exo-fold-body > p:last-child { margin-bottom: 0; }
|
||||
|
||||
@media print {
|
||||
.exo details > summary::before { content: ""; }
|
||||
.exo-hint.exo-locked > summary { opacity: 1; cursor: default; }
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// exo — hints unlock one by one within a part; everything unfolds for printing
|
||||
(function () {
|
||||
// block opening a locked hint
|
||||
document.addEventListener("click", function (e) {
|
||||
var s = e.target.closest ? e.target.closest("details.exo-hint.exo-locked > summary") : null;
|
||||
if (s) e.preventDefault();
|
||||
});
|
||||
|
||||
// opening hint n of a part unlocks hint n+1 of the same part, wherever it
|
||||
// sits in the exercise (toggle doesn't bubble: use capture)
|
||||
document.addEventListener("toggle", function (e) {
|
||||
var d = e.target;
|
||||
if (!d.classList || !d.classList.contains("exo-hint") || !d.open) return;
|
||||
var chain = d.getAttribute("data-exo-chain");
|
||||
var n = parseInt(d.getAttribute("data-exo-hint"), 10);
|
||||
if (!chain || isNaN(n)) return;
|
||||
var hints = document.querySelectorAll("details.exo-hint[data-exo-chain]");
|
||||
for (var i = 0; i < hints.length; i++) {
|
||||
if (hints[i].getAttribute("data-exo-chain") === chain &&
|
||||
parseInt(hints[i].getAttribute("data-exo-hint"), 10) === n + 1) {
|
||||
hints[i].classList.remove("exo-locked");
|
||||
}
|
||||
}
|
||||
}, true);
|
||||
|
||||
// print: open all hints/solutions, restore afterwards
|
||||
window.addEventListener("beforeprint", function () {
|
||||
document.querySelectorAll(".exo details").forEach(function (d) {
|
||||
d.dataset.exoWasOpen = d.open ? "1" : "0";
|
||||
d.open = true;
|
||||
});
|
||||
});
|
||||
window.addEventListener("afterprint", function () {
|
||||
document.querySelectorAll(".exo details").forEach(function (d) {
|
||||
d.open = d.dataset.exoWasOpen === "1";
|
||||
delete d.dataset.exoWasOpen;
|
||||
});
|
||||
});
|
||||
})();
|
||||
Reference in new issue
Block a user