diff options
author | Olivier Hallot <olivier.hallot@libreoffice.org> | 2018-03-02 19:20:42 -0300 |
---|---|---|
committer | Olivier Hallot <olivier.hallot@libreoffice.org> | 2018-03-03 11:15:10 +0100 |
commit | 13098ccef163c813ae3e196511f44a16a6e73fdd (patch) | |
tree | ded3f17c39523e3ec006274ae0d5e42986b6191c /help3xsl | |
parent | fc5a433b247927c4b134d7d6028c68837e3e003d (diff) |
tdf#116150 Fix logic for case/caseinline with 'sys'
Change-Id: I5c9cb270fa89ea5281355fc80be2a155b9d9ef9e
Reviewed-on: https://gerrit.libreoffice.org/50650
Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org>
Tested-by: Olivier Hallot <olivier.hallot@libreoffice.org>
Diffstat (limited to 'help3xsl')
-rw-r--r-- | help3xsl/help.js | 21 | ||||
-rw-r--r-- | help3xsl/online_transform.xsl | 30 |
2 files changed, 33 insertions, 18 deletions
diff --git a/help3xsl/help.js b/help3xsl/help.js index 9329f2d0fb..8386055269 100644 --- a/help3xsl/help.js +++ b/help3xsl/help.js @@ -19,16 +19,31 @@ function setModule(module) { } } } -// Used to set system in caseinline=SYSTEM +// Used to set system in case, caseinline=SYSTEM function setSystem(system) { - var itemspan = document.getElementsByTagName("span"); + var hasSystem; + // if no System in URL, get browser system if (system === null) { - system = "WIN"; + system = getSystem(); } + // on loading page, DEFAULTSYS visible, sys is hidden + // when hasSystem, show sys, hide DEFAULTSYS + var itemspan = document.getElementsByTagName("span"); var n = itemspan.length; + //Show when system is found in page + hasSystem = false; for (var i = 0; i < n; i++) { if (itemspan[i].getAttribute("value") == system) { itemspan[i].removeAttribute("hidden"); + hasSystem = true; + } + } + //it hasSystem, then hide all DEFAULTSYS + if (hasSystem){ + for (var i = 0; i < n; i++) { + if (itemspan[i].getAttribute("value") == "DEFAULTSYS") { + itemspan[i].setAttribute("hidden",true); + } } } } diff --git a/help3xsl/online_transform.xsl b/help3xsl/online_transform.xsl index 0b9eed254d..cd4774897c 100644 --- a/help3xsl/online_transform.xsl +++ b/help3xsl/online_transform.xsl @@ -400,9 +400,9 @@ <!-- CASE --> <xsl:template match="case"><xsl:call-template name="insertcase" /></xsl:template> <xsl:template match="case" mode="embedded"> - <xsl:call-template name="insertcase"> - <xsl:with-param name="embedded" select="'yes'"/> - </xsl:call-template> + <xsl:call-template name="insertcase"> + <xsl:with-param name="embedded" select="'yes'"/> + </xsl:call-template> </xsl:template> <!-- CASEINLINE --> @@ -667,16 +667,16 @@ <!-- SECTION --> <xsl:template match="section" mode="embedded"> - <a name="{@id}"></a> - <xsl:apply-templates mode="embedded"/> + <a name="{@id}"></a> + <xsl:apply-templates mode="embedded"/> </xsl:template> <!-- SORT --> <xsl:template match="sort" > - <xsl:apply-templates><xsl:sort select="descendant::paragraph"/></xsl:apply-templates> + <xsl:apply-templates><xsl:sort select="descendant::paragraph"/></xsl:apply-templates> </xsl:template> <xsl:template match="sort" mode="embedded"> - <xsl:apply-templates><xsl:sort select="descendant::paragraph"/></xsl:apply-templates> + <xsl:apply-templates><xsl:sort select="descendant::paragraph"/></xsl:apply-templates> </xsl:template> <!-- SWITCH --> @@ -712,15 +712,15 @@ <xsl:template match="variable" mode="embedded"><a name="{@id}"></a><xsl:apply-templates mode="embedded"/></xsl:template> <xsl:template match="text()"> - <xsl:call-template name="brand"> - <xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param> - </xsl:call-template> + <xsl:call-template name="brand"> + <xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param> + </xsl:call-template> </xsl:template> <xsl:template match="text()" mode="embedded"> - <xsl:call-template name="brand"> - <xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param> - </xsl:call-template> + <xsl:call-template name="brand"> + <xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param> + </xsl:call-template> </xsl:template> <!-- In case of missing help files --> @@ -963,10 +963,10 @@ <xsl:if test="not(../child::case[@select=$System]) and not(../child::caseinline[@select=$System])"> <xsl:choose> <xsl:when test="$embedded = 'yes'"> - <span hidden="true" itemprop="system" value="WIN"><xsl:apply-templates mode="embedded"/></span> + <span itemprop="system" value="DEFAULTSYS"><xsl:apply-templates mode="embedded"/></span> </xsl:when> <xsl:otherwise> - <span hidden="true" itemprop="system" value="WIN"><xsl:apply-templates /></span> + <span itemprop="system" value="DEFAULTSYS"><xsl:apply-templates /></span> </xsl:otherwise> </xsl:choose> </xsl:if> |