[Libreoffice-commits] help.git: Branch 'distro/collabora/cp-6.0' - help3xsl/help2.js help3xsl/online_transform.xsl

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Aug 16 07:19:13 UTC 2018


 help3xsl/help2.js             |   12 ++++++++++++
 help3xsl/online_transform.xsl |   11 ++++++-----
 2 files changed, 18 insertions(+), 5 deletions(-)

New commits:
commit 06e774ff62d12d9d41168190525f0dea4e62ef1b
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Wed Aug 15 10:27:02 2018 +0200
Commit:     Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Thu Aug 16 09:19:02 2018 +0200

    Don't embed links to all the languages into every page.
    
    Change-Id: I31f140919a18db55ef5afab9f229afa7eed3e36c
    Reviewed-on: https://gerrit.libreoffice.org/59139
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/help3xsl/help2.js b/help3xsl/help2.js
index aed610371..15a744ddb 100644
--- a/help3xsl/help2.js
+++ b/help3xsl/help2.js
@@ -137,4 +137,16 @@ function existingLang(lang) {
 
     return 'en-US';
 }
+
+function setupLanguages(target, page) {
+    var langNav = document.getElementById('langs-nav');
+    if (!langNav.classList.contains('loaded')) {
+        var html = '';
+        languagesSet.forEach(lang => {
+            html += '<a href="' + target + lang + page + '">' + lang + '</a>';
+        });
+        langNav.innerHTML = html;
+        langNav.classList.add('loaded');
+    }
+}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/help3xsl/online_transform.xsl b/help3xsl/online_transform.xsl
index 23b72c8cd..167eb57f2 100644
--- a/help3xsl/online_transform.xsl
+++ b/help3xsl/online_transform.xsl
@@ -150,7 +150,8 @@
         <link rel="shortcut icon" href="{$target}media/navigation/favicon.ico" />
         <link  type="text/css" href="{$target}normalize.css" rel="Stylesheet" />
         <link  type="text/css" href="{$target}default.css" rel="Stylesheet" />
-       <script type="text/javascript" src="{$target}help2.js"></script>
+        <script type="text/javascript" src="{$target}help2.js"></script>
+        <script type="text/javascript" src="{$target}languages.js"></script>
         <script type="text/javascript" src="{$target}fuse.js"></script>
         <script type="text/javascript" src="{$target}paginathing.js"></script>
         <meta name="viewport" content="width=device-width,initial-scale=1"/>
@@ -187,14 +188,14 @@
         </div>
         <xsl:if test="$online">
             <div class="lang">
-                <input id="langs" name="language-menu" type="checkbox"/>
+                <input id="langs" name="language-menu" type="checkbox" onchange="setupLanguages('{$target}', '{$htmlpage}');"/>
                 <label for="langs"><xsl:value-of select="$ui_language"/></label>
-                <nav>
-                    <xsl:for-each select="$tmp_doc_ui//list//variable">
+                <nav id="langs-nav">
+                    <!--xsl:for-each select="$tmp_doc_ui//list//variable">
                         <xsl:variable name ="ui_l1" select="@id"/>
                         <xsl:variable name ="ui_l2" select="."/>
                         <a href="{$target}{$ui_l1}{$htmlpage}"><xsl:value-of select="$ui_l2"/></a>
-                    </xsl:for-each>
+                    </xsl:for-each-->
                 </nav>
             </div>
         </xsl:if>


More information about the Libreoffice-commits mailing list