Pozice formuláře v localStorage

Tento commit je obsažen v:
sneedmaster 2024-02-27 20:56:37 +01:00
rodič fcdd039993
revize 28cefbd590
2 změnil soubory, kde provedl 16 přidání a 1 odebrání

Zobrazit soubor

@ -24,6 +24,18 @@ $(function () {
let form = $("#post-form"); let form = $("#post-form");
let handle = $("#post-form-handle"); let handle = $("#post-form-handle");
let saved_top = window.localStorage.getItem("post_form_top");
let saved_left = window.localStorage.getItem("post_form_left");
if (saved_top) {
form.css("top", saved_top);
}
if (saved_left) {
form.css("left", saved_left);
form.css("right", "auto")
}
handle.on("mousedown", start); handle.on("mousedown", start);
handle.get(0).addEventListener("touchstart", start, { passive: true }); handle.get(0).addEventListener("touchstart", start, { passive: true });
$(document).on("mouseup", stop); $(document).on("mouseup", stop);
@ -107,6 +119,9 @@ $(function () {
} }
form.css("right", "auto"); form.css("right", "auto");
window.localStorage.setItem("post_form_top", form.css("top"));
window.localStorage.setItem("post_form_left", form.css("left"));
} }
function stop() { function stop() {

Zobrazit soubor

@ -12,7 +12,7 @@
{% else %} {% else %}
Nové vlákno Nové vlákno
{% endif %} {% endif %}
<a class="close-post-form float-r" href="#">[Zavřít]</a> <a class="close-post-form float-r" href="#">[X]</a>
</td> </td>
</tr> </tr>
<tr> <tr>