Major Update

- Added support for dynamic links and arrays of parts to 3d_printed_parts.yml and parts.html
This commit is contained in:
ZanzyTHEbar 2022-06-06 01:12:59 +02:00
parent c1767715ad
commit a96927353e
2 changed files with 20 additions and 25 deletions

View File

@ -2,13 +2,16 @@
# Use this YAML file to create a list supported hmds and 3d parts for them.
- hmd: "Quest 2"
parts: "Camera and IR emitter mount by Prohurtz https://www.thingiverse.com/thing:5400548 \n
ESP Mount : N/A \n"
parts: ["ESP Mount : N/A"]
hyper_link: "https://www.thingiverse.com/thing:5400548"
link_description: "Camera and IR emitter mount by Prohurtz"
faq_link_id: 1
- hmd: "Valve Index"
parts: "Camera mount by Razgriz https://github.com/rrazgriz/IndexEyeTrackVR/tree/main/hardware \n
IR Emitter Mount : N/A \n
ESP mount : N/A \n"
parts: ["IR Emitter Mount : N/A", "ESP mount : N/A"]
hyper_link: "https://github.com/rrazgriz/IndexEyeTrackVR/tree/main/hardware"
link_description: "Camera mount by Razgriz"
faq_link_id: 2
---

View File

@ -71,8 +71,17 @@
</div>
<div class="parts">
<blockquote>
<span class="parts-span">
{{ faq.parts }}
<span class="answerspan{{ faq.faq_link_id }}">
{%- capture hyper_link -%}
<a href="{{ faq.hyper_link }}" target="_blank">{{ faq.link_description }}</a>
{%- endcapture -%}
<ul>
{{ hyper_link }}
{% for part in faq.parts %}
<li>{{ part }}</li>
{% endfor %}
{{ parts }}
</ul>
</span>
</blockquote>
</div>
@ -82,27 +91,10 @@
</div>
<script type="text/javascript">
const accordion = document.getElementsByClassName('container');
window.addEventListener('load', function () {
createElement();
});
for (i = 0; i < accordion.length; i++) {
accordion[i].addEventListener('click', function () {
this.classList.toggle('active');
})
}
function replaceLink(str) {
const link = document.querySelectorAll('.parts-span');
const all_link = link.forEach(function (link) {
const hyper_link = link.innerHTML;
link.innerHTML = hyper_link.replace(/aaaa./g, str);
});
}
function createElement() {
for (let x in accordion) {
replaceLink('<a href="https://dammedia.osram.info/media/bin/osram-dam-2496608/AN002_Details%20on%20photobiological%20safety%20of%20LED%20light%20sources.pdf" target="_blank">here is a pdf with safety information</a>');
}
}
</script>
</script>