[Libreoffice-commits] dev-tools.git: help3/xhpeditor
Olivier Hallot (via logerrit)
logerrit at kemper.freedesktop.org
Thu Dec 5 10:21:52 UTC 2019
help3/xhpeditor/xhp2html.js | 65 ++------------------------------------------
1 file changed, 3 insertions(+), 62 deletions(-)
New commits:
commit 50a55560c3f0d620d376d94a64eb6ecfc5c6091b
Author: Olivier Hallot <olivier.hallot at libreoffice.org>
AuthorDate: Wed Dec 4 18:48:24 2019 -0300
Commit: Olivier Hallot <olivier.hallot at libreoffice.org>
CommitDate: Thu Dec 5 11:21:35 2019 +0100
Move editor to php (5) (WIP)
remove cruft from javascript
Change-Id: Iabb1b9518d90b68eebececb36c7ab431adbbf0e6
Reviewed-on: https://gerrit.libreoffice.org/84469
Reviewed-by: Olivier Hallot <olivier.hallot at libreoffice.org>
Tested-by: Olivier Hallot <olivier.hallot at libreoffice.org>
diff --git a/help3/xhpeditor/xhp2html.js b/help3/xhpeditor/xhp2html.js
index d50c51e..a38f4fc 100644
--- a/help3/xhpeditor/xhp2html.js
+++ b/help3/xhpeditor/xhp2html.js
@@ -9,13 +9,6 @@
/* change these parameters to fit your installation */
-var prefixURL="/help_editor/"
-var helpcontent2 = "hc2/";
-var productname = "LibreOffice";
-var productversion = "6.3";
-var root = prefixURL + helpcontent2 + "source/";
-var language = "en-US";
-var local = "no";
var xhttp;
function loadDoc(filename, isXML)
@@ -28,67 +21,15 @@ function loadDoc(filename, isXML)
{
xhttp = new XMLHttpRequest();
}
-
-// xhttp.onreadystatechange = function() {
-// if (this.readyState == 4 && this.status == 200) {
-// // Typical action to be performed when the document is ready:
-// }
-// };
- xhttp.open("GET", prefixURL + filename, false);
+ xhttp.open("GET", filename, false);
try {xhttp.responseType = "msxml-document"} catch(err) {} // Helping IE11
// if isXML=true return XML otherwise return a text string
xhttp.send(null);
var response = (isXML) ? xhttp.responseXML : xhttp.responseText;
- return response
+ return response;
}
-function displayResult()
-{
- // Clean current renderedpage <div> contents
- document.getElementById("renderedpage").innerHTML = null;
- // trigger update on textarea contents, after editing anything
- editor.changeGeneration();
- // create a DOM parser for textarea contents
- var oParser = new DOMParser();
- // Parse XML contents, check if XML error.
- var xml = oParser.parseFromString( editor.doc.getValue(), "text/xml");
- if (xml.documentElement.nodeName == "parsererror")
- {
- alert ("Error while parsing XHP");
- }
- // Load XSLT as TXT because XML it has issues
- var xsl1 = loadDoc("ed_transform.xsl", false);
- var oParser2 = new DOMParser();
- var xsl = oParser2.parseFromString( xsl1, "application/xml");
- // Process transformation & display in 'renderedpage'
- // code for IE
- if (window.ActiveXObject || xhttp.responseType == "msxml-document")
- {
- ex = xml.transformNode(xsl);
- document.getElementById("renderedpage").appendChild(ex.getElementById("DisplayArea"));
- }
- // code for Chrome, Firefox, Opera, etc.
- else if (document.implementation && document.implementation.createDocument)
- {
- var xsltProcessor = new XSLTProcessor();
- xsltProcessor.importStylesheet(xsl);
- xsltProcessor.setParameter("", "root", root);
- xsltProcessor.setParameter("", "local", local);
- xsltProcessor.setParameter("", "language", language);
- xsltProcessor.setParameter("", "productname", productname);
- xsltProcessor.setParameter("", "productversion", productversion);
- var resultDocument = xsltProcessor.transformToFragment(xml, document);
- document.getElementById("renderedpage").appendChild(resultDocument.getElementById("DisplayArea"));
- }
-}
function loadText(filename){
- var text = loadDoc(helpcontent2 + filename,false);
+ var text = loadDoc(filename,false);
editor.doc.setValue(text);
}
-function saveFile(){
- var data = new FormData();
- data.append("data" , editor.doc.getValue());
- var xhr = (window.XMLHttpRequest) ? new XMLHttpRequest() : new activeXObject("Microsoft.XMLHTTP");
- xhr.open( 'post', '/ed/savexhp.php', true );
- xhr.send(data);
-}
More information about the Libreoffice-commits
mailing list