From a9229c64432362ca7a413835880b4403eaf3f11f Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Thu, 30 Jul 2015 14:46:31 -0700 Subject: [PATCH] Tweaked the XMLVERSION kludge --- modules/pcjs/lib/computer.js | 4 ++-- modules/shared/lib/defines.js | 2 +- modules/shared/lib/embed.js | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/pcjs/lib/computer.js b/modules/pcjs/lib/computer.js index 59076e3c7..7f71b616d 100644 --- a/modules/pcjs/lib/computer.js +++ b/modules/pcjs/lib/computer.js @@ -1242,9 +1242,9 @@ Computer.prototype.getComponentByType = function(sType, componentPrev) 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"); diff --git a/modules/shared/lib/defines.js b/modules/shared/lib/defines.js index bf0d4d895..0dc748cac 100644 --- a/modules/shared/lib/defines.js +++ b/modules/shared/lib/defines.js @@ -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 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} diff --git a/modules/shared/lib/embed.js b/modules/shared/lib/embed.js index 164fe2595..794c5f775 100644 --- a/modules/shared/lib/embed.js +++ b/modules/shared/lib/embed.js @@ -128,11 +128,11 @@ function parseXML(sXML, sXMLFile, idMachine, sStateFile, fResolve, display, done sXML = sXML.replace(/(]*\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, - * since fResolve is false) with any APPVERSION we extracted from the XML file (see corresponding kludge below). + * Non-COMPILED kludge to replace the version number template in the XSL file (which we assume we're reading, + * since fResolve is false) with whatever XMLVERSION we extracted from the XML file (see corresponding kludge below). */ - if (DEBUG && !fResolve && DEBUG_APPVERSION) { - sXML = sXML.replace(/1.x.x<\/xsl:variable>/, '' + DEBUG_APPVERSION + ''); + if (!COMPILED && !fResolve && XMLVERSION) { + sXML = sXML.replace(/1.x.x<\/xsl:variable>/, '' + XMLVERSION + ''); } /* * 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; } /* - * 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. */ - if (DEBUG) { + if (!COMPILED) { 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) { if (!xsl) {