Something went wrong. Try again.
the next generation of the in-browser educational proof assistant
Something went wrong. Try again.
1.2 kB · 31 lines
JavaScript
at main
12345678910111213141516171819202122232425262728293031(function () { document.addEventListener("mousedown", (e) => { const groups = new Set(); document.querySelectorAll("[class]").forEach((el) => { el.classList.forEach((cls) => { if (cls.startsWith("outside-click-group-")) groups.add(cls); }); }); groups.forEach((groupClass) => { const members = document.querySelectorAll(`.${groupClass}`); const insideAny = Array.from(members).some((el) => el.contains(e.target)); //console.log("outsideclick mousedown check", {target: e.target, insideAny}); if (!insideAny) { members.forEach((el) => el.dispatchEvent(new CustomEvent("outsideclick"))); } }); }); function focusGoalNearIndex(scopeEl, index) { const scope = scopeEl.closest(".theorem-instance") || document; const goals = Array.from(scope.querySelectorAll(".proof-goal")); const next = goals[Math.min(index, goals.length - 1)]; if (next) next.focus(); } window.focusGoalNearIndex = focusGoalNearIndex; function computeGoalIndex(el) { const scope = el.closest(".theorem-instance") || document; return Array.from(scope.querySelectorAll(".proof-goal")).indexOf(el); } window.computeGoalIndex = computeGoalIndex;
})();