[AppWidget]initialize AppWidget
authorgs86.lee <gs86.lee@samsung.com>
Mon, 8 Apr 2013 08:52:24 +0000 (17:52 +0900)
committergs86.lee <gs86.lee@samsung.com>
Mon, 8 Apr 2013 08:53:09 +0000 (17:53 +0900)
Change-Id: I67ea4b69b58e6c1e4ab9106e49a9d88bdc73a619

box/index.html [new file with mode: 0755]
config.xml [new file with mode: 0755]
icon.png [new file with mode: 0755]
index.html [new file with mode: 0755]
pd/index.html [new file with mode: 0755]

diff --git a/box/index.html b/box/index.html
new file mode 100755 (executable)
index 0000000..5d4c8c4
--- /dev/null
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+    <head>
+        <meta name="viewport" content="width=device-width, initial-scale=1">
+        <title>AppWidget</title>
+        <script>
+            window.onmessage = function(e) {
+                document.getElementById("message").innerHTML += e.data;
+                pdWindow.document.getElementById("fromBox").innerHTML += "<br>[web messaging] Hello, PD";
+            }
+
+            window.addEventListener("pdevent",
+                function(e) {
+                    document.getElementById("message").innerHTML += e.detail.message;
+                    pdWindow.document.getElementById("fromBox").innerHTML += "<br>[custom event] Hello, PD";
+                }, false);
+        </script>
+    </head>
+    <body bgcolor="#99CCFF" text="#FFFFFF" >
+        <div id="demo"><h1>AppWidget Sample</h1></div>
+        <div id="demo"><h1>This is a Box.</h1></div>
+        <div id="message"></div>
+    </body>
+</html>
diff --git a/config.xml b/config.xml
new file mode 100755 (executable)
index 0000000..7db54a8
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" id="http://yourdomain/sample">
+    <name>sample</name>
+    <icon src="icon.png"/>
+       <tizen:application id="kCBp6MjneD.sample" package="kCBp6MjneD" required_version="2.1"/>
+    <tizen:app-widget id="kCBp6MjneD.sample.default" primary="true" period="10.0">
+        <tizen:box-label>Web Application AppWidget Sample</tizen:box-label>
+        <tizen:box-icon src="icon.png"/>
+        <tizen:box-content src="box/index.html">
+            <tizen:box-size>1x1</tizen:box-size>
+            <tizen:box-size>2x1</tizen:box-size>
+            <tizen:box-size>2x2</tizen:box-size>
+            <tizen:box-size>4x2</tizen:box-size>
+            <tizen:pd src="pd/index.html" width="600" height="200" />
+        </tizen:box-content>
+    </tizen:app-widget>
+</widget>
diff --git a/icon.png b/icon.png
new file mode 100755 (executable)
index 0000000..983c883
Binary files /dev/null and b/icon.png differ
diff --git a/index.html b/index.html
new file mode 100755 (executable)
index 0000000..bab1d3c
--- /dev/null
@@ -0,0 +1,5 @@
+<html>
+       <body>
+               This is Web Application for livebox
+       </body>
+</html>
diff --git a/pd/index.html b/pd/index.html
new file mode 100755 (executable)
index 0000000..d0eb170
--- /dev/null
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+    <head>
+        <meta name="viewport" content="initial-scale=1">
+        <title>Test</title>
+        <script>
+            function accessParentElement() {
+                window.opener.document.body.style.backgroundColor = "#BBFFFF";
+            }
+            function accessWebMessaging() {
+                window.opener.postMessage ("web messaging!<br>", "*");
+            }
+
+            // 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);
+            }
+        </script>
+     </head>
+     <body bgcolor="#FF9966" text="#FFFFFF">
+        <h2>This is a pd.<br>A Pd can control the Box.<h2>
+        <input type="button" value="access element" onclick="accessParentElement()">
+        <input type="button" value="webmessage" onclick="accessWebMessaging()">
+        <input type="button" value="custom event" onclick="accessCustomEvent()">
+
+        <div id="fromBox"></div>
+     </body>
+</html>