partey_workadventure/maps/tests/iframe.html

43 lines
1.7 KiB
HTML
Raw Normal View History

<!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>
let chatbotEnabled=false
WA.registerMenuCommand('help', () => {
chatbotEnabled=true;
WA.sendChatMessage("Bonjour Monsieur/Madame, Comment puis-je vous aider ?", 'Mr Robot');
WA.onChatMessage((message => {
const chatDiv = document.createElement('p');
chatDiv.innerText = 'Vous avez tapé : ' + message;
document.getElementById('chatSent').append(chatDiv);
WA.sendChatMessage('Votre message : "' + message + '" a bien ete recu. Merci de bien vouloir patienter pendant son traitement.', 'Mr ROBOT');
}));
});
</script>
<div>
<label for="show/hideLayer">Metadata Layer : </label><input type="checkbox" id="show/hideLayer" name="visible" value="show" checked>
</div>
<script>
2021-05-10 15:10:11 +02:00
document.getElementById('show/hideLayer').onclick = () => {
if (document.getElementById('show/hideLayer').checked) {
WA.showLayer('Metadata');
}
else {
WA.hideLayer('Metadata');
}
}
WA.setProperty('start', 'openWebsite', 'https://www.wikipedia.org/');
</script>
</body>
</html>