Changeset 36043 for main


Ignore:
Timestamp:
2022-02-03T12:04:55+13:00 (2 years ago)
Author:
cstephen
Message:

Extract floating TOC toggle to its own template

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/transform/layouts/toc.xsl

    r36041 r36043  
    400400                <!-- Floating TOC on/off button -->
    401401                <xsl:if test="count(//documentNode) > 0 and (not(/page/pageResponse/format[@type='display']/gsf:option[@name='TOC']) or /page/pageResponse/format[@type='display']/gsf:option[@name='TOC']/@value='true')">
    402                     <li id="floatingTOCOptions">
    403                         <xsl:attribute name="title">
    404                             <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.floatingTooltip')"/>
    405                         </xsl:attribute>
    406                         <img id="floatTOCToggleImage">
    407                             <xsl:attribute name="src">
    408                                 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'float_toc_image')"/>
    409                             </xsl:attribute>
    410                         </img>
    411                         <input id="floatTOCToggle" type="checkbox"/>
    412                         <script type="text/javascript">
    413                             <xsl:text disable-output-escaping="yes">
    414                                 $("#floatTOCToggle").prop("checked", false);
    415                                 $("#floatTOCToggle").on("click", function()
    416                                 {
    417                                     floatMenu($("#floatTOCToggle").prop("checked"));
    418                                 });
    419                                
    420                                 $("#floatTOCToggleImage").on("click", function()
    421                                 {
    422                                     $("#floatTOCToggle").prop("checked", !$("#floatTOCToggle").prop("checked"))
    423                                     floatMenu($("#floatTOCToggle").prop("checked"));
    424                                 });
    425                             </xsl:text>
    426                         </script>
    427                     </li>
    428                     <xsl:if test="/page/pageRequest/paramList/param[@name='ftoc']/@value = '1'">
    429                         <script type="text/javascript">
    430                             <xsl:text disable-output-escaping="yes">
    431                                 $(window).on("load", function()
    432                                 {
    433                                     $("#floatTOCToggle").prop("checked", true);
    434                                     floatMenu(true);
    435                                 });
    436                             </xsl:text>
    437                         </script>
    438                     </xsl:if>
     402                    <xsl:call-template name="floatingTOCToggle" />
    439403                </xsl:if>
    440404            </ul>
     
    444408        </div>
    445409    </xsl:template>
     410
     411    <xsl:template name="floatingTOCToggle">
     412        <li id="floatingTOCOptions">
     413            <xsl:attribute name="title">
     414                <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.floatingTooltip')"/>
     415            </xsl:attribute>
     416            <img id="floatTOCToggleImage">
     417                <xsl:attribute name="src">
     418                    <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'float_toc_image')"/>
     419                </xsl:attribute>
     420            </img>
     421            <input id="floatTOCToggle" type="checkbox"/>
     422            <script type="text/javascript">
     423                <xsl:text disable-output-escaping="yes">
     424                    $("#floatTOCToggle").prop("checked", false);
     425                    $("#floatTOCToggle").on("click", function()
     426                    {
     427                        floatMenu($("#floatTOCToggle").prop("checked"));
     428                    });
     429                   
     430                    $("#floatTOCToggleImage").on("click", function()
     431                    {
     432                        $("#floatTOCToggle").prop("checked", !$("#floatTOCToggle").prop("checked"))
     433                        floatMenu($("#floatTOCToggle").prop("checked"));
     434                    });
     435                </xsl:text>
     436            </script>
     437        </li>
     438        <xsl:if test="/page/pageRequest/paramList/param[@name='ftoc']/@value = '1'">
     439            <script type="text/javascript">
     440                <xsl:text disable-output-escaping="yes">
     441                    $(window).on("load", function()
     442                    {
     443                        $("#floatTOCToggle").prop("checked", true);
     444                        floatMenu(true);
     445                    });
     446                </xsl:text>
     447            </script>
     448        </xsl:if>
     449    </xsl:template>
    446450</xsl:stylesheet>
Note: See TracChangeset for help on using the changeset viewer.