annotate xsls/banner.xsls @ 2846:fdf1464e1977

Moved banner to the external file to make partial rollout possible. An idea is to have several banners and show them with different probability specified by split directive in the nginx.conf
author Sergey Budnevitch <sb@waeme.net>
date Tue, 10 May 2022 18:07:27 +0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 <!--
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
2 Copyright (C) Nginx, Inc.
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
3 -->
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 X:stylesheet {
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
6
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
7 X:var BANNER = "'/banner/banner.html'";
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
8
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
9 X:template banner_link () {
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
10 X:if "substring-after($DIRNAME, '/')" {
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
11 !{ concat($ROOT, $BANNER) }
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
12 } else {
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
13 !{ substring-after($BANNER, '/') }
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
14 }
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
15 }
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
16
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
17 X:template banner () {
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
18
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
19 <script>
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
20 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
21 fetch("!banner_link ()")
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
22 .then((response) => response.text())
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
23 .then((resp) => \{
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
24 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
25 \})
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
26 .catch((error) => \{
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
27 console.warn(error);
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
28 \});
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 </script>
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
31
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
fdf1464e1977 Moved banner to the external file to make partial rollout possible.
Sergey Budnevitch <sb@waeme.net>
parents:
diff changeset
34 }