add: small littleweb browser changes

This commit is contained in:
trisua 2025-07-08 17:38:24 -04:00
parent e7febc7c7e
commit 388ccbf58c
9 changed files with 194 additions and 21 deletions

View file

@ -32,7 +32,7 @@
(input
("type" "uri")
("class" "w-full")
("true_value" "{{ path }}")
("true_value" "")
("name" "uri")
("id" "uri"))
@ -121,10 +121,6 @@
uri = `${uri}/index.html`;
}
if (!uri.startsWith(\"atto://\")) {
uri = `atto://${uri}`;
}
// ...
console.log(\"navigate\", uri);
document.getElementById(\"browser_iframe\").src = `{{ config.lw_host|safe }}/api/v1/net/${uri}`;
@ -152,7 +148,8 @@
if (data.event === \"change_url\") {
const uri = new URL(data.target).pathname.slice(\"/api/v1/net/\".length);
window.history.pushState(null, null, `/net/${uri.replace(\"atto://\", \"\")}`);
document.getElementById(\"uri\").setAttribute(\"true_value\", uri);
document.getElementById(\"uri\").setAttribute(\"true_value\", `atto://${uri}`);
document.getElementById(\"uri\").value = uri.split(\"/\")[0];
}
});
@ -207,6 +204,7 @@
is_focused = false;
});
document.getElementById(\"uri\").value = document.getElementById(\"uri\").getAttribute(\"true_value\").replace(\"atto://\", \"\").split(\"/\")[0]"))
// navigate
littleweb_navigate(\"{{ path|safe }}\");"))
(text "{% endblock %}")