Foundry now provides the <javascript-global-vars /> which can be used in a layout template to create a JavaScript which makes global variables from the XSL also available in JavaScript, for example the dispatcher-prefix.

git-svn-id: https://svn.libreccm.org/ccm/trunk@4828 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2017-06-30 10:04:17 +00:00
parent d55b475ae2
commit 7a026a90ec
3 changed files with 17 additions and 4 deletions

View File

@ -7,6 +7,7 @@
<show-page-title/>
</title>
<load-css-files/>
<javascript-global-vars />
</head>
<body>
<include file="fragments/header-with-nav.xml"/>

View File

@ -41,6 +41,15 @@
</foundry:doc-file-desc>
</foundry:doc-file>
<xsl:template match="javascript-global-vars">
<script>
<xsl:value-of select="concat('const contextPrefix = &quot;', $context-prefix, '&quot;;&#10;')" />
<xsl:value-of select="concat('const dispatcherPrefix = &quot;', $dispatcher-prefix, '&quot;;&#10;')" />
<xsl:value-of select="concat('const themePrefix = &quot;', $theme-prefix, '&quot;;&#10;')" />
</script>
</xsl:template>
<foundry:doc section="user"
type="template-tag">
<foundry:doc-desc>

View File

@ -29,6 +29,8 @@
-->
<load-css-files/>
<javascript-global-vars />
<script type="text/javascript" src="js/jquery-1.11.3.min.js">
</script>
@ -51,6 +53,7 @@
src="js/js.cookie.js">
</script>
<script type="text/javascript">
$(document).ready(function() {
$("figure.multiple a.image-attachments").fancybox({