partey_workadventure/maps/tests/iframe.html
2021-05-10 14:43:00 +02:00

36 lines
1.2 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<script src="http://play.workadventure.localhost/iframe_api.js"></script>
</head>
<body>
<button id="sendchat">Send chat message</button>
<script>
document.getElementById('sendchat').onclick = () => {
WA.sendChatMessage('Hello world!', 'Mr Robot');
}
</script>
<div id="chatSent"></div>
<script>
WA.onChatMessage((message => {
const chatDiv = document.createElement('p');
chatDiv.innerText = message;
document.getElementById('chatSent').append(chatDiv);
}));
</script>
<div>
<label for="visibilityLayer">Metadata Layer</label><input type="checkbox" id="visibilityLayer" name="visible" value="show" checked>
</div>
<script>
document.getElementById('visibilityLayer').onclick = () => {
if (document.getElementById('visibilityLayer').checked) {
WA.showLayer('Metadata');
}
else {
WA.hideLayer('Metadata');
}
}
</script>
</body>
</html>