Changed the last embedPC() parameter from sStateFile to sParms, although for backward compatibility, if sParms is not a JSON object definition (ie, beginning with a brace), it continues to be treated as a state filename.

This change allows us to pass any number of additional properties to embedPC(), which in turn can override properties contained in the XML file; the only property overrides currently supported are 'state' (which overrides any 'state' property set in the XML's <computer> element) and 'automount' (which overrides any 'automount' property set in the XML's <fdc> element).  The goal is to make it easier to reuse XML machine definitions, by allowing commonly altered component attributes to be overridden.
This commit is contained in:
Jeff Parsons 2016-01-18 16:11:08 -08:00
commit 12b760f912
28 changed files with 2187 additions and 2059 deletions

View file

@ -10,11 +10,7 @@
{% else %}
{% assign machine_template = machine.template %}
{% endunless %}
{% unless machine.state %}
{% assign machine_state = '' %}
{% else %}
{% assign machine_state = machine.state %}
{% endunless %}
{% capture machine_parms %}{{ site.left_brace }}state:"{{ machine.state }}",autoMount:{{ machine.automount|jsonify }}{{ site.right_brace }}{% endcapture %}
{% if site.pcjs.compiled == true and machine.uncompiled != true %}
{% capture machine_script %}<script type="text/javascript" src="{{ site.baseurl }}/versions/{{ machine.type | remove:'-dbg' }}js/{{ site.pcjs.version }}/{{ machine.type }}.js"></script>{% endcapture %}
{% unless machine_scripts contains machine_script %}
@ -38,5 +34,5 @@
{% capture machine_template %}{{ site.baseurl }}/modules/{{ machine.type | remove:'-dbg' }}js/templates/components.xsl{% endcapture %}
{% endif %}
{% endif %}
<script type="text/javascript">{{ machine_embed }}("{{ machine.id }}","{{ machine_config }}","{{ machine_template }}","{{ machine_state }}");</script>
<script type="text/javascript">{{ machine_embed }}("{{ machine.id }}","{{ machine_config }}","{{ machine_template }}",'{{ machine_parms }}');</script>
{% endfor %}