Mercurial > hg > nginx-site
annotate xslt/banner.xslt @ 2925:3be061a0941a
Added link to varindex in njs Reference.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Thu, 05 Jan 2023 16:34:01 +0000 |
parents | fdf1464e1977 |
children |
rev | line source |
---|---|
2846
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
1 <?xml version="1.0" encoding="utf-8"?> |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
2 <!-- |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
3 Copyright (C) Nginx, Inc. |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
4 --> |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
5 |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
6 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
7 |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
8 <xsl:variable select="'/banner/banner.html'" name="BANNER"/> |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
9 |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
10 <xsl:template name="banner_link"> |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
11 <xsl:choose><xsl:when test="substring-after($DIRNAME, '/')"> |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
12 <xsl:value-of select=" concat($ROOT, $BANNER) "/> |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
13 </xsl:when><xsl:otherwise> |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
14 <xsl:value-of select=" substring-after($BANNER, '/') "/> |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
15 </xsl:otherwise></xsl:choose> |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
16 </xsl:template> |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
17 |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
18 <xsl:template name="banner"> |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
19 |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
20 <script> |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
21 window.addEventListener("load", function(e) { |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
22 fetch("<xsl:call-template name="banner_link"/>") |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
23 .then((response) => response.text()) |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
24 .then((resp) => { |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
25 document.getElementById("banner").innerHTML = resp; |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
26 }) |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
27 .catch((error) => { |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
28 console.warn(error); |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
29 }); |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
30 }); |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
31 </script> |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
32 |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
33 </xsl:template> |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
34 |
fdf1464e1977
Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff
changeset
|
35 </xsl:stylesheet> |