Mercurial > hg > nginx-site
view xsls/banner.xsls @ 2997:adecad3d7039
Added link to subrequest response object in njs Reference.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Wed, 16 Aug 2023 12:12:22 +0100 |
parents | fdf1464e1977 |
children |
line wrap: on
line source
<!-- Copyright (C) Nginx, Inc. --> X:stylesheet { X:var BANNER = "'/banner/banner.html'"; X:template banner_link () { X:if "substring-after($DIRNAME, '/')" { !{ concat($ROOT, $BANNER) } } else { !{ substring-after($BANNER, '/') } } } X:template banner () { <script> window.addEventListener("load", function(e) \{ fetch("!banner_link ()") .then((response) => response.text()) .then((resp) => \{ document.getElementById("banner").innerHTML = resp; \}) .catch((error) => \{ console.warn(error); \}); \}); </script> } }