<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
- <title>DynamicBox</title>
+ <title>Web Dynamic Box</title>
<script>
- window.onmessage = function(e) {
- document.getElementById("message").innerHTML += e.data;
- pdWindow.document.getElementById("fromBox").innerHTML += "<br>[web messaging] Hello, DropView";
- }
- window.addEventListener("pdevent",
+ window.addEventListener("pdmessage",
function(e) {
- document.getElementById("message").innerHTML += e.detail.message;
- pdWindow.document.getElementById("fromBox").innerHTML += "<br>[custom event] Hello, DropView";
+ document.getElementById("fromPd").innerHTML += unescape(e) + "<br>";
+ window.appwidget.sendMessageToPd("Hello, Drop View");
}, false);
</script>
</head>
<body bgcolor="#99CCFF" text="#FFFFFF">
- <div id="demo">DynamicBox Sample</div>
+ <div id="demo">Web Dynamic Box</div>
<div id="demo">This is a Box.</div>
- <div id="message"></div>
+ <div id="fromPd"></div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
- <meta name="viewport" content="initial-scale=1" />
- <title>Test</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title>Drop View</title>
<script>
- function accessParentElement() {
- window.opener.document.body.style.backgroundColor = "#BBFFFF";
- }
- function accessWebMessaging() {
- window.opener.postMessage ("web messaging!<br>", "*");
- }
+ window.addEventListener("boxmessage",
+ function(e) {
+ document.getElementById("fromBox").innerHTML += unescape(e) + '<br>';
+ }, false);
- // create custom event
- var event = new CustomEvent("pdevent", {
- detail: {
- message: "custom event!<br>",
- time: new Date(),
- },
- bubbles: true,
- cancelable: true
- });
- function accessCustomEvent() {
- window.opener.dispatchEvent(event);
+ function send () {
+ window.appwidget.sendMessageToBox("Hello, Dynamic Box");
}
</script>
<style>
</style>
</head>
<body bgcolor="#FF9966" text="#FFFFFF">
- This is a DropView.<br>A DropView can control the Box.<br>
- <input type="button" value="ColorChange" onclick="accessParentElement()" />
- <input type="button" value="WebMessage" onclick="accessWebMessaging()" />
- <input type="button" value="CustomEvent" onclick="accessCustomEvent()" />
+ This is a Drop View.<br>A Drop View can control the Box.<br>
+ <input type="button" value="Send message to Box" onclick="send()" />
<div id="fromBox"></div>
</body>
</html>