Tweaked the XMLVERSION kludge
This commit is contained in:
parent
269604d0b0
commit
a9229c6443
3 changed files with 10 additions and 10 deletions
|
|
@ -1242,9 +1242,9 @@ Computer.prototype.getComponentByType = function(sType, componentPrev)
|
||||||
Computer.init = function()
|
Computer.init = function()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* In DEBUG builds, embedMachine() may have set DEBUG_APPVERSION.
|
* In non-COMPILED builds, embedMachine() may have set XMLVERSION.
|
||||||
*/
|
*/
|
||||||
if (DEBUG && DEBUG_APPVERSION) Computer.sAppVer = DEBUG_APPVERSION;
|
if (!COMPILED && XMLVERSION) Computer.sAppVer = XMLVERSION;
|
||||||
|
|
||||||
var aeMachines = Component.getElementsByClass(window.document, PCJSCLASS + "-machine");
|
var aeMachines = Component.getElementsByClass(window.document, PCJSCLASS + "-machine");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ var APPNAME = ""; // this @define is overridden by the Closure Com
|
||||||
*/
|
*/
|
||||||
var APPVERSION = "1.x.x"; // this @define is overridden by the Closure Compiler with the version in package.json
|
var APPVERSION = "1.x.x"; // this @define is overridden by the Closure Compiler with the version in package.json
|
||||||
|
|
||||||
var DEBUG_APPVERSION = null; // this is set in DEBUG builds by embedMachine() if a version number was found in the machine XML
|
var XMLVERSION = null; // this is set in non-COMPILED builds by embedMachine() if a version number was found in the machine XML
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @define {string}
|
* @define {string}
|
||||||
|
|
|
||||||
|
|
@ -128,11 +128,11 @@ function parseXML(sXML, sXMLFile, idMachine, sStateFile, fResolve, display, done
|
||||||
sXML = sXML.replace(/(<machine[^>]*\sid=)(['"]).*?\2/, "$1$2" + idMachine + "$2" + (sStateFile? " state=$2" + sStateFile + "$2" : "") + (sURL? " url=$2" + sURL + "$2" : ""));
|
sXML = sXML.replace(/(<machine[^>]*\sid=)(['"]).*?\2/, "$1$2" + idMachine + "$2" + (sStateFile? " state=$2" + sStateFile + "$2" : "") + (sURL? " url=$2" + sURL + "$2" : ""));
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* DEBUG-only kludge to replace the version number template in the XSL file (which we assume we're reading,
|
* Non-COMPILED kludge to replace the version number template in the XSL file (which we assume we're reading,
|
||||||
* since fResolve is false) with any APPVERSION we extracted from the XML file (see corresponding kludge below).
|
* since fResolve is false) with whatever XMLVERSION we extracted from the XML file (see corresponding kludge below).
|
||||||
*/
|
*/
|
||||||
if (DEBUG && !fResolve && DEBUG_APPVERSION) {
|
if (!COMPILED && !fResolve && XMLVERSION) {
|
||||||
sXML = sXML.replace(/<xsl:variable name="APPVERSION">1.x.x<\/xsl:variable>/, '<xsl:variable name="APPVERSION">' + DEBUG_APPVERSION + '</xsl:variable>');
|
sXML = sXML.replace(/<xsl:variable name="APPVERSION">1.x.x<\/xsl:variable>/, '<xsl:variable name="APPVERSION">' + XMLVERSION + '</xsl:variable>');
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* If the resource we requested is not really an XML file (or the file didn't exist and the server simply returned
|
* If the resource we requested is not really an XML file (or the file didn't exist and the server simply returned
|
||||||
|
|
@ -357,12 +357,12 @@ function embedMachine(sName, sVersion, idElement, sXMLFile, sXSLFile, sStateFile
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* DEBUG-only kludge to extract the version number from the stylesheet path in the machine XML file;
|
* Non-COMPILED kludge to extract the version number from the stylesheet path in the machine XML file;
|
||||||
* we don't need this code in COMPILED (non-DEBUG) releases, because APPVERSION is hard-coded into them.
|
* we don't need this code in COMPILED (non-DEBUG) releases, because APPVERSION is hard-coded into them.
|
||||||
*/
|
*/
|
||||||
if (DEBUG) {
|
if (!COMPILED) {
|
||||||
var aMatch = sXML.match(/<\?xml-stylesheet[^>]* href=(['"])[^'"]*?\/([0-9.]*)\/([^'"]*)\1/);
|
var aMatch = sXML.match(/<\?xml-stylesheet[^>]* href=(['"])[^'"]*?\/([0-9.]*)\/([^'"]*)\1/);
|
||||||
if (aMatch && APPVERSION == "1.x.x") DEBUG_APPVERSION = aMatch[2];
|
if (aMatch) XMLVERSION = aMatch[2];
|
||||||
}
|
}
|
||||||
var transformXML = function(sXSL, xsl) {
|
var transformXML = function(sXSL, xsl) {
|
||||||
if (!xsl) {
|
if (!xsl) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue