diff options
author | Css16 <fbbcchtt9@gmail.com> | 2017-03-26 23:05:52 +0200 |
---|---|---|
committer | Olivier Hallot <olivier.hallot@edx.srv.br> | 2017-03-29 17:18:47 +0000 |
commit | cf790c30c572ccf4ab5d0378733d673d437e42e1 (patch) | |
tree | 155055a016bbb4a3a623a616107239a5b82d9c08 /source/help.js | |
parent | 16d658196f9963a5eed6071c5c3db5c85520650e (diff) |
tdf#106574 JavaScript navigation history with links added, CSS improvements
Change-Id: I991e4a9c48f91997dc44fb7b9b9c2f57a3c49099
Reviewed-on: https://gerrit.libreoffice.org/35728
Reviewed-by: Olivier Hallot <olivier.hallot@edx.srv.br>
Tested-by: Olivier Hallot <olivier.hallot@edx.srv.br>
Diffstat (limited to 'source/help.js')
-rw-r--r-- | source/help.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/source/help.js b/source/help.js index 6de81edd9f..cb9cf393b6 100644 --- a/source/help.js +++ b/source/help.js @@ -47,6 +47,8 @@ function getParameterByName(name, url) { return decodeURIComponent(results[2].replace(/\+/g, " ")); } +var navigationHistory = []; + function displayXML(xml, xsl, urlVars, moduleName, language, system) { var xsltProcessor; var resultDocument; @@ -79,6 +81,35 @@ function displayXML(xml, xsl, urlVars, moduleName, language, system) { var fileName = $(this).attr('href'); + navigationHistory.push({ + name: $(this).text(), + fileName: fileName + }); + if (navigationHistory.length > 5) { + navigationHistory.shift(); + } + var previousHistory = '' + navigationHistory.forEach(function(history) { + previousHistory += '<span class="section" filename="' + history.fileName + '">' + history.name + '</span> > ' + }); + $('#NavigationHistory') + .html('<span>' + previousHistory + '</span>'); + + $('#NavigationHistory span.section').click(function() { + loadXMLDoc($(this).attr('filename'), function() { + var xmlDoc = this.responseXML; + if (xmlDoc != null) { + var resultDocument = xsltProcessor.transformToFragment(xmlDoc, document); + $("#DisplayArea").html($(resultDocument).find('#DisplayArea').html()); + $("#TopRight").html('<p class="bug">Contents displayed is: ' + fileName + '</p>'); + } + else { + console.log('Cannot load ' + fileName); + } + }); + }) + + loadXMLDoc(fileName, function() { var xmlDoc = this.responseXML; if (xmlDoc != null) { @@ -103,6 +134,8 @@ function displayXML(xml, xsl, urlVars, moduleName, language, system) { } function displayResult(file, moduleName, language, system) { + $('#NavigationHistory') + .html(''); // load the XSLT loadXMLDoc('online_transform.xsl', function() { var xsl = this.responseXML; |