Updated Private -> RSA
authorji.ji <ji.ji@samsung.com>
Wed, 26 Jun 2013 10:09:22 +0000 (19:09 +0900)
committerji.ji <ji.ji@samsung.com>
Wed, 26 Jun 2013 10:09:22 +0000 (19:09 +0900)
Change-Id: I94bad00c7a4682ebfbdccd42d442439ef1be6697

.project [new file with mode: 0755]
config.xml
css/style.css
index.html
js/main.js

diff --git a/.project b/.project
new file mode 100755 (executable)
index 0000000..49bdd3a
--- /dev/null
+++ b/.project
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>Piano</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.wst.common.project.facet.core.builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>json.validation.builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.tizen.web.jslint.nature.JSLintBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.tizen.web.css.nature.CSSBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.wst.validation.validationbuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.tizen.web.project.builder.WebBuilder</name>
+                       <arguments>
+                               <dictionary>
+                                       <key>usedLibraryType</key>
+                                       <value>WebUIFramework</value>
+                               </dictionary>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>json.validation.nature</nature>
+               <nature>org.tizen.web.jslint.nature.JSLintNature</nature>
+               <nature>org.tizen.web.css.nature.CSSNature</nature>
+               <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+               <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+               <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+               <nature>org.tizen.web.project.builder.WebNature</nature>
+       </natures>
+</projectDescription>
index b961e8e..93fabd2 100755 (executable)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" id="http://sample-web-application.tizen.org/piano" version="2.1.0" viewmodes="fullscreen">
-       <tizen:application id="YBsua5GDkL.Piano" package="YBsua5GDkL" required_version="2.1"/>
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" id="http://sample-web-application.tizen.org/piano" version="2.2.0" viewmodes="fullscreen">
+       <tizen:application id="YBsua5GDkL.Piano" package="YBsua5GDkL" required_version="2.2"/>
        <content src="index.html"/>
        <icon src="icon.png"/>
        <name>Piano</name>
index ff512bb..93d6cb9 100755 (executable)
@@ -34,7 +34,7 @@ body {
        height: 73.8%;
        background-size: 100%;
        background-position: top center;
-       position: absolute;
+       position: fixed;
        top: 0px;
 }
 
index 4a99609..d77fe62 100755 (executable)
@@ -2,9 +2,8 @@
 <head>
        <meta name="viewport" content="width=800, user-scalable=no">
        <link rel="stylesheet" href="./css/style.css" />
-       <script type="text/javascript" src="./js/jquery-1.6.4.min.js" defer="defer"></script>
-       <script type="text/javascript" src="./js/jquery.mobile-1.0.min.js" defer="defer"></script>
-       <script type="text/javascript" src="./js/main.js" defer="defer"></script>
+       <script src="/usr/share/tizen-web-ui-fw/latest/js/jquery.min.js"></script>
+       <script type="text/javascript" src="./js/main.js"></script>
 </head>
 
 <body ondragstart="return false" onselectstart="return false">
index 99dc081..3d9b7ba 100644 (file)
@@ -25,6 +25,7 @@ function Piano() {
        "use strict";
        Piano.prototype = {
                touchPianoKey: [],
+               lockIds: {},
                audio: []
        };
 
@@ -40,6 +41,12 @@ function Piano() {
                        tizen.application.getCurrentApplication().exit();
                });
 
+               document.addEventListener('tizenhwkey', function(e) {
+                       if (e.keyName === "back") {
+                               tizen.application.getCurrentApplication().exit();
+                       }
+               });
+
                $('#back').bind('touchend', function (event) {
                        $(this).removeClass('active');
                });
@@ -54,26 +61,36 @@ function Piano() {
                        if (element) {
                                if (this.touchPianoKey[touch.identifier] !== element.id) {
                                        $('#' + this.touchPianoKey[touch.identifier]).removeClass('pressed');
-                                       this.playAudioByElement(element, touch.identifier);
+                                       this.playAudioByElement(element, touch.identifier, function () {
+                                               this.lockIds[element.id] = true;
+                                       });
                                }
                        }
                }
        };
 
        Piano.prototype.onPianoKeyTouchUp = function onPianoKeyTouchUp(data) {
-               var i, touchId, len;
+               var i, touchId, len, buttonId;
                for (i = 0, len = data.originalEvent.changedTouches.length; i < len; i += 1) {
                        touchId = data.originalEvent.changedTouches[i].identifier;
-                       $('#' + this.touchPianoKey[touchId]).removeClass('pressed');
+                       buttonId = this.touchPianoKey[touchId];
+                       setTimeout(function () {
+                               (function (id) {
+                                       $('#' + id).removeClass('pressed');
+                               })(buttonId);
+                       }, 100);
                        this.touchPianoKey[touchId] = undefined;
                }
        };
 
        Piano.prototype.audioInit = function audioInit() {
-               var i;
+               var i, self = this;
                for (i = 0; i <= 13; i += 1) {
                        this.audio[i] = document.createElement('audio');
                        this.audio[i].name = i;
+                       this.audio[i].addEventListener("playing", function(){
+                               self.lockIds["play" + this.name] = false;
+                       });
                }
        };
 
@@ -82,8 +99,8 @@ function Piano() {
         * @param {Object} element
         * @param {Number} touchId
         */
-       Piano.prototype.playAudioByElement = function playAudioByElement(element, touchId) {
-               var nrAudio = parseInt(element.id.replace(/[a-zA-Z]*/, ''), 10);
+       Piano.prototype.playAudioByElement = function playAudioByElement(element, touchId, callback) {
+               var nrAudio = parseInt(element.id.substr(4), 10);
                $(element).addClass('pressed');
                this.touchPianoKey[touchId] = element.id;
                if (this.audio[nrAudio]) {
@@ -94,6 +111,9 @@ function Piano() {
                                this.audio[nrAudio].src = this.audio[nrAudio].name + ".wav";
                        }
                        this.audio[nrAudio].play();
+                       if (callback instanceof Function) {
+                               callback.call(this);
+                       }
                }
        };