added basic support for htmx (ajax)

- if there is HX-Request header present we sent only a part of the whole html
- we return only specific stream defined by [out ...] ezc statement
- the name of the stream is passed in the 'frame' parameter
  (if not present then 'content' is assumed)
- added ezc function: winix_is_htmx_request
This commit is contained in:
2021-05-27 19:36:04 +02:00
parent 1292a56d1b
commit ba331dea4a
8 changed files with 257 additions and 7 deletions

View File

@@ -37,10 +37,27 @@
[if winix_load_htmx]
[def winix_has_htmx true]
<script src="[doc_base_url_common]/htmx.org/1.4.0/dist/htmx.min.js"></script>
[end]
[if winix_has_htmx]
<script>htmx.on("htmx:afterOnLoad", function(evt) \{
[# we can optimize it by searching first the <head> tag]
var winix_elements = htmx.findAll(".winix-auto-delete");
for(var i=0 ; i<winix_elements.length ; ++i)
\{
console.log("removing:");
console.log(winix_elements\[i\]);
htmx.remove(winix_elements\[i\]);
\}
\});
</script>
[end]
[if winix_function_is "emacs"]