demo: extract routine executing Tizen device API
authorYoumin Ha <youmin.ha@samsung.com>
Fri, 25 Jan 2013 05:25:45 +0000 (14:25 +0900)
committerMinkyu Kang <mk7.kang@samsung.com>
Sat, 26 Jan 2013 09:31:59 +0000 (18:31 +0900)
Our sample app, tizen-winset and the TizenWisnet app in web-sampleapp
git repo do not equivalent, because the TizenWinset has more code
running Tizen device API. This patch extracts that additional routine to
the separated file, and run that routine only at available environment.

Change-Id: I4dedf221bc320d2b3141e35bcfd3a2bc6a051ce3

demos/tizen-winsets/index.html
demos/tizen-winsets/webappInit.js [new file with mode: 0644]

index cfd20d5..485c802 100644 (file)
@@ -11,6 +11,7 @@
 
        </script>
        <script src="main.js"></script>
+       <script src="webappInit.js"></script>
        <link rel="stylesheet" href="custom.css" />
 
        <title>Tizen UI</title>
@@ -23,7 +24,7 @@
 </head>
 
 <body>
-       <div data-role="page" data-add-back-btn="true">
+       <div data-role="page" id="main" data-add-back-btn="true">
                <div data-role="header" data-position="fixed">
                        <h1>Tizen Web UI</h1>
                </div>
diff --git a/demos/tizen-winsets/webappInit.js b/demos/tizen-winsets/webappInit.js
new file mode 100644 (file)
index 0000000..747f226
--- /dev/null
@@ -0,0 +1,9 @@
+$(document).delegate("#main", "pageinit", function() {
+       if ( tizen && tizen.application ) {
+               $("#main .ui-btn-back").bind("vclick", function() {
+                       tizen.application.getCurrentApplication().exit();
+                       return false;
+               });
+       }
+});
+