authorgravatar for kappaloris@gmail.comLoris Cro <kappaloris@gmail.com> 2023-01-12 13:41:21+01:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-01-12 13:41:21+01:00
log4b329176460d91056b75f0798778b1c58e0f104b
tree2d656dd6ca7f0dad07b20b5c349891540b1008cb
parent4971df857213f32b39e79f39b6e391cf76d06c3a
parent66569c7ec664fbab691b74616c02fed838b91a7d
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #14275 from EspeuteClement/master

autodoc: use js instead of details for collapsing descriptions

2 files changed, 13 insertions(+), 16 deletions(-)

lib/docs/index.html+6-8
......@@ -266,25 +266,23 @@
266266 font-weight: bold;
267267 }
268268
269 details[open] summary .sum-less {
269 .expand[open] .sum-less {
270270 display: none;
271271 }
272272
273 details[open] summary .sum-more {
273 .expand[open] .sum-more {
274274 display: block;
275275 }
276276
277 details summary .sum-more {
277 .expand .sum-more {
278278 display: none;
279279 }
280280
281 details summary {
282 list-style-type: none;
281 .expand {
283282 position: relative;
284 pointer-events: none;
285283 }
286284
287 details summary::before {
285 .expand .button:before {
288286 content: "[+] ";
289287 font-family: var(--mono);
290288 color: var(--link-color);
......@@ -298,7 +296,7 @@
298296 cursor: pointer;
299297 }
300298
301 details[open] summary::before {
299 .expand[open] .button:before {
302300 content: "[-] ";
303301 }
304302
lib/docs/main.js+7-8
......@@ -2476,7 +2476,7 @@ var zigAnalysis;
24762476 short = markdown(short);
24772477 var long = markdown(docs);
24782478 tdDesc.innerHTML =
2479 "<details ontoggle=\"scrollOnCollapse(event);\"><summary><div class=\"sum-less\">" + short + "</div>" + "<div class=\"sum-more\">" + long + "</div></summary></details>";
2479 "<div class=\"expand\" ><span class=\"button\" onclick=\"toggleExpand(event)\"></span><div class=\"sum-less\">" + short + "</div>" + "<div class=\"sum-more\">" + long + "</div></details>";
24802480 }
24812481 else {
24822482 tdDesc.innerHTML = markdown(short);
......@@ -3718,12 +3718,11 @@ var zigAnalysis;
37183718
37193719})();
37203720
3721function scrollOnCollapse(event) {
3722 const details = event.target;
3723 if (!details.open && details.getBoundingClientRect().top < 0) {
3724 console.log("scrolling!")
3725 details.parentElement.parentElement.scrollIntoView(true);
3726 } else {
3727 console.log("not scrolling!", details.open, details.top);
3721function toggleExpand(event) {
3722 const parent = event.target.parentElement;
3723 parent.toggleAttribute("open");
3724
3725 if (!parent.open && parent.getBoundingClientRect().top < 0) {
3726 parent.parentElement.parentElement.scrollIntoView(true);
37283727 }
37293728}
\ No newline at end of file