Skip to content

Commit

Permalink
Introduce qualtrics-feedback.js parameter & file
Browse files Browse the repository at this point in the history
* Add qualtrics-feedback.js parameter
* Add the file "qualtrics-feedback.js".
* ATM, if generate.qualtrics.div != 0 and qualtrics-feedback.js == '', we fallback to a hardcoded
  implementation.
  TODO: remove it once the file implementation is stable
* If the file needs to be customized, this should be the content:

      <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>
  • Loading branch information
tomschr committed Jul 31, 2023
1 parent 7cc25fb commit e790da5
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
11 changes: 10 additions & 1 deletion suse2022-ns/xhtml/docbook.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,14 @@
</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:message>INFO: Using '<xsl:value-of select="$qualtrics-feedback.js"/>' file</xsl:message>
<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 +377,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 e790da5

Please sign in to comment.