Skip to content

Commit

Permalink
Merge pull request #556 from openSUSE/qualtrics-feedback.js
Browse files Browse the repository at this point in the history
Introduce qualtrics-feedback.js parameter & file
  • Loading branch information
tomschr authored Jul 31, 2023
2 parents 7cc25fb + 16c416c commit d064fea
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
10 changes: 9 additions & 1 deletion suse2022-ns/xhtml/docbook.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,13 @@
</xsl:call-template>

<xsl:if test="number($generate.qualtrics.div) != 0">
<xsl:comment>BEGIN QUALTRICS WEBSITE FEEDBACK SNIPPET</xsl:comment>
<xsl:choose>
<xsl:when test="$qualtrics-feedback.js != ''">
<xsl:copy-of select="document($qualtrics-feedback.js)/*/node()"/>
</xsl:when>
<xsl:otherwise>
<!-- TODO: This is just a fallback and can be removed at some point -->
<xsl:comment>BEGIN QUALTRICS WEBSITE FEEDBACK SNIPPET</xsl:comment>
<script type='text/javascript'><![CDATA[(function(){var g=function(e,h,f,g){
this.get=function(a){for(var a=a+"=",c=document.cookie.split(";"),b=0,e=c.length;b<e;b++){for(var d=c[b];" "==d.charAt(0);)d=d.substring(1,d.length);if(0==d.indexOf(a))return d.substring(a.length,d.length)}return null};
this.set=function(a,c){var b="",b=new Date;b.setTime(b.getTime()+6048E5);b="; expires="+b.toGMTString();document.cookie=a+"="+c+b+"; path=/; "};
Expand All @@ -370,6 +376,8 @@ try{(new g(100,"r","QSI_S_ZN_8qZUmklKYbBqAYe","https://zn8qzumklkybbqaye-suselin
<xsl:text>&#10;</xsl:text>
<xsl:comment>END WEBSITE FEEDBACK SNIPPET</xsl:comment>
<xsl:text>&#10;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>

Expand Down
14 changes: 14 additions & 0 deletions suse2022-ns/xhtml/param.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -466,5 +466,19 @@ task before
<!-- The ID for the Qualtricks <div> -->
<xsl:param name="generate.qualtrics.div" select="0"/>
<xsl:param name="qualtrics.id">qualtrics_container</xsl:param>
<!-- The path to the Qualtrics JS file. By default, it's relative to the stylesheet.
The content should be (correct the syntax HTML comment):
<html xmlns="http://www.w3.org/1999/xhtml">
<!- -BEGIN QUALTRICS WEBSITE FEEDBACK SNIPPET- ->
<script type='text/javascript'><![CDATA[... add your content here ...]]></script>
<div id='ZN_8qZUmklKYbBqAYe'><!- -DO NOT REMOVE-CONTENTS PLACED HERE- -></div>
<!- -END WEBSITE FEEDBACK SNIPPET- ->
</html>
The root element is cut off (it can be any tagname, <html> is just an example).
Anything below <html> is copied, including HTML comments and the <script>.
-->
<xsl:param name="qualtrics-feedback.js">qualtrics-feedback.js</xsl:param>

</xsl:stylesheet>
13 changes: 13 additions & 0 deletions suse2022-ns/xhtml/qualtrics-feedback.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d064fea

Please sign in to comment.