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.
38 lines
2.3 KiB
HTML
38 lines
2.3 KiB
HTML
{% for machine in page.machines %}
|
|
{% capture machine_embed %}window.embed{{ machine.type | remove:'-dbg' | upcase }}{% endcapture %}
|
|
{% unless machine.config %}
|
|
{% assign machine_config = "machine.xml" %}
|
|
{% else %}
|
|
{% assign machine_config = machine.config %}
|
|
{% endunless %}
|
|
{% unless machine.template %}
|
|
{% assign machine_template = '' %}
|
|
{% else %}
|
|
{% assign machine_template = machine.template %}
|
|
{% 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 %}
|
|
{{ machine_script }}
|
|
{% endunless %}
|
|
{% capture machine_scripts %}{{ machine_scripts }}{{ machine_script }}{% endcapture %}
|
|
{% if machine_template == '' %}
|
|
{% capture machine_template %}{{ site.baseurl }}/versions/{{ machine.type | remove:'-dbg' }}js/{{ site.pcjs.version }}/components.xsl{% endcapture %}
|
|
{% endif %}
|
|
{% else %}
|
|
{% if machine.type == "pc" or machine.type == "pc-dbg" %}{% assign array_scripts = site.pcjs.pc_scripts %}{% endif %}
|
|
{% if machine.type == "c1p" or machine.type == "c1p-dbg" %}{% assign array_scripts = site.pcjs.c1p_scripts %}{% endif %}
|
|
{% for script in array_scripts %}
|
|
{% capture machine_script %}<script type="text/javascript" src="{{ site.baseurl }}{{ script }}"></script>{% endcapture %}
|
|
{% unless machine_scripts contains machine_script %}
|
|
{{ machine_script }}
|
|
{% endunless %}
|
|
{% capture machine_scripts %}{{ machine_scripts }}{{ machine_script }}{% endcapture %}
|
|
{% endfor %}
|
|
{% if machine_template == '' %}
|
|
{% 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_parms }}');</script>
|
|
{% endfor %}
|