Fixed option to override 'state' property of a saved machine

This commit is contained in:
Jeff Parsons 2016-02-17 17:50:23 -08:00
commit 4bb7c65208
7 changed files with 132 additions and 10 deletions

View file

@ -372,18 +372,18 @@ Computer.prototype.setMachineParms = function(parmsMachine)
*
* @param {string} sParm
* @param {Object} [parmsComponent]
* @return {string|null}
* @return {string|undefined}
*/
Computer.prototype.getMachineParm = function(sParm, parmsComponent)
{
var value = null;
var value;
if (this.parmsMachine) {
value = this.parmsMachine[sParm];
}
if (value == null && parmsComponent) {
if (value === undefined && parmsComponent) {
value = parmsComponent[sParm];
}
if (value == null && typeof resources == 'object' && resources[sParm]) {
if (value === undefined && typeof resources == 'object' && resources[sParm]) {
value = sParm;
}
return value;

View file

@ -55,7 +55,7 @@ function savePC(idMachine, sPCJSFile)
var sState = cmp.powerOff(true);
var sParms = cmp.saveMachineParms();
if (!sPCJSFile) {
if (MAXDEBUG) {
if (DEBUG) {
sPCJSFile = "/tmp/pcjs/" + (XMLVERSION || APPVERSION) + "/pc.js"
} else {
sPCJSFile = "/versions/pcjs/" + (XMLVERSION || APPVERSION) + "/pc" + (dbg? "-dbg" : "") + ".js";
@ -209,7 +209,7 @@ function downloadPC(sURL, sCSS, nErrorCode, aMachineInfo)
}
var link = document.createElement('a');
if (typeof link.download == 'string') {
if (!DEBUG && typeof link.download == 'string') {
link.href = uri;
link.download = sScript + ".json";
document.body.appendChild(link); // Firefox requires the link to be in the body (?)