Difference between revisions of "Widget:3DModelViewer"
imported>Elaeagnifolia |
imported>Elaeagnifolia |
||
| Line 1: | Line 1: | ||
| + | <script> | ||
| + | const adventurers = <!--{$adventurers}-->; | ||
| + | |||
| + | function initializeAdvList() { | ||
| + | if (!adventurers) { | ||
| + | return; | ||
| + | } | ||
| + | |||
| + | let advSelect = document.getElementById("heroSelect"); | ||
| + | let advList = []; | ||
| + | |||
| + | for (const adv of adventurers) { | ||
| + | advList.push(adv); | ||
| + | } | ||
| + | _populateSelectBox(advSelect, advList); | ||
| + | } | ||
| + | |||
| + | function _populateSelectBox(ele, list, defaultIndex = 0) { | ||
| + | ele.options.length = 0; | ||
| + | for (let i = 0; i < list.length; i++) { | ||
| + | let opt = document.createElement('option'); | ||
| + | opt.innerHTML = list[i]; | ||
| + | opt.value = list[i]; | ||
| + | ele.appendChild(opt); | ||
| + | } | ||
| + | ele.selectedIndex = defaultIndex; | ||
| + | } | ||
| + | |||
| + | function changeModel() { | ||
| + | |||
| + | } | ||
| + | </script> | ||
| + | <select id="advSelect" name="advSelect" onChange="changeModel(this)"></select> | ||
<iframe width="100%" height="480px" src="https://poly.google.com/view/5qtpxxZwLRC/embed" frameborder="0" style="border:none;" allowvr="yes" allow="vr; xr; accelerometer; magnetometer; gyroscope; autoplay;" allowfullscreen mozallowfullscreen="true" webkitallowfullscreen="true" onmousewheel="" ></iframe> | <iframe width="100%" height="480px" src="https://poly.google.com/view/5qtpxxZwLRC/embed" frameborder="0" style="border:none;" allowvr="yes" allow="vr; xr; accelerometer; magnetometer; gyroscope; autoplay;" allowfullscreen mozallowfullscreen="true" webkitallowfullscreen="true" onmousewheel="" ></iframe> | ||
Revision as of 19:45, 10 November 2018
<script> const adventurers = ;
function initializeAdvList() { if (!adventurers) { return; }
let advSelect = document.getElementById("heroSelect"); let advList = [];
for (const adv of adventurers) { advList.push(adv); } _populateSelectBox(advSelect, advList); }
function _populateSelectBox(ele, list, defaultIndex = 0) {
ele.options.length = 0;
for (let i = 0; i < list.length; i++) {
let opt = document.createElement('option');
opt.innerHTML = list[i];
opt.value = list[i];
ele.appendChild(opt);
}
ele.selectedIndex = defaultIndex;
}
function changeModel() {
} </script> <select id="advSelect" name="advSelect" onChange="changeModel(this)"></select> <iframe width="100%" height="480px" src="https://poly.google.com/view/5qtpxxZwLRC/embed" frameborder="0" style="border:none;" allowvr="yes" allow="vr; xr; accelerometer; magnetometer; gyroscope; autoplay;" allowfullscreen mozallowfullscreen="true" webkitallowfullscreen="true" onmousewheel="" ></iframe>