fix: littleweb browser page url bar

This commit is contained in:
trisua 2025-07-08 18:25:47 -04:00
parent e72ccf9139
commit 22a2545aa0

View file

@ -148,7 +148,13 @@
if (data.event === \"change_url\") { if (data.event === \"change_url\") {
const uri = new URL(data.target).pathname.slice(\"/api/v1/net/\".length); const uri = new URL(data.target).pathname.slice(\"/api/v1/net/\".length);
window.history.pushState(null, null, `/net/${uri.replace(\"atto://\", \"\")}`); window.history.pushState(null, null, `/net/${uri.replace(\"atto://\", \"\")}`);
if (!uri.includes(\"atto://\")) {
document.getElementById(\"uri\").setAttribute(\"true_value\", `atto://${uri}`); document.getElementById(\"uri\").setAttribute(\"true_value\", `atto://${uri}`);
} else {
document.getElementById(\"uri\").setAttribute(\"true_value\", uri);
}
document.getElementById(\"uri\").value = uri.split(\"/\")[0]; document.getElementById(\"uri\").value = uri.split(\"/\")[0];
} }
}); });
@ -205,6 +211,8 @@
}); });
// navigate // navigate
littleweb_navigate(\"{{ path|safe }}\");")) if ({{ path|length }} > 0) {
littleweb_navigate(\"{{ path|safe }}\");
}"))
(text "{% endblock %}") (text "{% endblock %}")