Work begins on v1.20.9, starting with support for an autoPower machine parameter (which can be encoded as autopower in the Front Matter of a web page)
This commit is contained in:
parent
a9e5979406
commit
3b4cc494c8
165 changed files with 622 additions and 584 deletions
|
|
@ -326,9 +326,13 @@ MarkOut.aHTMLEntities = {
|
|||
*
|
||||
* 'state' (eg, "state.json")
|
||||
* 'messages' (eg, "disk")
|
||||
* 'autopower' (eg, true)
|
||||
*
|
||||
* and any other string-based property you wish to pass through to PCjs (via the embedPC() sParms parameter).
|
||||
*/
|
||||
MarkOut.aFMBooleanMachineProps = {
|
||||
'autopower': "autoPower"
|
||||
};
|
||||
MarkOut.aFMReservedMachineProps = ['id', 'name', 'type', 'config', 'template', 'uncompiled', 'automount', 'parms'];
|
||||
|
||||
/**
|
||||
|
|
@ -455,6 +459,10 @@ MarkOut.prototype.convertMD = function(sIndent)
|
|||
machine['parms'] = '{';
|
||||
for (sProp in machine) {
|
||||
if (MarkOut.aFMReservedMachineProps.indexOf(sProp) < 0) {
|
||||
if (MarkOut.aFMBooleanMachineProps[sProp]) {
|
||||
machine['parms'] += MarkOut.aFMBooleanMachineProps[sProp] + ':' + machine[sProp] + ',';
|
||||
continue;
|
||||
}
|
||||
machine['parms'] += sProp + ':"' + machine[sProp] + '",';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,7 +134,9 @@ function Computer(parmsComputer, parmsMachine, fSuspended) {
|
|||
Component.call(this, "Computer", parmsComputer, Computer, Messages.COMPUTER);
|
||||
|
||||
this.aFlags.fPowered = false;
|
||||
this.fAutoPower = parmsComputer['autoPower'];
|
||||
this.parmsMachine = parmsMachine;
|
||||
|
||||
this.fAutoPower = this.getMachineParm('autoPower', parmsComputer);
|
||||
|
||||
/*
|
||||
* nPowerChange is 0 while the power state is stable, 1 while power is transitioning
|
||||
|
|
@ -152,7 +154,6 @@ function Computer(parmsComputer, parmsMachine, fSuspended) {
|
|||
this.fStateData = false; // remembers if sStateData was loaded
|
||||
this.fServerState = false;
|
||||
|
||||
this.parmsMachine = parmsMachine;
|
||||
this.url = this.getMachineParm('url') || "";
|
||||
|
||||
/*
|
||||
|
|
@ -331,14 +332,22 @@ Computer.prototype.getMachineID = function()
|
|||
};
|
||||
|
||||
/**
|
||||
* getMachineParm(sParm)
|
||||
* getMachineParm(sParm, parmsComponent)
|
||||
*
|
||||
* If the machine parameter doesn't exist, and component parameters have been provided, we'll automatically look up the latter.
|
||||
*
|
||||
* @param {string} sParm
|
||||
* @return {string|undefined}
|
||||
* @param {Object} [parmsComponent]
|
||||
* @return {Object|number|string|boolean|null|undefined}
|
||||
*/
|
||||
Computer.prototype.getMachineParm = function(sParm)
|
||||
Computer.prototype.getMachineParm = function(sParm, parmsComponent)
|
||||
{
|
||||
return this.parmsMachine && this.parmsMachine[sParm];
|
||||
if (this.parmsMachine) {
|
||||
if (this.parmsMachine[sParm] != null) {
|
||||
return this.parmsMachine[sParm];
|
||||
}
|
||||
}
|
||||
return parmsComponent? parmsComponent[sParm] : null;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -348,7 +357,7 @@ Computer.prototype.getMachineParm = function(sParm)
|
|||
*/
|
||||
Computer.prototype.getUserID = function()
|
||||
{
|
||||
return this.sUserID? this.sUserID : "";
|
||||
return this.sUserID || "";
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue