-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
103 lines (95 loc) · 2.78 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>VR Viewer Selection</title>
<style>
body {
display: flex;
margin: 0;
height: 100vh;
}
.list-container {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
}
.list {
padding: 20px;
list-style-type: none;
}
.list-item {
padding: 10px;
border: 1px solid #ddd;
margin-bottom: 5px;
cursor: pointer;
}
.list-item:hover,
.list-item.selected {
background-color: #f0f0f0;
}
#saveButton {
position: absolute;
bottom: 90px;
left: 50%;
transform: translateX(-50%);
padding: 10px 20px;
cursor: pointer;
}
</style>
</head>
<body>
<div class="list-container" id="sceneListContainer">
<ul class="list" id="sceneList">
<!-- Scenes will be populated here -->
</ul>
</div>
<div class="list-container" id="avatarListContainer">
<ul class="list" id="avatarList">
<!-- Avatars will be populated here -->
</ul>
</div>
<button id="saveButton">Make VR Scene</button>
<script>
// Placeholder for scene and avatar data
const scenes = ["scene_1", "scene_2"];
const avatars = ["avatar_1", "avatar_2"];
const sceneList = document.getElementById("sceneList");
const avatarList = document.getElementById("avatarList");
function populateList(listElement, items, type) {
items.forEach((item) => {
const li = document.createElement("li");
li.textContent = item;
li.className = "list-item";
li.onclick = function () {
document
.querySelectorAll(`#${type}List .list-item`)
.forEach((i) => {
i.classList.remove("selected");
});
li.classList.add("selected");
};
listElement.appendChild(li);
});
}
populateList(sceneList, scenes, "scene");
populateList(avatarList, avatars, "avatar");
document.getElementById("saveButton").onclick = function () {
const selectedScene = document.querySelector(
"#sceneList .selected"
)?.textContent;
const selectedAvatar = document.querySelector(
"#avatarList .selected"
)?.textContent;
if (selectedScene && selectedAvatar) {
const url = `demo.html?scene=${selectedScene}&avatar=${selectedAvatar}`;
window.location.href = url;
} else {
alert("Please select both a scene and an avatar.");
}
};
</script>
</body>
</html>