[Go]update Go(tizen_2.1) tizen_2.1 2.1b_release
authorgs86.lee <gs86.lee@samsung.com>
Tue, 23 Apr 2013 08:47:59 +0000 (17:47 +0900)
committergs86.lee <gs86.lee@samsung.com>
Tue, 23 Apr 2013 09:59:17 +0000 (18:59 +0900)
Change-Id: I04248d049cd143340517cd892bb915d4aad0763f

LICENSE.APLv2.0 [deleted file]
NOTICE.APLv2.0 [deleted file]
README.txt
_locales/en/messages.json
_locales/zh_CN/messages.json
config.xml
css/go.css
css/i18n.css [new file with mode: 0755]
index.html
js/go.js
signature1.xml [changed mode: 0644->0755]

diff --git a/LICENSE.APLv2.0 b/LICENSE.APLv2.0
deleted file mode 100755 (executable)
index c720c61..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!) The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-
diff --git a/NOTICE.APLv2.0 b/NOTICE.APLv2.0
deleted file mode 100755 (executable)
index 79aca6c..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-Copyright (c) 2012, Intel Corporation.
-
-This program is licensed under the terms and conditions of the Apache License, version 2.0.
-The full text of the Apache License is at http://www.apache.org/licenses/LICENSE-2.0
index 5b5de87..6ad7318 100755 (executable)
@@ -58,11 +58,3 @@ all images are created by Intel Corp.
 they are licensed under the Creative Commons Attribution 3.0 license
 http://creativecommons.org/licenses/by/3.0/us/
 
-LIBRARIES
------------------------------------------------------------------------------
-
-jQuery JavaScript Library v1.7.1
-Copyright 2011, John Resig
-Dual licensed under the MIT or GPL Version 2 licenses.
-http://jquery.org/license
-
index 740f8ee..1dede28 100755 (executable)
@@ -3,6 +3,7 @@
         "message": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
         "description": "Single concatination of all alphabet characters, no spaces"
     },
+    "locale": {"message": "en"},
     "name": {"message": "Go"},
     "description": {"message": "A Go game"},
        "player": {"message": "Player"},
index 12ca502..e1b246f 100755 (executable)
@@ -3,6 +3,7 @@
         "message": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
         "description": "除去空格之外的所有字符集合"
     },
+    "locale": {"message": "zh_CN"},
     "name": {"message": "围棋"},
     "description": {"message": "一个围棋游戏"},
        "player": {"message": "选手"},
index 3f16c80..1f27e06 100755 (executable)
@@ -4,5 +4,5 @@
        <content src="index.html"/>
        <name>Go</name>
        <tizen:application id="SM31mV8fq9.Go" package="SM31mV8fq9" required_version="2.1"/>
-       <tizen:setting screen-orientation="landscape" contextmenu="enable" />
+       <tizen:setting screen-orientation="landscape" context-menu="disable" background-support="enable" encryption="disable" install-location="auto"/>
 </widget>
