show raise/show in-app jump-to-location

TODO: when multiple buttons are pressed in quick succession, the transitions may create some
race-condition
This commit is contained in:
Klaas van Schelven
2024-04-04 16:18:41 +02:00
parent 5510002a47
commit 9870acf6d2
2 changed files with 7 additions and 0 deletions

View File

@@ -30,6 +30,9 @@
{% with frame=frame|pygmentize %}
<div class="bg-white w-full font-mono"> {# per frame div #}
{% if frame.raise_point %}<a name="raise"/>{% endif %}
{% if frame.in_app %}<a name="in-app"/>{% endif %}
{% if forloop.first and forloop.parentloop.first %}<a name="topp"/>{% endif %}
<div class="flex pl-4 pt-2 pb-2 border-b-2 {% if forloop.first %}border-t-2{% endif %} bg-slate-100 border-slate-400 cursor-pointer" onclick="toggleFrameVisibility(this)"> {# per frame header div #}

View File

@@ -117,6 +117,9 @@ function showInAppFrames() {
frameDetails.parentNode.querySelector(".js-chevron").classList.remove("rotate-180");
}
});
// this works because when there are repeated anchors a browser will just jump to the first one.
// the less lazy way would be to just have a single such anchor
window.location = window.location.origin + window.location.pathname + '#in-app';
}
function showRaisingFrame() {
@@ -129,6 +132,7 @@ function showRaisingFrame() {
frameDetails.parentNode.querySelector(".js-chevron").classList.remove("rotate-180");
}
});
window.location = window.location.origin + window.location.pathname + '#raise';
}
function hideAllFrames() {