5 Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software.
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29 <meta charset="utf-8">
30 <title>Chess Client</title>
31 <meta name="viewport" content="width=device-width, initial-scale=1.0">
32 <meta name="description" content="">
33 <meta name="author" content="">
36 <link href="./css/bootstrap.css" rel="stylesheet">
37 <link href="./css/bootstrap-responsive.css" rel="stylesheet">
38 <link href="./css/chess.css" rel="stylesheet">
39 <!-- Target tablets -->
40 <link href="./css/chess-tablet-large.css" media="(min-width:560px) and (max-width:710px)" rel="stylesheet" />
41 <link href="./css/chess-tablet-small.css" media="(min-width:460px) and (max-width:560px)" rel="stylesheet" />
42 <!-- Target phones -->
43 <link href="./css/chess-phone-large.css" media="(min-width:370px) and (max-width:460px)" rel="stylesheet" />
44 <link href="./css/chess-phone-small.css" media="(max-width:370px)" rel="stylesheet" />
45 <link href="./css/spinner.css" rel="stylesheet">
49 <div class="navbar-inner">
50 <a id="apptitle" class="brand" data-bind="css: { active: viewGamesActive }, click: activateSettings" href="#">JavaOne Chess</a>
51 <ul class="nav" data-bind="foreach: boards">
52 <li data-bind="css: { active: active }, click: $root.activateGame">
53 <span data-bind="visible: myTurn" class="badge badge-warning myturn">↪</span>
54 <span data-bind="visible: justObserving" class="badge myturn">∞</span>
55 <a href="#" data-bind="text: title"></a>
60 <div data-bind="template: { name: 'render-games', data: viewGames, ifnot: selectedBoard }"></div>
61 <div data-bind="template: { name: 'render-board', data: selectedBoard, if : selectedBoard }"></div>
63 <script type="text/html" id="render-board">
64 <div class="container-fluid">
65 <div class="row-fluid">
67 <h1><span data-bind="text: status"></span></h1>
68 <p style="position: relative; left: 0px; top: 0px; height: 25px">
69 <span data-bind="visible: blackTurn" class="badge badge-black-turn">Black's turn</span>
70 <span data-bind="visible: whiteTurn" class="badge badge-white-turn">White's turn</span>
71 <span data-bind="text: alertMessage" class="badge badge-warning badge-status"></span>
76 <!-- ko foreach: rows -->
78 <td class="row-label">
79 <span data-bind='text: y'></span>
81 <!-- ko foreach: columns -->
82 <td data-bind="click: $parents[1].selected, css: squareColor" >
83 <span data-bind='html: pieceEntity, css: { blackPiece: pieceColor() === "B", whitePiece: pieceColor() === "W" }' class="figure"></span>
89 <td class="col-label"></td>
90 <!-- ko foreach: columnNames -->
91 <td class="row-label">
92 <span data-bind='text: $data'></span>
98 <button data-bind="click: rotateBoard" class="but-orientation">Rotate Board</button>
99 <button data-bind="click: $root.leave" class="but-orientation">Leave Game</button>
103 <div class="row-fluid">
104 <div class="span12 log-div">
105 <h3 class="log-h">Game Log</h3>
107 <div data-bind="foreach: moves">
109 <!-- ko if: whiteMove -->
110 <span data-bind="text: round" class="badge"></span>
112 <a href="#" data-bind="html: html, click: $parent.showPosition"></a>,
121 <script type="text/html" id="render-games">
122 <div class="container-fluid">
123 <div data-bind="visible: $root.viewGamesActive">
124 <h3>List of Games</h3>
126 Status: <span data-bind="text: $root.status"></span>
128 <div class="input-append" class="select">
129 <input type="text" data-bind="value: whitePlayer, valueUpdate: 'afterkeydown'"
130 class="input-small" placeholder="White Player"></input>
132 <input type="text" data-bind="value: blackPlayer, valueUpdate: 'afterkeydown'"
133 class="input-small" placeholder="Black Player"></input>
136 <button data-bind="click: $root.createGame, enable: correctNames"
137 class="btn btn-success" >Create Game!</button>
139 <div data-bind="foreach: $root.boards">
140 <div class="input-append">
141 <input type="text" data-bind="value: status" disabled></input>
142 <button class="btn" data-bind="click: $root.joinGame">
161 <center data-bind="visible: false">
162 <img src="DukeHTML.png" width="320" height="200" alt="Loading...">
163 <h3>Initializing the virtual machine...</h3>
165 <script type="text/javascript" src="bck2brwsr.js"></script>
167 var vm = bck2brwsr('${project.build.finalName}.jar');
168 vm.loadClass('org.apidesign.html.demo.chess.LoadMain');