index b9d4841..9460cb5 100755 (executable)
@@ -17,8 +17,7 @@ a{
 
 @font-face{
        font-family: default_font;
-       src: url('../fonts/Yesteryear-Regular.ttf'),
-            url('../fonts/wqy-microhei.ttc');
+       src: url('../fonts/Yesteryear-Regular.ttf');
 }
 
 @font-face{
@@ -567,6 +566,80 @@ body {
        text-align:center;
 }
 
+#licensebtnl {
+    position: absolute;
+    width: 20px;
+    height: 20px;
+    text-align: center;
+    line-height: 20px;
+    cursor: pointer;
+    -webkit-border-radius: 20px;
+    border: solid 1px #000000;
+    opacity: 0.3;
+    color: black;
+}
+
+#licensebtnl:hover {
+    opacity: 1.0;
+}
+
+#licensepage {
+    width: 100%;
+    height: 100%;
+    background: -webkit-gradient(linear, left top, right top, from(#d99f55), to(#9c7448));
+}
+
+#licensetext {
+    width: 99.8%;
+    height: 89%;
+    background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #FFFFFF), color-stop(1, #d99f55));
+    -webkit-border-radius: 12px;
+    border-radius: 12px;
+    box-shadow: inset 1px 1px 2px 1px black;
+    margin-bottom: 2px;
+    padding-left: 10px;
+    padding-bottom: 10px;
+    overflow: hidden;
+    cursor: move;
+}
+
+#licensescroll {
+    position: relative;
+    font: 25px/100% Arial, Helvetica, sans-serif;
+    text-align: center;
+}
+
+.licensebtn {
+    position: absolute;
+    color: #d7d7d7;
+    border: solid 1px #333;
+    text-align: center;
+    text-decoration: none;
+    font: 30px/100% Arial, Helvetica, sans-serif;
+    text-shadow: 0 1px 1px rgba(0,0,0,.3);
+    -webkit-border-radius: 12px;
+    border-radius: 12px;
+    background: -webkit-gradient(linear, left top, left bottom, from(#666), to(#000));
+    height: 52px;
+    line-height: 48px;
+    cursor: pointer;
+    box-shadow: 2px 2px 14px #000;
+}
+
+.licensebtn:hover {
+    background: -webkit-gradient(linear, left top, left bottom, from(#444), to(#000));
+}
+
+.licensebtn:active {
+    color: #666;
+    background: -webkit-gradient(linear, left top, left bottom, from(#000), to(#444));
+}
+
+#licensebtnq {
+    left: 412px;
+    width: 200px;
+}
+
 ::-webkit-scrollbar {
     width: 12px;
 }
diff --git a/css/i18n.css b/css/i18n.css
new file mode 100755 (executable)
index 0000000..582474f
--- /dev/null
@@ -0,0 +1,6 @@
+@font-face{
+       font-family: default_font;
+       src: url('../fonts/JimNightshade-Regular.ttf'),
+            url('../fonts/wqy-microhei.ttc');
+}
+
index 0115936..20d2a17 100755 (executable)
     <title>Go</title>
     <meta name="author" content="Xinchao He">
        <link rel="stylesheet" href="css/go.css"/>
-        <link rel="stylesheet" type="text/css" href="css/license.css"></link>
-        <script src="js/license.js"></script>
-       <script type="text/javascript" src="lib/jquery-1.7.1.min.js"></script>
-       <script type="text/javascript" src="js/sound.js"></script>
-       <script type="text/javascript" src="js/go.js"></script>
   </head>
   <body onselectstart="return false" ondragstart="return false" style="overflow:hidden;">
-    <div id="licensepage" style="display: none">
-        <div id="licensetext"><div id="licensescroll"></div></div>
-        <div id="licensebtnq" class="licensebtn">Back</div>
-    </div>
+    <div id="licensepage" style="display: none"></div>
        <div id="theworld" class="world">
          <div class="left_pit"></div>
          <div class="right_pit"></div>
                  <span class="play_button_text text_shadow"></span>
                </div>
          </a>
-         <div class="setting_panel text_shadow display_none">
-               <a onClick="javascript:Go.toggleHelp();" class="setting_help">?</a>
-               <a onClick="javascript:Go.toggleSetting();" class="setting_exit">X</a>
-                <div id="licensebtnl" style="top: 490px; left: 405px;"> i </div>
-               <div class="setting_arrow" align="center">
-                 <span></span>
-                 <img class="setting_arrow_img" src="images/GO_SettingsArrow_010612_a.png" />
-               </div>
-               <div class="setting_sound">
-                 <span></span>
-                 <a onClick="javascript:Go.toggleSound();"><img class="setting_sound_check" src="images/GO_Checkbox_010612_a.png" /></a>
-               </div>
-               <div class="setting_timer">
-                 <span></span>
-                 <a onClick="javascript:Go.toggleTimer();"><img class="setting_timer_check" src="images/GO_Checkbox_010612_a.png" /></a>
-               </div>
-               <div class="setting_restart">
-                 <span></span>
-                 <a onClick="javascript:Go.toggleRestart();"><img class="setting_restart_check" src="images/GO_Checkbox_010612_a.png" /></a>
-               </div>
-               <div class="setting_quit">
-                 <span class="setting_quit_text"></span>
-                 <a onClick="javascript:Go.toggleQuit();"><img class="setting_quit_check" src="images/GO_Checkbox_010612_a.png" /></a>
-               </div>
-               <a onClick="javascript:Go.toggleSetting();" class="setting_resume setting_resume_inactive" align="center">
-               </a>
-         </div>
-         <div class="help_panel display_none">
-               <a onClick="javascript:Go.toggleHelp();" class="help_exit text_shadow">X</a>
-               <div class="help_title text_shadow" ></div>
-               <div class="help_text" >
-                 &nbsp;&nbsp;&nbsp;&nbsp;Take turns placing a stone on a vacant intersections (points) of the grid on a Go board. Black moves first.
-                 Once placed, a stone may not be moved, and can be removed only if captured. If a player believes he has no useful moves, he may skip his move (pass).<br>
-                 &nbsp;&nbsp;&nbsp;&nbsp;Vertically and horizontally adjacent stones of the same color form a chain (also called a string, or group) that shares liberties (adjacent, empty spaces) in common. These chains cannot
-                 be divided, and in effect becomes a single larger stone. Chains may be expanded by placing additional stones on adjacent points, and can be connected by
-                 placing a stone on a points adjacent to two or more chains of the same color.<br>
-                 &nbsp;&nbsp;&nbsp;&nbsp;A chain of stones must have at least one liberty to remain
-                 on the board. When a chain is surrounded by opposing stones so that it has no liberties, it is captured and removed from the board.<br>
-                 &nbsp;&nbsp;&nbsp;&nbsp;The game ends when both players have passed
-                 (clicked Skip) consecutively. The player who scores more points (the number of empty points, or intersections, surrounded by their pieces, plus the number of stones they've captured) wins.<br>
-               </div>
-         </div>
-         <div class="win_panel text_shadow display_none">
-               <a onClick="javascript:Go.disable('.win_panel');" class="win_exit">X</a>
-               <div class="win_arrow" align="center">
-                 <span style="font-size:55pt;"><span name="player"></span><span id="win_player"></span></span><br>
-                 <span style="font-size:70pt;" id="win_result"></span>
-                 <img class="win_arrow_img" src="images/GO_WinArrow_012012_a.png" />
-               </div>
-               <a onClick="javascript:Go.start();" class="replay">
-               </a>
-         </div>
+         <div class="setting_panel text_shadow display_none"></div>
+         <div class="help_panel display_none"></div>
+         <div class="win_panel text_shadow display_none"></div>
          <div class="board"></div>
        </div>
-       <audio id="dida" preload="auto">
-         <source src="sounds/ClockTicking_Loop.wav" />
-       </audio>
+       <script type="text/javascript" src="js/go.js"></script>
   </body>
 </html>
index c99acce..935084f 100755 (executable)
--- a/js/go.js
+++ b/js/go.js
  *
  */
 
+function queryObj(obj) {
+    this.q = obj;
+    this.isNull = this.q?false:true;
+    this.self = this;
+    this.html = function (val) {
+        this.q.innerHTML = val;
+        return this;
+    }
+
+    this.hasClass = function (c_name) {
+        if (this.isNull)
+            return false;
+        return this.q.classList.contains(c_name);
+    }
+
+    this.addClass = function (c_name) {
+        if (this.isNull)
+            return this;
+        var list = this.q.classList;
+        list.add (c_name);
+        return this;
+    }
+
+    this.removeClass = function (c_name) {
+        if (this.isNull)
+            return this;
+        var list = this.q.classList;
+        list.remove (c_name);
+        return this;
+    }
+
+    this.click = function (fun) {
+        if (this.isNull)
+            return this;
+        this.q.onclick = fun;
+        return this;
+    }
+
+    this.attr = function (attr, val) {
+        if (this.isNull)
+            return this;
+        this.q.setAttribute(attr, val);
+        return this;
+    }
+}
+
+function $(selector) {
+    var res;
+    if (typeof selector == "string") {
+        res = document.querySelector(selector);
+    } else {
+        res = selector;
+    }
+    return new queryObj(res);
+}
+
+function gamesound(src, loop) {
+    var me = this;
+    this.soundobj = new Audio(src);
+    this.soundobj.preload = 'auto';
+    this.enable = false;
+    this.infocus = true;
+    this.loop = (loop == undefined)?false:loop;
+    this.focus = function focus() {
+        if(!me.infocus)
+        {
+            me.infocus = true;
+            if(me.enable&&me.loop)
+                me.soundobj.play();
+        }
+    };
+    this.blur = function blur() {
+        if(me.infocus)
+        {
+            me.infocus = false;
+            if(me.enable&&me.loop)
+                me.soundobj.pause();
+        }
+    };
+    window.addEventListener('focus', me.focus, false);
+    window.addEventListener('blur', me.blur, false);
+
+    this.play = function play() {
+        this.enable = true;
+        if(this.infocus)
+            this.soundobj.play();
+    };
+    this.pause = function pause() {
+        this.enable = false;
+        this.soundobj.pause();
+    };
+}
+
 var Go = {
-       texture: {
-               'black':'images/GO_BlackPiece_010612_a.png',
-               'black1':'images/GO_BlackPiece_010612_b.png',
-               'black2':'images/GO_BlackPiece_010612_c.png',
-               'white':'images/GO_WhitePiece_010612_a-2.png',
-               'white1': 'images/GO_WhitePiece_010612_b.png',
-               'white2': 'images/GO_WhitePiece_010612_c.png',
-               'uncheck':'images/GO_Checkbox_010612_a.png',
-               'checked':'images/GO_CheckboxChecked_010612_a.png',
-               'board':'images/Go_Board.png',
-       },
-       bounder: 13,
-       boardview:'board',
-       board:[],
-       playButton:'play_button',
-       winMessage:'win_panel',
-       settingPanel:'setting_panel',
-       helpPanel:'help_panel',
-       place: [],
-       directs: [[1,0],[0,1],[0,-1],[-1,0],],
-       player:{},
-       manual:[],
-       isTimer: false,
-       isSound: false,
-       isSetting: false,
-       isStart: false,
-       isStop: false,
-       isPass: false,
-       isExit: false,
-       isRestart: false,
-       isEndMsg: false,
+    texture: {
+        'black':'images/GO_BlackPiece_010612_a.png',
+        'black1':'images/GO_BlackPiece_010612_b.png',
+        'black2':'images/GO_BlackPiece_010612_c.png',
+        'white':'images/GO_WhitePiece_010612_a-2.png',
+        'white1': 'images/GO_WhitePiece_010612_b.png',
+        'white2': 'images/GO_WhitePiece_010612_c.png',
+        'uncheck':'images/GO_Checkbox_010612_a.png',
+        'checked':'images/GO_CheckboxChecked_010612_a.png',
+        'board':'images/Go_Board.png',
+    },
+    bounder: 13,
+    boardview:'board',
+    board:[],
+    playButton:'play_button',
+    winMessage:'win_panel',
+    settingPanel:'setting_panel',
+    helpPanel:'help_panel',
+    place: [],
+    directs: [[1,0],[0,1],[0,-1],[-1,0],],
+    player:{},
+    manual:[],
+    isTimer: false,
+    isSound: false,
+    isSetting: false,
+    isStart: false,
+    isStop: false,
+    isPass: false,
+    isExit: false,
+    isRestart: false,
+    isEndMsg: false,
 };
 
 Go.init = function(){
-       var welcome = {
-               'black':[[1,3],[1,4],[2,2],[3,2],
-                                [4,2],[5,2],[5,4],[5,5],
-                                [6,2],[6,5],[7,2],[7,5],[8,3],
-                                [8,4],],
-
-               'white':[[1,8],[1,9],[2,7],[2,10],
-                                [3,7],[3,10],[4,7],[4,10],
-                                [5,7],[5,10],[6,7],[6,10],
-                                [7,7],[7,10],[8,8],[8,9],],
-       };
-       for (var i=0; i<this.bounder; i++){
-               var line=new Array();
-               for (var j=0; j<this.bounder; j++){
-                       line[j] = 'board';
-               }
-               this.board[i] = line;
-       }
-       for (var color in welcome){
-               var matrix = welcome[color];
-               for (var p in matrix) {
-                       this.board[matrix[p][0]][matrix[p][1]] = color;
-               }
-       }
-       this.drawBoard();
-       var soundSource = {
-               'end': 'sounds/GameEndChimes.wav',
-               'setStone': 'sounds/Pieces_SinglePlaced.wav',
-               'dropStone': 'sounds/PiecesFillPocket.wav',
-               'positive': 'sounds/PositiveSound.wav',
-               'settingbtn': 'sounds/SettingsButton.wav',
-               'settingck': 'sounds/SettingsButtonCheck.wav',
-               'settingon': 'sounds/SettingsAppearWoodSlide.wav',
-       };
-
-       this.sounds = {};
-       for (var snd in soundSource){
-               this.sounds[snd] = new Audio(soundSource[snd]);
-               //this.sounds[snd].load();
-       }
-       this.sounds['dida'] = new gamesound('dida');
-
-       this.disable('.'+this.winMessage);
-       this.enable('.'+this.playButton);
+    var welcome = {
+        'black':[[1,3],[1,4],[2,2],[3,2],
+                 [4,2],[5,2],[5,4],[5,5],
+                 [6,2],[6,5],[7,2],[7,5],[8,3],
+                 [8,4],],
+
+        'white':[[1,8],[1,9],[2,7],[2,10],
+                 [3,7],[3,10],[4,7],[4,10],
+                 [5,7],[5,10],[6,7],[6,10],
+                 [7,7],[7,10],[8,8],[8,9],],
+    };
+    for (var i=0; i<this.bounder; i++){
+        var line=new Array();
+        for (var j=0; j<this.bounder; j++){
+            line[j] = 'board';
+        }
+        this.board[i] = line;
+    }
+    for (var color in welcome){
+        var matrix = welcome[color];
+        for (var p in matrix) {
+            this.board[matrix[p][0]][matrix[p][1]] = color;
+        }
+    }
+    this.drawBoard();
+    this.soundSource = {
+        'end': 'sounds/GameEndChimes.wav',
+        'setStone': 'sounds/Pieces_SinglePlaced.wav',
+        'dropStone': 'sounds/PiecesFillPocket.wav',
+        'positive': 'sounds/PositiveSound.wav',
+        'settingbtn': 'sounds/SettingsButton.wav',
+        'settingck': 'sounds/SettingsButtonCheck.wav',
+        'settingon': 'sounds/SettingsAppearWoodSlide.wav',
+        'dida': 'sounds/ClockTicking_Loop.wav',
+    };
+
+    this.sounds = {};
+
+    this.disable('.'+this.winMessage);
+    this.enable('.'+this.playButton);
 
 }
 
 Go.start = function(){
-       for (var i=0; i<this.bounder; i++){
-               for (var j=0; j<this.bounder; j++){
-                       this.board[i][j] = 'board';
-               }
-       }
-       this.player['black'] = new player('black');
-       this.player['white'] = new player('white');
-       this.current = this.player['white'];
-       this.isStart = true;
-       this.isStop = false;
-       this.isPass = false;
-       this.isSetting =false;
-       this.isRestart = false;
-       this.isExit = false;
-       this.isEndMsg = true;
-       this.drawBoard();
-       this.drawMessage();
-       this.disable('.'+this.playButton);
-       this.disable('.'+this.winMessage);
-       this.disable('.'+this.settingPanel);
-       this.disable('.'+this.helpPanel);
-       this.playSound('settingbtn');
-       // this.startTimer();
-
-       $('.setting_restart img').attr('src', this.texture['uncheck'])
-               .removeClass('setting_restart_checked')
-               .addClass('setting_restart_check');
+    for (var i=0; i<this.bounder; i++){
+        for (var j=0; j<this.bounder; j++){
+            this.board[i][j] = 'board';
+        }
+    }
+    this.player['black'] = new player('black');
+    this.player['white'] = new player('white');
+    this.current = this.player['white'];
+    this.isStart = true;
+    this.isStop = false;
+    this.isPass = false;
+    this.isSetting =false;
+    this.isRestart = false;
+    this.isExit = false;
+    this.isEndMsg = true;
+    this.drawBoard();
+    this.drawMessage();
+    this.disable('.'+this.playButton);
+    this.disable('.'+this.winMessage);
+    this.disable('.'+this.settingPanel);
+    this.disable('.'+this.helpPanel);
+    this.playSound('settingbtn');
+    // this.startTimer();
+
+    $('.setting_restart img').attr('src', this.texture['uncheck'])
+        .removeClass('setting_restart_checked')
+        .addClass('setting_restart_check');
+}
+
+Go.getSoundSource = function(snd) {
+    var ret = this.sounds[snd];
+    if (typeof ret == 'undefined') {
+        var src = this.soundSource[snd];
+        if (snd == 'dida') {
+            ret = new gamesound(src);
+        } else {
+            ret = new Audio(src);
+        }
+        this.sounds[snd] = ret;
+    }
+    return ret;
 }
 
 Go.playSound = function(snd){
-       if (this.isSound) {
-               var audio = this.sounds[snd];
-               if (audio.paused == false) {
-                       audio.pause();
-                       audio.currentTime = 0;
-               }
-               audio.play();
-       }
+    if (this.isSound) {
+        var audio = this.getSoundSource(snd);
+        if (audio.paused == false) {
+            audio.pause();
+            audio.currentTime = 0;
+        }
+        audio.play();
+    }
 }
 
 Go.stop = function(){
-       this.isStart = false;
-       this.isStop = true;
-       this.stopTimer();
-       var blackScore = this.player['black'].getScore();
-       var whiteScore = this.player['white'].getScore();
-       if (blackScore > whiteScore){
-               $('#win_player').html(' '+getMessage('one', 'One'));
-               $('#win_result').html(getMessage('win', 'Wins'));
-       } else if (blackScore < whiteScore) {
-               $('#win_player').html(' '+getMessage('two', 'Two'));
-               $('#win_result').html(getMessage('win', 'Wins'));
-       } else {
-               $('#win_player').html('');
-               $('#win_result').html(getMessage('draw', 'Draw'));
-       }
-       if (this.isEndMsg) {
-               this.playSound('end');
-               this.enable('.'+this.winMessage);
-               this.isEndMsg = false;
-       }
+    this.isStart = false;
+    this.isStop = true;
+    this.stopTimer();
+    var blackScore = this.player['black'].getScore();
+    var whiteScore = this.player['white'].getScore();
+    this.initWinMessage();
+    if (blackScore > whiteScore){
+        $('#win_player').html(' '+getMessage('one', 'One'));
+        $('#win_result').html(getMessage('win', 'Wins'));
+    } else if (blackScore < whiteScore) {
+        $('#win_player').html(' '+getMessage('two', 'Two'));
+        $('#win_result').html(getMessage('win', 'Wins'));
+    } else {
+        $('#win_player').html('');
+        $('#win_result').html(getMessage('draw', 'Draw'));
+    }
+    if (this.isEndMsg) {
+        this.playSound('end');
+        this.enable('.'+this.winMessage);
+        this.isEndMsg = false;
+    }
+}
+
+Go.initWinMessage = function() {
+    if (!this.hasWinMessage) {
+        var winmsg = $('.'+this.winMessage);
+        winmsg.html('<a onClick="javascript:Go.disable('+"'.win_panel');"+'" class="win_exit">X</a> <div class="win_arrow" align="center"> <span style="font-size:55pt;"><span name="player"></span><span id="win_player"></span></span><br> <span style="font-size:70pt;" id="win_result"></span> <img class="win_arrow_img" src="images/GO_WinArrow_012012_a.png" /> </div> <a onClick="javascript:Go.start();" class="replay"> </a>');
+        $('.replay').html(getMessage('newGame', 'New Game'));
+        $('span[name="player"]').html(getMessage('player', 'Player'));
+        this.hasWinMessage = true;
+    }
+
 }
 
 Go.exit = function(){
-       if (this.isExit) {
-               window.close();
-       }
+    if (this.isExit) {
+        window.close();
+    }
 }
 
 Go.restart = function(){
-       if (this.isRestart){
-               if (this.isEndMsg) {
-                       this.stop();
-               } else {
-                       this.start();
-               }
-       }
+    if (this.isRestart){
+        if (this.isEndMsg) {
+            this.stop();
+        } else {
+            this.start();
+        }
+    }
 }
 
 Go.startTimer = function(){
-       if (this.isTimer && this.isStart) {
-               this.timer = setTimeout('Go.startTimer()',1000);
-               this.current.timeDida();
-               // var audio = this.sounds['dida'];
-               // if (audio.paused) {
-               //      this.playSound('dida');
-               // }
-               this.playSound('dida');
-               if (this.current.restTime <= 0) {
-                       this.stop();
-               } else if (this.current.restTime == 5) {
-                       this.playSound('positive');
-               }
-       }
+    if (this.isTimer && this.isStart) {
+        this.timer = setTimeout('Go.startTimer()',1000);
+        this.current.timeDida();
+        this.playSound('dida');
+        if (this.current.restTime <= 0) {
+            this.stop();
+        } else if (this.current.restTime == 5) {
+            this.playSound('positive');
+        }
+    }
 }
 
 Go.stopTimer = function(){
-       if (this.isTimer) {
-               clearTimeout(this.timer);
-               // this.sounds['dida'].pause();
-       }
+    if (this.isTimer) {
+        clearTimeout(this.timer);
+        // this.sounds['dida'].pause();
+    }
 }
 
 Go.disable = function(which) {
-       $(which).addClass('display_none');
+    $(which).addClass('display_none');
 }
 
 Go.enable = function(which) {
-       $(which).removeClass('display_none');
+    $(which).removeClass('display_none');
 }
 
 Go.toggleSetting = function(){
-       if ($('.'+this.winMessage).hasClass('display_none')) {
-               if (this.isSetting){
-                       this.exitSetting();
-               } else {
-                       this.showSetting();
-               }
-               this.playSound('settingbtn');
-       }
+    if ($('.'+this.winMessage).hasClass('display_none')) {
+        if (this.isSetting){
+            this.exitSetting();
+        } else {
+            this.showSetting();
+        }
+        this.playSound('settingbtn');
+    }
+}
+
+Go.initSettingPanel = function() {
+    if (!this.hasSettingPanel) {
+        var panel = $('.setting_panel');
+        panel.html('<a onClick="javascript:Go.toggleHelp();" class="setting_help">?</a> <a onClick="javascript:Go.toggleSetting();" class="setting_exit">X</a> <div id="licensebtnl" style="top: 490px; left: 405px;"> i </div> <div class="setting_arrow" align="center"> <span></span> <img class="setting_arrow_img" src="images/GO_SettingsArrow_010612_a.png" /> </div> <div class="setting_sound"> <span></span> <a onClick="javascript:Go.toggleSound();"><img class="setting_sound_check" src="images/GO_Checkbox_010612_a.png" /></a> </div> <div class="setting_timer"> <span></span> <a onClick="javascript:Go.toggleTimer();"><img class="setting_timer_check" src="images/GO_Checkbox_010612_a.png" /></a> </div> <div class="setting_restart"> <span></span> <a onClick="javascript:Go.toggleRestart();"><img class="setting_restart_check" src="images/GO_Checkbox_010612_a.png" /></a> </div> <div class="setting_quit"> <span class="setting_quit_text"></span> <a onClick="javascript:Go.toggleQuit();"><img class="setting_quit_check" src="images/GO_Checkbox_010612_a.png" /></a> </div> <a onClick="javascript:Go.toggleSetting();" class="setting_resume setting_resume_inactive" align="center"> </a>');
+        $('.setting_arrow span').html(getMessage('settings', 'Settings'));
+        $('.setting_sound span').html(getMessage('sound_setting', 'Sound FX....'));
+        $('.setting_timer span').html(getMessage('timer_setting', 'Timer...........'));
+        $('.setting_restart span').html(getMessage('restart', 'Restart'));
+        $('.setting_quit span').html(getMessage('quit', 'Quit'));
+        $('.setting_resume').html(getMessage('resume', 'Submit'));
+        $('#licensebtnl').click(function(){
+            Go.showLicense("license", "theworld");
+        });
+
+        this.hasSettingPanel = true;
+    }
 }
 
 Go.showSetting = function(){
-       this.enable('.setting_panel');
-       setTimeout("$('.setting_panel').addClass('setting_panel_in')", 100);
-       this.isSetting = true;
-       this.stopTimer();
-       this.playSound('settingon');
+    this.initSettingPanel();
+    this.enable('.setting_panel');
+    setTimeout("$('.setting_panel').addClass('setting_panel_in')", 100);
+    this.isSetting = true;
+    this.stopTimer();
+    this.playSound('settingon');
 }
 
 Go.exitSetting = function(){
-       this.disable('.setting_panel');
-       $('.'+this.helpPanel).addClass('display_none');
-       $('.setting_panel').removeClass('setting_panel_in');
-       this.isSetting = false;
-       this.exit();
-       this.restart();
-       this.startTimer();
+    this.disable('.setting_panel');
+    $('.'+this.helpPanel).addClass('display_none');
+    $('.setting_panel').removeClass('setting_panel_in');
+    this.isSetting = false;
+    this.exit();
+    this.restart();
+    this.startTimer();
 }
 
 Go.toggleSound = function(){
-       var img = $('.setting_sound img');
-       if (this.isSound) {
-               img.attr('src', this.texture['uncheck']);
-               img.removeClass('setting_sound_checked');
-               img.addClass('setting_sound_check');
-               this.isSound = false;
-       } else {
-               img.attr('src', this.texture['checked']);
-               img.addClass('setting_sound_checked');
-               img.removeClass('setting_sound_check');
-               this.isSound = true;
-       }
-       this.playSound('settingck');
+    var img = $('.setting_sound img');
+    if (this.isSound) {
+        img.attr('src', this.texture['uncheck']);
+        img.removeClass('setting_sound_checked');
+        img.addClass('setting_sound_check');
+        this.isSound = false;
+    } else {
+        img.attr('src', this.texture['checked']);
+        img.addClass('setting_sound_checked');
+        img.removeClass('setting_sound_check');
+        this.isSound = true;
+    }
+    this.playSound('settingck');
 }
 
 Go.toggleTimer = function(){
-       var img = $('.setting_timer img');
-       if (this.isTimer) {
-               img.attr('src', this.texture['uncheck']);
-               img.removeClass('setting_timer_checked');
-               img.addClass('setting_timer_check');
-               this.isTimer = false;
-       } else {
-               img.attr('src', this.texture['checked']);
-               img.addClass('setting_timer_checked');
-               img.removeClass('setting_timer_check');
-               this.isTimer = true;
-       }
-       this.playSound('settingck');
+    var img = $('.setting_timer img');
+    if (this.isTimer) {
+        img.attr('src', this.texture['uncheck']);
+        img.removeClass('setting_timer_checked');
+        img.addClass('setting_timer_check');
+        this.isTimer = false;
+    } else {
+        img.attr('src', this.texture['checked']);
+        img.addClass('setting_timer_checked');
+        img.removeClass('setting_timer_check');
+        this.isTimer = true;
+    }
+    this.playSound('settingck');
 }
 
 Go.toggleRestart = function(){
-       if (this.isStart || this.isStop) {
-               var conflict = false;
-               var img = $('.setting_restart img');
-               if (this.isRestart) {
-                       img.attr('src', this.texture['uncheck']);
-                       img.removeClass('setting_restart_checked');
-                       img.addClass('setting_restart_check');
-                       this.isRestart = false;
-               } else {
-                       img.attr('src', this.texture['checked']);
-                       img.addClass('setting_restart_checked');
-                       img.removeClass('setting_restart_check');
-                       this.isRestart = true;
-                       if (this.isExit)
-                               conflict = true;
-               }
-               if (conflict) {
-                       this.toggleQuit();
-               } else {
-                       this.playSound('settingck');
-               }
-       }
+    if (this.isStart || this.isStop) {
+        var conflict = false;
+        var img = $('.setting_restart img');
+        if (this.isRestart) {
+            img.attr('src', this.texture['uncheck']);
+            img.removeClass('setting_restart_checked');
+            img.addClass('setting_restart_check');
+            this.isRestart = false;
+        } else {
+            img.attr('src', this.texture['checked']);
+            img.addClass('setting_restart_checked');
+            img.removeClass('setting_restart_check');
+            this.isRestart = true;
+            if (this.isExit)
+                conflict = true;
+        }
+        if (conflict) {
+            this.toggleQuit();
+        } else {
+            this.playSound('settingck');
+        }
+    }
 }
 
 Go.toggleQuit = function(){
-       var img = $('.setting_quit img');
-       var conflict = false;
-       if (this.isExit) {
-               img.attr('src', this.texture['uncheck']);
-               img.removeClass('setting_quit_checked');
-               img.addClass('setting_quit_check');
-               this.isExit = false;
-       } else {
-               img.attr('src', this.texture['checked']);
-               img.addClass('setting_quit_checked');
-               img.removeClass('setting_quit_check');
-               this.isExit = true;
-               if (this.isRestart)
-                       conflict = true;
-       }
-       if (conflict) {
-               this.toggleRestart();
-       } else {
-               this.playSound('settingck');
-       }
+    var img = $('.setting_quit img');
+    var conflict = false;
+    if (this.isExit) {
+        img.attr('src', this.texture['uncheck']);
+        img.removeClass('setting_quit_checked');
+        img.addClass('setting_quit_check');
+        this.isExit = false;
+    } else {
+        img.attr('src', this.texture['checked']);
+        img.addClass('setting_quit_checked');
+        img.removeClass('setting_quit_check');
+        this.isExit = true;
+        if (this.isRestart)
+            conflict = true;
+    }
+    if (conflict) {
+        this.toggleRestart();
+    } else {
+        this.playSound('settingck');
+    }
 }
 
 Go.toggleHelp = function() {
-       $('.'+this.helpPanel).toggleClass('display_none');
+    var help = $('.'+this.helpPanel);
+    if (!this.hasHelp) {
+        help.html('<a onClick="javascript:Go.toggleHelp();" class="help_exit text_shadow">X</a> <div class="help_title text_shadow" ></div> <div class="help_text" > &nbsp;&nbsp;&nbsp;&nbsp;Take turns placing a stone on a vacant intersections (points) of the grid on a Go board. Black moves first. Once placed, a stone may not be moved, and can be removed only if captured. If a player believes he has no useful moves, he may skip his move (pass).<br> &nbsp;&nbsp;&nbsp;&nbsp;Vertically and horizontally adjacent stones of the same color form a chain (also called a string, or group) that shares liberties (adjacent, empty spaces) in common. These chains cannot be divided, and in effect becomes a single larger stone. Chains may be expanded by placing additional stones on adjacent points, and can be connected by placing a stone on a points adjacent to two or more chains of the same color.<br> &nbsp;&nbsp;&nbsp;&nbsp;A chain of stones must have at least one liberty to remain on the board. When a chain is surrounded by opposing stones so that it has no liberties, it is captured and removed from the board.<br> &nbsp;&nbsp;&nbsp;&nbsp;The game ends when both players have passed (clicked Skip) consecutively. The player who scores more points (the number of empty points, or intersections, surrounded by their pieces, plus the number of stones they'+"'" + 've captured) wins.<br> &nbsp;&nbsp;&nbsp;&nbsp;For more information on how to play Go, see the Wikipedia article on the game: <span><a style="opacity: 0.6; color: #0000FF" href="http://en.wikipedia.org/wiki/Go_(game)">http://en.wikipedia.org/wiki/Go_(game)</a></span>. </div>');
+        $('.help_title').html(getMessage('rules', 'Rules'));
+        var help_text = getMessage('help');
+        if (help_text.length > 0) {
+            $('.help_text').html(help_text);
+        }
+        this.hasHelp = true;
+    }
+    if (help.hasClass('display_none')) {
+        help.removeClass('display_none');
+    } else {
+        help.addClass('display_none');
+    }
+    //$('.'+this.helpPanel).toggleClass('display_none');
 }
 
 Go.drawBoard = function(){
-       var str = '';
-       var style=['margin:1px 0px 9px 0px;','margin:0px 10px 9px 0px;','margin:0px 9px 10px 0px;'];
-       for (var i=0; i<this.bounder; i++){
-               var margin=style[2];
-               if (i<6) margin = style[0];
-               str += '<div style="width:595px;height:36px;'+margin+'">';
-           for (var j=0; j<this.bounder; j++){
-                       margin = style[2];
-                       if (j<6) margin = style[1];
-                       if (i>8) margin += 'position:relative;top:-5px;';
-                       str += '<span style="float:left;width:36px;height:36px;'+margin
-                               +'"><a onClick="javascript:Go.click('+i+','+j+');" class="img_style" ><img src="'
-                               +this.texture[this.board[i][j]]+'" id="a'+i+j+'" class="board_img" /></a></span>';
-           }
-               str += '</div>';
-       }
-       $('.'+this.boardview).html(str);
+    var str = '';
+    var style=['margin:1px 0px 9px 0px;','margin:0px 10px 9px 0px;','margin:0px 9px 10px 0px;'];
+    for (var i=0; i<this.bounder; i++){
+        var margin=style[2];
+        if (i<6) margin = style[0];
+        str += '<div style="width:595px;height:36px;'+margin+'">';
+        for (var j=0; j<this.bounder; j++){
+            margin = style[2];
+            if (j<6) margin = style[1];
+            if (i>8) margin += 'position:relative;top:-5px;';
+            str += '<span style="float:left;width:36px;height:36px;'+margin
+                +'"><a onClick="javascript:Go.click('+i+','+j+');" class="img_style" ><img src="'
+                +this.texture[this.board[i][j]]+'" id="a'+i+j+'" class="board_img" /></a></span>';
+        }
+        str += '</div>';
+    }
+    $('.'+this.boardview).html(str);
 }
 
 Go.click = function(i, j){
-       if (this.board[i][j]==='board' && !this.isSetting && this.isStart) {
-               var revColor = (this.current.color=='black'?'white':'black');
-               var p = this.player[revColor];
-
-               this.board[i][j] = this.current.color;
-               var takes = this.getTake([i, j]);
-               if (takes.length == 1 && p.takes.length == 1
-                       && p.takes[0][0] == i && p.takes[0][1] == j
-                       && takes[0][0] == p.place[0] && takes[0][1] == p.place[1]) {
-                       //Can't do mirror go
-                       this.board[i][j] = 'board';
-                       return;
-               }
-               for (var n in takes) {
-                       this.board[takes[n][0]][takes[n][1]] = 'board';
-                       p.dropStone();
-                       p.score--;
-               }
-               if (takes.length == 0 && this.isContained(i, j, this.current.color)) {
-                       this.board[i][j] = 'board';
-               } else {
-                       var status = {'color':this.current.color,};
-                       this.playSound('setStone');
-                       if (takes.length > 0)
-                               this.playSound('dropStone');
-                       status.setPlace = [i, j];
-                       status.place = this.place;
-                       this.place = [i, j];
-                       this.current.score++;
-                       status.userPlace = this.current.place;
-                       this.current.place = this.place;
-                       this.current.takes = takes;
-                       status.takes = takes;
-                       this.current.pickStone();
-                       status.isPass = this.isPass;
-                       this.isPass = false;
-
-                       // Get Liberty
-                       var liberty = this.getLiberty();
-                       status.liberty = {};
-                       status.liberty['black'] = this.player['black'].liberty;
-                       status.liberty['white'] = this.player['white'].liberty;
-                       this.player['black'].liberty = liberty['black'];
-                       this.player['white'].liberty = liberty['white'];
-
-                       status.restTime = {};
-                       status.restTime['black'] = this.player['black'].restTime;
-                       status.restTime['white'] = this.player['white'].restTime;
-                       this.manual.push(status);
-                       this.drawBoard();
-                       this.drawMessage();
-               }
-       }
+    if (this.board[i][j]==='board' && !this.isSetting && this.isStart) {
+        var revColor = (this.current.color=='black'?'white':'black');
+        var p = this.player[revColor];
+
+        this.board[i][j] = this.current.color;
+        var takes = this.getTake([i, j]);
+        if (takes.length == 1 && p.takes.length == 1
+            && p.takes[0][0] == i && p.takes[0][1] == j
+            && takes[0][0] == p.place[0] && takes[0][1] == p.place[1]) {
+            //Can't do mirror go
+            this.board[i][j] = 'board';
+            return;
+        }
+        for (var n in takes) {
+            this.board[takes[n][0]][takes[n][1]] = 'board';
+            p.dropStone();
+            p.score--;
+        }
+        if (takes.length == 0 && this.isContained(i, j, this.current.color)) {
+            this.board[i][j] = 'board';
+        } else {
+            var status = {'color':this.current.color,};
+            this.playSound('setStone');
+            if (takes.length > 0)
+                this.playSound('dropStone');
+            status.setPlace = [i, j];
+            status.place = this.place;
+            this.place = [i, j];
+            this.current.score++;
+            status.userPlace = this.current.place;
+            this.current.place = this.place;
+            this.current.takes = takes;
+            status.takes = takes;
+            this.current.pickStone();
+            status.isPass = this.isPass;
+            this.isPass = false;
+
+            // Get Liberty
+            var liberty = this.getLiberty();
+            status.liberty = {};
+            status.liberty['black'] = this.player['black'].liberty;
+            status.liberty['white'] = this.player['white'].liberty;
+            this.player['black'].liberty = liberty['black'];
+            this.player['white'].liberty = liberty['white'];
+
+            status.restTime = {};
+            status.restTime['black'] = this.player['black'].restTime;
+            status.restTime['white'] = this.player['white'].restTime;
+            this.manual.push(status);
+            this.drawBoard();
+            this.drawMessage();
+        }
+    }
 }
 
 Go.undue = function(color_) {
-       if (!this.isSetting && this.isStart && color_ != this.current.color) {
-               var status = this.manual.pop();
-               if (status) {
-                       var color = status.color;
-                       var revColor = (color == 'black'?'white':'black');
-                       var player = this.player[color];
-                       if (status.setPlace.length > 0) {
-                               this.place = status.place;
-                               player.dropStone();
-                               player.score--;
-                               this.board[status.setPlace[0]][status.setPlace[1]] = 'board';
-                               for (var p in status.takes) {
-                                       var take = status.takes[p];
-                                       this.player[revColor].pickStone();
-                                       this.board[take[0]][take[1]] = revColor;
-                                       this.player[revColor].score++;
-                               }
-                               if (status.liberty) {
-                                       var liberty = status.liberty;
-                                       this.player['black'].liberty = liberty['black'];
-                                       this.player['white'].liberty = liberty['white'];
-                               } else {
-                                       this.player['black'].liberty = [];
-                                       this.player['white'].liberty = [];
-                               }
-                               player.place = status.userPlace;
-                               this.drawBoard();
-                       }
-                       this.isPass = status.isPass;
-                       // Reset the timer
-                       // this.player['black'].restTime = status.restTime['black'];
-                       // this.player['white'].restTime = status.restTime['white'];
-                       this.drawMessage();
-               }
-       }
+    if (!this.isSetting && this.isStart && color_ != this.current.color) {
+        var status = this.manual.pop();
+        if (status) {
+            var color = status.color;
+            var revColor = (color == 'black'?'white':'black');
+            var player = this.player[color];
+            if (status.setPlace.length > 0) {
+                this.place = status.place;
+                player.dropStone();
+                player.score--;
+                this.board[status.setPlace[0]][status.setPlace[1]] = 'board';
+                for (var p in status.takes) {
+                    var take = status.takes[p];
+                    this.player[revColor].pickStone();
+                    this.board[take[0]][take[1]] = revColor;
+                    this.player[revColor].score++;
+                }
+                if (status.liberty) {
+                    var liberty = status.liberty;
+                    this.player['black'].liberty = liberty['black'];
+                    this.player['white'].liberty = liberty['white'];
+                } else {
+                    this.player['black'].liberty = [];
+                    this.player['white'].liberty = [];
+                }
+                player.place = status.userPlace;
+                this.drawBoard();
+            }
+            this.isPass = status.isPass;
+            // Reset the timer
+            // this.player['black'].restTime = status.restTime['black'];
+            // this.player['white'].restTime = status.restTime['white'];
+            this.drawMessage();
+        }
+    }
 }
 
 Go.getTake = function(place_) {
-       var p = place_ || this.place;
-       var checkColor = (this.current.color=='black'?'white':'black');
-       var takes = [];
-       for (var d in this.directs) {
-               var i = parseInt(p[0])+parseInt(this.directs[d][0]);
-               var j = parseInt(p[1])+parseInt(this.directs[d][1]);
-               if (i>=0 && j>= 0 && i<this.bounder && j<this.bounder
-                       && this.board[i][j] === checkColor) {
-                       var t = [];
-                       if (this.isContained(i, j, checkColor, t)) {
-                               for (var n in t){
-                                       if (!this.isContain(t[n], takes)) {
-                                               takes.push(t[n]);
-                                       }
-                               }
-                       }
-               }
-       }
-       //console.log(takes);
-       return takes;
+    var p = place_ || this.place;
+    var checkColor = (this.current.color=='black'?'white':'black');
+    var takes = [];
+    for (var d in this.directs) {
+        var i = parseInt(p[0])+parseInt(this.directs[d][0]);
+        var j = parseInt(p[1])+parseInt(this.directs[d][1]);
+        if (i>=0 && j>= 0 && i<this.bounder && j<this.bounder
+            && this.board[i][j] === checkColor) {
+            var t = [];
+            if (this.isContained(i, j, checkColor, t)) {
+                for (var n in t){
+                    if (!this.isContain(t[n], takes)) {
+                        takes.push(t[n]);
+                    }
+                }
+            }
+        }
+    }
+    //console.log(takes);
+    return takes;
 }
 
 Go.isContained = function(i_, j_, color_, contains_, except_) {
-       var color = color_ || (this.current.color == 'black'?'white':'black');
-       var except = except_ || [];
-       var contains = contains_ || [];
-       var ret = true;
-       except.push([parseInt(i_),parseInt(j_)]);
-
-       for (var d in this.directs) {
-               if (!ret)
-                       break;
-               var i = parseInt(i_)+parseInt(this.directs[d][0]);
-               var j = parseInt(j_)+parseInt(this.directs[d][1]);
-               if ( i>=0 && j>= 0 && i<this.bounder && j<this.bounder
-                       && !this.isContain([i,j], except)) {
-                       if (this.board[i][j] == 'board') {
-                               ret = false;
-                       } else if (this.board[i][j] == color) {
-                               if (!this.isContained(i, j, color, contains, except)) {
-                                       ret = false;
-                               }
-                       }
-               }
-       }
-       if (ret)
-               contains.push([i_, j_]);
-       return ret;
+    var color = color_ || (this.current.color == 'black'?'white':'black');
+    var except = except_ || [];
+    var contains = contains_ || [];
+    var ret = true;
+    except.push([parseInt(i_),parseInt(j_)]);
+
+    for (var d in this.directs) {
+        if (!ret)
+            break;
+        var i = parseInt(i_)+parseInt(this.directs[d][0]);
+        var j = parseInt(j_)+parseInt(this.directs[d][1]);
+        if ( i>=0 && j>= 0 && i<this.bounder && j<this.bounder
+            && !this.isContain([i,j], except)) {
+            if (this.board[i][j] == 'board') {
+                ret = false;
+            } else if (this.board[i][j] == color) {
+                if (!this.isContained(i, j, color, contains, except)) {
+                    ret = false;
+                }
+            }
+        }
+    }
+    if (ret)
+        contains.push([i_, j_]);
+    return ret;
 }
 
 Go.getLiberty = function(){
-       var except = [];
-       var contain = {
-               'black':[],
-               'white':[],
-       };
-       for (var i=0; i<this.bounder; i++){
-               for (var j=0; j<this.bounder; j++){
-                       if (this.board[i][j] == 'board' && !this.isContain([i,j], except)) {
-                               var except_ = [];
-                               var liberty = this.countLiberty(i,j,except_);
-                               if (!liberty.hasOwnProperty('none')) {
-                                       var color = 'none';
-                                       if (liberty.hasOwnProperty('black')) {
-                                               color = 'black';
-                                       } else if (liberty.hasOwnProperty('white')) {
-                                               color = 'white';
-                                       }
-                                       if (color != 'none') {
-                                               var needpush = liberty[color];
-                                               for (var n in needpush){
-                                                       if (!this.isContain(needpush[n], contain[color])) {
-                                                               contain[color].push(needpush[n]);
-                                                       }
-                                               }
-                                       }
-                               }
-                               for (var n in except_) {
-                                       if (!this.isContain(except_[n], except)) {
-                                               except.push(except_[n]);
-                                       }
-                               }
-                       }
-               }
-       }
+    var except = [];
+    var contain = {
+        'black':[],
+        'white':[],
+    };
+    for (var i=0; i<this.bounder; i++){
+        for (var j=0; j<this.bounder; j++){
+            if (this.board[i][j] == 'board' && !this.isContain([i,j], except)) {
+                var except_ = [];
+                var liberty = this.countLiberty(i,j,except_);
+                if (!liberty.hasOwnProperty('none')) {
+                    var color = 'none';
+                    if (liberty.hasOwnProperty('black')) {
+                        color = 'black';
+                    } else if (liberty.hasOwnProperty('white')) {
+                        color = 'white';
+                    }
+                    if (color != 'none') {
+                        var needpush = liberty[color];
+                        for (var n in needpush){
+                            if (!this.isContain(needpush[n], contain[color])) {
+                                contain[color].push(needpush[n]);
+                            }
+                        }
+                    }
+                }
+                for (var n in except_) {
+                    if (!this.isContain(except_[n], except)) {
+                        except.push(except_[n]);
+                    }
+                }
+            }
+        }
+    }
 
-       return contain;
+    return contain;
 }
 
 Go.countLiberty = function(i_,j_,except){
-       var ret = {};
-       except.push([i_,j_]);
-       for (var d in this.directs) {
-               if (ret.hasOwnProperty('none'))
-                       break;
-               var i = parseInt(i_)+parseInt(this.directs[d][0]);
-               var j = parseInt(j_)+parseInt(this.directs[d][1]);
-               if (i>=0 && j>= 0 && i<this.bounder && j<this.bounder && !this.isContain([i,j], except)) {
-                       if (this.board[i][j] == 'board') {
-                               var liberty = this.countLiberty(i,j,except);
-                               if (liberty.hasOwnProperty('none')) {
-                                       ret['none'] = [];
-                                       break;
-                               } else if (liberty.hasOwnProperty('black')){
-                                       if (ret.hasOwnProperty('white')) {
-                                               ret['none'] = [];
-                                               break;
-                                       } else {
-                                               if (!ret.hasOwnProperty('black'))
-                                                       ret['black'] = [];
-                                               for (var n in liberty['black']){
-                                                       if (!this.isContain(liberty['black'][n], ret['black'])) {
-                                                               ret['black'].push(liberty['black'][n]);
-                                                       }
-                                               }
-                                       }
-                               } else if (liberty.hasOwnProperty('white')) {
-                                       if (ret.hasOwnProperty('black')) {
-                                               ret['none'] = [];
-                                               break;
-                                       } else {
-                                               if (!ret.hasOwnProperty('white'))
-                                                       ret['white'] = [];
-                                               for (var n in liberty['white']){
-                                                       if (!this.isContain(liberty['white'][n], ret['white'])) {
-                                                               ret['white'].push(liberty['white'][n]);
-                                                       }
-                                               }
-                                       }
-                               } else if (liberty.hasOwnProperty('neutral')) {
-                                       if (!ret.hasOwnProperty('neutral'))
-                                               ret['neutral'] = [];
-                                       for (var n in liberty['neutral']){
-                                               if (!this.isContain(liberty['neutral'][n], ret['neutral'])) {
-                                                       ret['neutral'].push(liberty['neutral'][n]);
-                                               }
-                                       }
-                               }
-                       } else if (this.board[i][j] == 'black') {
-                               if (ret.hasOwnProperty('white')) {
-                                       ret['none'] = [];
-                                       break;
-                               } else if (!ret.hasOwnProperty('black')) {
-                                       ret['black'] = [];
-                               }
-                       } else if (this.board[i][j] == 'white') {
-                               if (ret.hasOwnProperty('black')) {
-                                       ret['none'] = [];
-                                       break;
-                               } else if (!ret.hasOwnProperty('white')) {
-                                       ret['white'] = [];
-                               }
-                       }
-               }
-       }
-       if (!ret.hasOwnProperty('none')) {
-               if (ret.hasOwnProperty('black')) {
-                       if (!this.isContain([i_,j_], ret['black']))
-                               ret['black'].push([i_,j_]);
-                       if (ret.hasOwnProperty('neutral')){
-                               for (var p = ret['neutral'].shift(); typeof p != 'undefined'; p = ret['neutral'].shift()) {
-                                       if (!this.isContain(p, ret['black'])) {
-                                               ret['black'].push(p);
-                                       }
-                               }
-                       }
-               } else if (ret.hasOwnProperty('white')) {
-                       if (!this.isContain([i_,j_], ret['white']))
-                               ret['white'].push([i_,j_]);
-                       if (ret.hasOwnProperty('neutral')){
-                               for (var p = ret['neutral'].shift(); typeof p != 'undefined'; p = ret['neutral'].shift()) {
-                                       if (!this.isContain(p, ret['white'])) {
-                                               ret['white'].push(p);
-                                       }
-                               }
-                       }
-               } else {
-                       if (!ret.hasOwnProperty('neutral'))
-                               ret['neutral'] = [];
-                       if (!this.isContain([i_,j_], ret['neutral']))
-                               ret['neutral'].push([i_,j_]);
-               }
-       }
-       return ret;
+    var ret = {};
+    except.push([i_,j_]);
+    for (var d in this.directs) {
+        if (ret.hasOwnProperty('none'))
+            break;
+        var i = parseInt(i_)+parseInt(this.directs[d][0]);
+        var j = parseInt(j_)+parseInt(this.directs[d][1]);
+        if (i>=0 && j>= 0 && i<this.bounder && j<this.bounder && !this.isContain([i,j], except)) {
+            if (this.board[i][j] == 'board') {
+                var liberty = this.countLiberty(i,j,except);
+                if (liberty.hasOwnProperty('none')) {
+                    ret['none'] = [];
+                    break;
+                } else if (liberty.hasOwnProperty('black')){
+                    if (ret.hasOwnProperty('white')) {
+                        ret['none'] = [];
+                        break;
+                    } else {
+                        if (!ret.hasOwnProperty('black'))
+                            ret['black'] = [];
+                        for (var n in liberty['black']){
+                            if (!this.isContain(liberty['black'][n], ret['black'])) {
+                                ret['black'].push(liberty['black'][n]);
+                            }
+                        }
+                    }
+                } else if (liberty.hasOwnProperty('white')) {
+                    if (ret.hasOwnProperty('black')) {
+                        ret['none'] = [];
+                        break;
+                    } else {
+                        if (!ret.hasOwnProperty('white'))
+                            ret['white'] = [];
+                        for (var n in liberty['white']){
+                            if (!this.isContain(liberty['white'][n], ret['white'])) {
+                                ret['white'].push(liberty['white'][n]);
+                            }
+                        }
+                    }
+                } else if (liberty.hasOwnProperty('neutral')) {
+                    if (!ret.hasOwnProperty('neutral'))
+                        ret['neutral'] = [];
+                    for (var n in liberty['neutral']){
+                        if (!this.isContain(liberty['neutral'][n], ret['neutral'])) {
+                            ret['neutral'].push(liberty['neutral'][n]);
+                        }
+                    }
+                }
+            } else if (this.board[i][j] == 'black') {
+                if (ret.hasOwnProperty('white')) {
+                    ret['none'] = [];
+                    break;
+                } else if (!ret.hasOwnProperty('black')) {
+                    ret['black'] = [];
+                }
+            } else if (this.board[i][j] == 'white') {
+                if (ret.hasOwnProperty('black')) {
+                    ret['none'] = [];
+                    break;
+                } else if (!ret.hasOwnProperty('white')) {
+                    ret['white'] = [];
+                }
+            }
+        }
+    }
+    if (!ret.hasOwnProperty('none')) {
+        if (ret.hasOwnProperty('black')) {
+            if (!this.isContain([i_,j_], ret['black']))
+                ret['black'].push([i_,j_]);
+            if (ret.hasOwnProperty('neutral')){
+                for (var p = ret['neutral'].shift(); typeof p != 'undefined'; p = ret['neutral'].shift()) {
+                    if (!this.isContain(p, ret['black'])) {
+                        ret['black'].push(p);
+                    }
+                }
+            }
+        } else if (ret.hasOwnProperty('white')) {
+            if (!this.isContain([i_,j_], ret['white']))
+                ret['white'].push([i_,j_]);
+            if (ret.hasOwnProperty('neutral')){
+                for (var p = ret['neutral'].shift(); typeof p != 'undefined'; p = ret['neutral'].shift()) {
+                    if (!this.isContain(p, ret['white'])) {
+                        ret['white'].push(p);
+                    }
+                }
+            }
+        } else {
+            if (!ret.hasOwnProperty('neutral'))
+                ret['neutral'] = [];
+            if (!this.isContain([i_,j_], ret['neutral']))
+                ret['neutral'].push([i_,j_]);
+        }
+    }
+    return ret;
 }
 
 Go.isContain = function(place, _array) {
-       var heat = _array || [];
-       for (var i in heat){
-               if (heat[i][0] == place[0] && heat[i][1] == place[1]) {
-                       return true;
-               }
-       }
-       return false;
+    var heat = _array || [];
+    for (var i in heat){
+        if (heat[i][0] == place[0] && heat[i][1] == place[1]) {
+            return true;
+        }
+    }
+    return false;
 }
 
 Go.drawMessage = function(){
-       this.current.stop();
-       this.current = this.player[(this.current.color=='black'?'white':'black')];
-       this.current.start();
+    this.current.stop();
+    this.current = this.player[(this.current.color=='black'?'white':'black')];
+    this.current.start();
 }
 
 Go.skip = function(color_){
-       var color = color_ || this.current.color;
-       if (this.current.color == color && !this.isSetting && this.isStart) {
-               this.playSound('settingbtn');
-               if (this.isPass) {
-                       this.stop();
-               } else {
-                       var status = {'color': this.current.color,
-                                                 'setPlace': [],
-                                                 'isPass': false,};
-                       status.restTime = {};
-                       status.restTime['black'] = this.player['black'].restTime;
-                       status.restTime['white'] = this.player['white'].restTime;
-                       this.manual.push(status);
-                       this.drawMessage();
-                       this.isPass = true;
-               }
-       }
+    var color = color_ || this.current.color;
+    if (this.current.color == color && !this.isSetting && this.isStart) {
+        this.playSound('settingbtn');
+        if (this.isPass) {
+            this.stop();
+        } else {
+            var status = {'color': this.current.color,
+                          'setPlace': [],
+                          'isPass': false,};
+            status.restTime = {};
+            status.restTime['black'] = this.player['black'].restTime;
+            status.restTime['white'] = this.player['white'].restTime;
+            this.manual.push(status);
+            this.drawMessage();
+            this.isPass = true;
+        }
+    }
 }
 
 function player(color_) {
-       this.color = color_;
-       var side = (color_ == 'black'?'left':'right');
-       this.restTime = 20*60;
-       this.score = 0;
-       this.place = [-1,-1];
-       this.stoneNum = Math.floor(Go.bounder*Go.bounder);
-       this.takes = [];
-       this.liberty = [];
-       this.resource = {
-               'pit':side+'_pit',
-               'arrow':side+'_arrow',
-               'timer':side+'_timer',
-               'score':side+'_score',
-               'stone':Go.texture[this.color],
-               'stone1':Go.texture[this.color+'1'],
-               'stone2':Go.texture[this.color+'2'],
-       };
-
-       var str = '';
-       $('.'+this.resource['pit']).html(str);
-       for (var i=0; i<this.stoneNum; i++){
-               var x = Math.floor(Math.random()*76)+20;
-               var y = Math.floor(Math.random()*296)+20;
-               var ext = Math.floor(Math.random()*16);
-               if (ext != 1 && ext != 2) ext = '';
-               str += '<img class="stone_in_pit" id="'+this.color+'stone'+i+'" style="top:'+y+'px;left:'+x+'px;" src="'+this.resource['stone'+ext]+'" />';
-       }
-       $('.'+this.resource['pit']).html(str);
-
-       $('.'+this.resource['timer']+' span').html('20:00');
-
-       this.currentStone = this.stoneNum-1;
-
-       this.dropStone = function() {
-               var x = Math.floor(Math.random()*76)+20;
-               var y = Math.floor(Math.random()*296)+20;
-               // var id = Math.floor(Math.random()*this.stoneNum);
-               var id = this.currentStone++;
-               var ext = Math.floor(Math.random()*16);
-               if (ext != 1 && ext != 2) ext = '';
-               $('#'+this.color+'stone'+id).attr('style', 'top:'+y+'px;left:'+x+'px;').attr('src', this.resource['stone'+ext]).removeClass('display_none');
-       }
-
-       this.pickStone = function(){
-               // var id = Math.floor(Math.random()*this.stoneNum);
-               var id = this.currentStone--;
-               $('#'+this.color+'stone'+id).addClass('display_none');
-       }
-
-       this.start = function(){
-               $('.'+this.resource['arrow']+' img').attr('src', this.texture['hi_arrow']);
-               this.updateScore();
-               this.updateTimer();
-               Go.startTimer();
-               //this.pickStone();
-       }
-
-       this.stop = function(){
-               $('.'+this.resource['arrow']+' img').attr('src', this.texture['arrow']);
-               this.updateScore();
-               Go.stopTimer();
-               this.updateTimer();
-       }
-
-       this.timeDida = function(){
-               this.restTime--;
-               this.updateTimer();
-       }
-
-       this.updateTimer = function() {
-               if (this.restTime >= 0){
-                       var s = this.restTime%60;
-                       var m = Math.floor(this.restTime/60);
-                       var s1 = s%10;
-                       var s2 = Math.floor(s/10);
-                       var m1 = m%10;
-                       var m2 = Math.floor(m/10);
-                       var t = ''+m2+m1+':'+s2+s1;
-                       //console.log(this.color+'['+t+']');
-                       $('.'+this.resource['timer']+' span').html(t);
+    this.color = color_;
+    var side = (color_ == 'black'?'left':'right');
+    this.restTime = 20*60;
+    this.score = 0;
+    this.place = [-1,-1];
+    this.stoneNum = Math.floor(Go.bounder*Go.bounder);
+    this.takes = [];
+    this.liberty = [];
+    this.resource = {
+        'pit':side+'_pit',
+        'arrow':side+'_arrow',
+        'timer':side+'_timer',
+        'score':side+'_score',
+        'stone':Go.texture[this.color],
+        'stone1':Go.texture[this.color+'1'],
+        'stone2':Go.texture[this.color+'2'],
+    };
+
+    var str = '';
+    $('.'+this.resource['pit']).html(str);
+    for (var i=0; i<this.stoneNum; i++){
+        var x = Math.floor(Math.random()*76)+20;
+        var y = Math.floor(Math.random()*296)+20;
+        var ext = Math.floor(Math.random()*16);
+        if (ext != 1 && ext != 2) ext = '';
+        str += '<img class="stone_in_pit" id="'+this.color+'stone'+i+'" style="top:'+y+'px;left:'+x+'px;" src="'+this.resource['stone'+ext]+'" />';
+    }
+    $('.'+this.resource['pit']).html(str);
+
+    $('.'+this.resource['timer']+' span').html('20:00');
+
+    this.currentStone = this.stoneNum-1;
+
+    this.dropStone = function() {
+        var x = Math.floor(Math.random()*76)+20;
+        var y = Math.floor(Math.random()*296)+20;
+        // var id = Math.floor(Math.random()*this.stoneNum);
+        var id = this.currentStone++;
+        var ext = Math.floor(Math.random()*16);
+        if (ext != 1 && ext != 2) ext = '';
+        $('#'+this.color+'stone'+id).attr('style', 'top:'+y+'px;left:'+x+'px;').attr('src', this.resource['stone'+ext]).removeClass('display_none');
+    }
+
+    this.pickStone = function(){
+        // var id = Math.floor(Math.random()*this.stoneNum);
+        var id = this.currentStone--;
+        $('#'+this.color+'stone'+id).addClass('display_none');
+    }
+
+    this.start = function(){
+        $('.'+this.resource['arrow']+' img').attr('src', this.texture['hi_arrow']);
+        this.updateScore();
+        this.updateTimer();
+        Go.startTimer();
+        //this.pickStone();
+    }
+
+    this.stop = function(){
+        $('.'+this.resource['arrow']+' img').attr('src', this.texture['arrow']);
+        this.updateScore();
+        Go.stopTimer();
+        this.updateTimer();
+    }
+
+    this.timeDida = function(){
+        this.restTime--;
+        this.updateTimer();
+    }
+
+    this.updateTimer = function() {
+        if (this.restTime >= 0){
+            var s = this.restTime%60;
+            var m = Math.floor(this.restTime/60);
+            var s1 = s%10;
+            var s2 = Math.floor(s/10);
+            var m1 = m%10;
+            var m2 = Math.floor(m/10);
+            var t = ''+m2+m1+':'+s2+s1;
+            //console.log(this.color+'['+t+']');
+            $('.'+this.resource['timer']+' span').html(t);
+        }
+    }
+
+    this.getScore = function() {
+               if(this.score == 1){
+                       return 1;
                }
-       }
-
-       this.getScore = function() {
-               return (this.score+this.liberty.length);
-       }
-
-       this.updateScore = function(){
-               var str = '';
-               var s = this.getScore();
-               for (var i=0; i<4; i++){
-                       str = s%10 + str;
-                       s = Math.floor(s/10);
+               else{
+                       return (this.score+this.liberty.length);
                }
-               $('#'+this.resource['score']).html(str);
-       }
+    }
+
+    this.updateScore = function(){
+        var str = '';
+        var s = this.getScore();
+        for (var i=0; i<4; i++){
+            str = s%10 + str;
+            s = Math.floor(s/10);
+        }
+        $('#'+this.resource['score']).html(str);
+    }
 }
 
 player.prototype.texture = {
-       'arrow':'images/GO_PlayerArrow_010612_a.png',
-       'hi_arrow':'images/GO_PlayerArrow_012012_b.png',
+    'arrow':'images/GO_PlayerArrow_010612_a.png',
+    'hi_arrow':'images/GO_PlayerArrow_012012_b.png',
 }
 
+Go.showLicense = function(id, hpageid) {
+    var lbtn = document.getElementById(id+"btnl");
+
+    var lpage = document.getElementById(id+"page");
+    var hpage = document.getElementById(hpageid);
+    var ltext;
+    var lscroll;
+    var timer;
+
+    if (!this.hasLicense) {
+        $('#licensepage').html('<div id="licensetext"><div id="licensescroll"></div></div> <div id="licensebtnq" class="licensebtn">Back</div>');
+        lscroll = document.getElementById(id+"scroll");
+        var request = new XMLHttpRequest();
+        request.open("GET", "README.txt", false);
+        request.onload = function(e) {
+            var text = this.responseText;
+            text = text.replace("<","&lt;");
+            text = text.replace(">","&gt;");
+            var lines = text.split("\n");
+            lines[0] = "<br><br>"+lines[0];
+            for(var i in lines)
+            {
+                if(lines[i].match(/--------------------/))
+                {
+                    lines[i] = "";
+                }
+                else
+                {
+                    lines[i] += "<br>";
+                }
+            }
+            lscroll.innerHTML = lines.join("\n");
+        }
+        request.send();
+        this.hasLicense = true;
+    }
+
+    var btnq = document.getElementById(id+"btnq");
+    lscroll = document.getElementById(id+"scroll");
+    ltext = document.getElementById(id+"text");
+    /* initialize scroll rate */
+    var dY = 2;
+    var t0 = 0;
+    var delay = 1000;
+
+    /* set the scroller to the top position */
+    lscroll.style.top = "0px";
+
+    /* display the license page, hide its parent */
+    hpage.style.display="none";
+    lpage.style.display="block";
+
+    /* calculate the scroll length when the window is shown */
+    var maxY = lscroll.clientHeight - ltext.clientHeight;
+
+    /* start the autoscroll interval */
+    timer = setInterval(function() {
+        /* get the actual interval, in case performance slows us down */
+        var t1 = (new Date()).getTime();
+        var dT = (t0 == 0)?20:(t1-t0);
+        t0 = t1;
+
+        /* delay specific number of milliseconds */
+        delay -= dT;
+        if(delay > 0)
+            return;
+
+        /* calculate the new top position using dY and dT */
+        var newY = Math.abs(parseInt(lscroll.style.top)) + ((dT/40)*dY);
+        if(newY > 0)
+            lscroll.style.top = (-1 * newY) + "px";
+        else
+            lscroll.style.top = "0px";
+
+        /* if the lscroll has hit the limit, delay and swing */
+        /* the other way */
+        if(newY >= maxY)
+        {
+            delay = 5000;
+            dY = -20;
+        }
+        else if(newY <= 0)
+        {
+            delay = 5000;
+            dY = 2;
+        }
+    }, 40);
+
+    btnq.onclick = function() {
+        hpage.style.display="block";
+        lpage.style.display="none";
+        clearInterval(timer);
+    }
+}
+
+var messages;
+
 function getMessage(key, alter) {
-       var ret = alter || '';
-       if (window.chrome && window.chrome.i18n && window.chrome.i18n.getMessage) {
-               ret = chrome.i18n.getMessage(key);
-       } else {
-               if (typeof this.messages == 'undefined') {
-                       $.getJSON("_locales/en/messages.json", function(data){
-                               this.messages = data;
-                       }).error(function(){
-                                       return ret;
-                       });
-               }
-        if (this.messages && (this.messages.hasOwnProperty(key)) && (this.messages[key].hasOwnProperty('message'))) {
-                       ret = this.messages[key].message;
-               }
-       }
-       return ret;
-}
-
-$(document).ready(function(){
-        license_init("license", "theworld");
-       $('title').html(getMessage('name', 'Go'));
-       $('#playerone').html(getMessage('player', 'Player')+' '+getMessage('one', 'One'));
-       $('#playertwo').html(getMessage('player', 'Player')+' '+getMessage('two', 'Two'));
-       $('.left_arrow span[name="score"]').html(getMessage('score', 'Score'));
-       $('.right_arrow span[name="score"]').html(getMessage('score', 'Score'));
-       $('.left_skip').html(getMessage('skip', 'Skip'));
-       $('.right_skip').html(getMessage('skip', 'Skip'));
-       $('.play_button_text').html(getMessage('play', 'Play'));
-       $('.setting_arrow span').html(getMessage('settings', 'Settings'));
-       $('.setting_sound span').html(getMessage('sound_setting', 'Sound FX....'));
-       $('.setting_timer span').html(getMessage('timer_setting', 'Timer...........'));
-       $('.setting_restart span').html(getMessage('restart', 'Restart'));
-       $('.setting_quit span').html(getMessage('quit', 'Quit'));
-       $('.setting_resume').html(getMessage('resume', 'Submit'));
-       $('.help_title').html(getMessage('rules', 'Rules'));
-       $('.replay').html(getMessage('newGame', 'New Game'));
-       $('span[name="player"]').html(getMessage('player', 'Player'));
-       var help = getMessage('help');
-       if (help.length > 0) {
-               $('.help_text').html(help);
-       }
-
-       //Pass game, continue pass cause the end
-       $('.left_skip').click(function(){
-               Go.skip('black');
-       });
-
-       $('.right_skip').click(function(){
-               Go.skip('white');
-       });
-
-       Go.init();
-});
+    var ret = alter || '';
+    if (locale && locale == 'en' && ret.length>0) {
+        return ret;
+    }
+    if (window.chrome && window.chrome.i18n && window.chrome.i18n.getMessage) {
+        ret = chrome.i18n.getMessage(key);
+    } else {
+        if (typeof messages == 'undefined') {
+            try {
+                var request = new XMLHttpRequest();
+                request.open("GET", "_locales/en/messages.json", false);
+                request.send();
+                var res = request.responseText;
+                messages = window.eval(res);
+            } catch (err) {
+                return ret;
+            }
+        }
+        if (messages && (messages.hasOwnProperty(key)) && (messages[key].hasOwnProperty('message'))) {
+            ret = messages[key].message;
+        }
+    }
+    return ret;
+}
+
+var locale;
+
+window.onload = function(){
+    locale = getMessage('locale', 'en');
+    if (locale != 'en') {
+        var head  = $('head').q;
+        var link  = document.createElement('link');
+        link.rel  = 'stylesheet';
+        link.type = 'text/css';
+        link.href = 'css/i18n.css';
+        head.appendChild(link);
+    }
+
+    $('title').html(getMessage('name', 'Go'));
+    $('#playerone').html(getMessage('player', 'Player')+' '+getMessage('one', 'One'));
+    $('#playertwo').html(getMessage('player', 'Player')+' '+getMessage('two', 'Two'));
+    $('.left_arrow span[name="score"]').html(getMessage('score', 'Score'));
+    $('.right_arrow span[name="score"]').html(getMessage('score', 'Score'));
+    $('.left_skip').html(getMessage('skip', 'Skip'));
+    $('.right_skip').html(getMessage('skip', 'Skip'));
+    $('.play_button_text').html(getMessage('play', 'Play'));
+
+    //Pass game, continue pass cause the end
+    $('.left_skip').click(function(){
+        Go.skip('black');
+    });
+
+    $('.right_skip').click(function(){
+        Go.skip('white');
+    });
+
+    Go.init();
+}
 
 
old mode 100644 (file)
new mode 100755 (executable)