Difference between revisions of "Widget:3DModelViewer"
Jump to navigation
Jump to search
imported>Elaeagnifolia |
>Canim44 m (Euden -> The Prince) |
||
| (41 intermediate revisions by one other user not shown) | |||
| Line 8: | Line 8: | ||
| − | + | document.addEventListener("DOMContentLoaded", function(event) { | |
| − | + | let advSelect = document.getElementById("advSelect"); | |
| − | + | let dragonSelect = document.getElementById("dragonSelect"); | |
| − | + | let weaponSelect = document.getElementById("weaponSelect"); | |
| − | + | let weaponsSheathedSelect = document.getElementById("weaponsSheathedSelect"); | |
| − | + | let enemySelect = document.getElementById("enemySelect"); | |
| − | + | let miscSelect = document.getElementById("miscSelect"); | |
| − | |||
| − | + | initializeList(adventurers, advSelect, "Adventurers"); | |
| − | + | initializeList(dragons, dragonSelect, "Dragons"); | |
| − | + | initializeList(weapons, weaponSelect, "Weapons"); | |
| − | + | initializeList(weaponsSheathed, weaponsSheathedSelect, "Sheathed Blades"); | |
| − | + | initializeList(enemies, enemySelect, "Enemies"); | |
| − | + | initializeList(misc, miscSelect, "Other"); | |
| − | |||
}); | }); | ||
function initializeList(content, select, label) { | function initializeList(content, select, label) { | ||
| − | + | if (!content) { | |
| − | + | return; | |
| − | + | } | |
| − | + | ||
| − | + | let list = []; | |
| − | + | list.push("---" + label + "---"); | |
| − | + | ||
| − | + | for (const c of content) { | |
| − | + | list.push(c); | |
| − | + | } | |
| − | + | _populateSelectBox(select, list); | |
} | } | ||
| Line 52: | Line 50: | ||
function changeModel(obj) { | function changeModel(obj) { | ||
| − | + | value = obj.value; | |
| − | + | modelViewer = document.getElementById("modelViewer"); | |
| − | + | if (value.indexOf("---") !== -1) { | |
| − | + | modelViewer.innerHTML = ''; | |
| − | + | } else if (getModelEmbedSrcLink(value) != '') { | |
| − | + | modelViewer.innerHTML = '<iframe width="100%" height="480px" src="https://poly.google.com/view/' + getModelEmbedSrcLink(value) + '/embed" frameborder="0" style="border:none;" allowvr="yes" allow="vr; xr; accelerometer; magnetometer; gyroscope; autoplay;" allowfullscreen mozallowfullscreen="true" webkitallowfullscreen="true" onmousewheel="" ></iframe>'; | |
| − | + | } else { | |
| − | + | modelViewer.innerHTML = 'This adventurer does not yet have a model uploaded.'; | |
| − | + | } | |
} | } | ||
function getModelEmbedSrcLink(name) { | function getModelEmbedSrcLink(name) { | ||
| − | + | var modelSrcMap = new Map([ | |
| − | + | ["Aeleen", "7S97pOzmItM"], | |
| − | + | ["Alain", "7_y06y6IRpC"], | |
| − | + | ["Althemia", "bmYXZQ0D9f4"], | |
| − | + | ["Amane", "f5RfG6WVBxl"], | |
| − | + | ["Aoi", "3HoJ6QE-VgW"], | |
| − | + | ["Aurien", "2yJGsnRyR0u"], | |
| − | + | ["Berserker", "7M73oLoFUwZ"], | |
| − | + | ["Celliera", "7r7z3_L4GId"], | |
| − | + | ["Cibella", "7XQBlkcRllk"], | |
| − | + | ["Cleo", "e4BexuEPTPB"], | |
| − | + | ["Edward", "4zmNXD4dBTz"], | |
| − | + | ["Eleonora", "bV52jFo8bHm"], | |
| − | + | ["Elisanne", "e7pE5cBZw_B"], | |
| − | + | ["Erik", "fMigQCWUsWK"], | |
| − | + | ["Estelle", "bHm8Y3IR45j"], | |
| − | + | ["The Prince", "exjY_boCLIN"], | |
| − | + | ["Ezelith", "6SfuTwuTal7"], | |
| − | + | ["Francesca", "7ux2vJHPGiK"], | |
| − | + | ["Halloween Althemia", "cCFpMVG3BeB"], | |
| − | + | ["Halloween Edward", "fYD7mFd4biX"], | |
| − | + | ["Halloween Elisanne", "0IirnspqFI6"], | |
| − | + | ["Hawk", "09awd_PsjI2"], | |
| − | + | ["Hildegarde", "1pwHNesJQNA"], | |
| − | + | ["Hope", "edUBHZ4zUfR"], | |
| − | + | ["Irfan", "bFv1qEsmhZ_"], | |
| − | + | ["Joe", "1yXlGZJIrn_"], | |
| − | + | ["Johanna", "3LXvcGdIA2E"], | |
| − | + | ["Julietta", "5WXBldkIIZY"], | |
| − | + | ["Jurota", "6qHgF5akCO_"], | |
| − | + | ["Karina", "6BIsXmrzghi"], | |
| − | + | ["Karl", "3OwDyIPqTi3"], | |
| − | + | ["Kleimann", "8FI6msO-kP7"], | |
| − | + | ["Lily", "0M3C6RVA0t2"], | |
| − | + | ["Linus", "1bxq5kdL3HN"], | |
| − | + | ["Luca", "0ebNtFAjts3"], | |
| − | + | ["Luther", "7_eUk_kdpYf"], | |
| − | + | ["Malka", "96VmCs-aB9L"], | |
| − | + | ["Malora", "6UKkDMDoQmf"], | |
| − | + | ["Maribelle", "cUNyU2PsVxA"], | |
| − | + | ["Melody", "b2rUTwhMEvU"], | |
| − | + | ["Melsa", "4mHlunpoYEY"], | |
| − | + | ["Mikoto", "4vypFqh1SIX"], | |
| − | + | ["Musashi", "afFNVixzkFQ"], | |
| − | + | ["Naveed", "2cyOWQoXvv2"], | |
| − | + | ["Nefaria", "7lvVNNkpxLi"], | |
| − | + | ["Nicolas", "4rSxlI6YByb"], | |
| − | + | ["Orion", "9b5lrOrvxuh"], | |
| − | + | ["Orsem", "fOmPWu8ZCfB"], | |
| − | + | ["Philia", "6r0GOc7cmJ6"], | |
| + | ["Raemond", "98tsYAS7-LZ"], | ||
| + | [ | ||
| − | + | return modelSrcMap.get(name); | |
} | } | ||
</script> | </script> | ||