initial commit
|
|
@ -0,0 +1,9 @@
|
|||
[submodule "jquery-ui"]
|
||||
path = jquery-ui
|
||||
url = https://github.com/jquery/jquery-ui.git
|
||||
[submodule "jquery-ui-touch-punch"]
|
||||
path = jquery-ui-touch-punch
|
||||
url = https://github.com/furf/jquery-ui-touch-punch.git
|
||||
[submodule "gun"]
|
||||
path = gun
|
||||
url = https://github.com/amark/gun
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
#cb_outer2 {
|
||||
max-width: 80vmin;
|
||||
}
|
||||
|
||||
#cb_outer {
|
||||
max-width: 6in;
|
||||
}
|
||||
|
||||
#cb_container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
padding-top: 100%;
|
||||
}
|
||||
|
||||
#cb_inner {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
#cb_board {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 1px solid black;
|
||||
border-collapse: collapse;
|
||||
padding-top: 100%;
|
||||
}
|
||||
|
||||
#cb_board tr {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.cb-square {
|
||||
position: relative;
|
||||
width: calc((100% - 16pt) / 8);
|
||||
height: calc((100% - 16pt) / 8);
|
||||
border: 1px solid black;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.cb-horiz-label {
|
||||
position: relative;
|
||||
width: calc((100% - 16pt) / 8);
|
||||
height: 8pt;
|
||||
border: 1px solid black;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.cb-horiz-label div {
|
||||
position: absolute;
|
||||
top: calc(50% - (1em / 2));
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
font-size: 6pt;
|
||||
line-height: 6pt;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.cb-vert-label {
|
||||
position: relative;
|
||||
width: 8pt;
|
||||
height: calc((100% - 16pt) / 8);
|
||||
border: 1px solid black;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.cb-vert-label div {
|
||||
position: absolute;
|
||||
top: calc(50% - (1em / 2));
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
font-size: 6pt;
|
||||
line-height: 6pt;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.cb-lt-bg {
|
||||
background-color: #FFFFF0;
|
||||
}
|
||||
|
||||
.cb-lt-bg.cb-start, .cb-lt-bg.cb-end {
|
||||
background-color: #CCFFC0;
|
||||
}
|
||||
|
||||
.cb-dk-bg {
|
||||
background-color: #F5DEB3;
|
||||
}
|
||||
|
||||
.cb-dk-bg.cb-start, .cb-dk-bg.cb-end {
|
||||
background-color: #D0E398;
|
||||
}
|
||||
|
||||
.cb-phantom {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(128,128,128,0.5);
|
||||
}
|
||||
|
||||
.cb-dk-piece {
|
||||
position: absolute;
|
||||
top: 17.5%;
|
||||
left: 47.5%;
|
||||
width: 55%;
|
||||
height: 65%;
|
||||
}
|
||||
|
||||
#cb_phantom > .cb-dk-piece {
|
||||
left: 22.5%;
|
||||
}
|
||||
|
||||
.cb-lt-piece {
|
||||
position: absolute;
|
||||
top: 17.5%;
|
||||
left: -2.5%;
|
||||
width: 55%;
|
||||
height: 65%;
|
||||
}
|
||||
|
||||
#cb_phantom > .cb-lt-piece {
|
||||
left: 22.5%;
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit fbcb369aa81b546d0f84cabe7b5a66721a65371b
|
||||
|
|
@ -0,0 +1,216 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Paco Ŝako</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" type="text/css" href="css/chess.css">
|
||||
<link rel="stylesheet" type="text/css" href="jquery-ui/dist/jquery-ui.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Paco Ŝako</h1>
|
||||
|
||||
<div id="cb_outer2">
|
||||
<div id="cb_outer">
|
||||
<div id="cb_container">
|
||||
<div id="cb_inner">
|
||||
<table id="cb_board">
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="cb-horiz-label"><div>A</div></td>
|
||||
<td class="cb-horiz-label"><div>B</div></td>
|
||||
<td class="cb-horiz-label"><div>C</div></td>
|
||||
<td class="cb-horiz-label"><div>D</div></td>
|
||||
<td class="cb-horiz-label"><div>E</div></td>
|
||||
<td class="cb-horiz-label"><div>F</div></td>
|
||||
<td class="cb-horiz-label"><div>G</div></td>
|
||||
<td class="cb-horiz-label"><div>H</div></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr id="cb_row8">
|
||||
<td class="cb-vert-label"><div>8</div></td>
|
||||
<td id="cb_a8" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_b8" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_c8" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_d8" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_e8" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_f8" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_g8" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_h8" class="cb-square cb-dk-bg"></td>
|
||||
<td class="cb-vert-label"><div>8</div></td>
|
||||
</tr>
|
||||
<tr id="cb_row7">
|
||||
<td class="cb-vert-label"><div>7</div></td>
|
||||
<td id="cb_a7" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_b7" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_c7" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_d7" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_e7" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_f7" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_g7" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_h7" class="cb-square cb-lt-bg"></td>
|
||||
<td class="cb-vert-label"><div>7</div></td>
|
||||
</tr>
|
||||
<tr id="cb_row6">
|
||||
<td class="cb-vert-label"><div>6</div></td>
|
||||
<td id="cb_a6" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_b6" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_c6" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_d6" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_e6" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_f6" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_g6" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_h6" class="cb-square cb-dk-bg"></td>
|
||||
<td class="cb-vert-label"><div>6</div></td>
|
||||
</tr>
|
||||
<tr id="cb_row5">
|
||||
<td class="cb-vert-label"><div>5</div></td>
|
||||
<td id="cb_a5" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_b5" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_c5" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_d5" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_e5" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_f5" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_g5" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_h5" class="cb-square cb-lt-bg"></td>
|
||||
<td class="cb-vert-label"><div>5</div></td>
|
||||
</tr>
|
||||
<tr id="cb_row4">
|
||||
<td class="cb-vert-label"><div>4</div></td>
|
||||
<td id="cb_a4" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_b4" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_c4" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_d4" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_e4" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_f4" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_g4" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_h4" class="cb-square cb-dk-bg"></td>
|
||||
<td class="cb-vert-label"><div>4</div></td>
|
||||
</tr>
|
||||
<tr id="cb_row3">
|
||||
<td class="cb-vert-label"><div>3</div></td>
|
||||
<td id="cb_a3" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_b3" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_c3" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_d3" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_e3" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_f3" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_g3" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_h3" class="cb-square cb-lt-bg"></td>
|
||||
<td class="cb-vert-label"><div>3</div></td>
|
||||
</tr>
|
||||
<tr id="cb_row2">
|
||||
<td class="cb-vert-label"><div>2</div></td>
|
||||
<td id="cb_a2" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_b2" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_c2" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_d2" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_e2" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_f2" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_g2" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_h2" class="cb-square cb-dk-bg"></td>
|
||||
<td class="cb-vert-label"><div>2</div></td>
|
||||
</tr>
|
||||
<tr id="cb_row1">
|
||||
<td class="cb-vert-label"><div>1</div></td>
|
||||
<td id="cb_a1" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_b1" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_c1" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_d1" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_e1" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_f1" class="cb-square cb-lt-bg"></td>
|
||||
<td id="cb_g1" class="cb-square cb-dk-bg"></td>
|
||||
<td id="cb_h1" class="cb-square cb-lt-bg"></td>
|
||||
<td class="cb-vert-label"><div>1</div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="cb-horiz-label"><div>A</div></td>
|
||||
<td class="cb-horiz-label"><div>B</div></td>
|
||||
<td class="cb-horiz-label"><div>C</div></td>
|
||||
<td class="cb-horiz-label"><div>D</div></td>
|
||||
<td class="cb-horiz-label"><div>E</div></td>
|
||||
<td class="cb-horiz-label"><div>F</div></td>
|
||||
<td class="cb-horiz-label"><div>G</div></td>
|
||||
<td class="cb-horiz-label"><div>H</div></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button id="cb_undo" disabled="true">Undo</button>
|
||||
<button id="cb_redo" disabled="true">Redo</button>
|
||||
<button id="cb_reset">Reset</button>
|
||||
<button id="cb_pass">Pass</button>
|
||||
<span id="cb_light_move" style="display: hidden">Light player's move</span>
|
||||
<span id="cb_dark_move" style="display: hidden">Dark player's move</span>
|
||||
<form id="cb_names">
|
||||
<input id="cb_light_name" placeholder="Light"> vs. <input id="cb_dark_name" placeholder="Dark"><br>
|
||||
<label>Select game:</label>
|
||||
<select id="cb_select_game">
|
||||
<option id="cb_new_game">— New Game —</option>
|
||||
</select>
|
||||
<p id="cb_history"></p>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="cb_hidden" style="display: none">
|
||||
<div id="cb_phantom" class="cb-phantom"></div>
|
||||
|
||||
<div id="cb_pieces" style="display: none">
|
||||
<div id="cb_piece_kd"><img src="svg/Chess_kdt45.svg" alt="kd" draggable="true" class="cb-piece cb-dk-piece cb-king"></div>
|
||||
<div id="cb_piece_qd"><img src="svg/Chess_qdt45.svg" alt="qd" draggable="true" class="cb-piece cb-dk-piece cb-queen"></div>
|
||||
<div id="cb_piece_rd"><img src="svg/Chess_rdt45.svg" alt="rd" draggable="true" class="cb-piece cb-dk-piece cb-rook"></div>
|
||||
<div id="cb_piece_nd"><img src="svg/Chess_ndt45.svg" alt="nd" draggable="true" class="cb-piece cb-dk-piece cb-knight"></div>
|
||||
<div id="cb_piece_bd"><img src="svg/Chess_bdt45.svg" alt="bd" draggable="true" class="cb-piece cb-dk-piece cb-bishop"></div>
|
||||
<div id="cb_piece_pd"><img src="svg/Chess_pdt45.svg" alt="pd" draggable="true" class="cb-piece cb-dk-piece cb-pawn"></div>
|
||||
<div id="cb_piece_kl"><img src="svg/Chess_klt45.svg" alt="kl" draggable="true" class="cb-piece cb-lt-piece cb-king"></div>
|
||||
<div id="cb_piece_ql"><img src="svg/Chess_qlt45.svg" alt="ql" draggable="true" class="cb-piece cb-lt-piece cb-queen"></div>
|
||||
<div id="cb_piece_rl"><img src="svg/Chess_rlt45.svg" alt="rl" draggable="true" class="cb-piece cb-lt-piece cb-rook"></div>
|
||||
<div id="cb_piece_nl"><img src="svg/Chess_nlt45.svg" alt="nl" draggable="true" class="cb-piece cb-lt-piece cb-knight"></div>
|
||||
<div id="cb_piece_bl"><img src="svg/Chess_blt45.svg" alt="bl" draggable="true" class="cb-piece cb-lt-piece cb-bishop"></div>
|
||||
<div id="cb_piece_pl"><img src="svg/Chess_plt45.svg" alt="pl" draggable="true" class="cb-piece cb-lt-piece cb-pawn"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 1em; display: none">
|
||||
<form id="sign">
|
||||
<input id="alias" placeholder="username">
|
||||
<input id="pass" type="password" placeholder="passphrase">
|
||||
<input id="in" type="submit" value="sign in">
|
||||
<input id="up" type="button" value="sign up">
|
||||
<p id="message" style="display: none"></p>
|
||||
</form>
|
||||
|
||||
<div id="todo" style="display: none">
|
||||
<ul id="todo_list"></ul>
|
||||
|
||||
<form id="said">
|
||||
<input id="say">
|
||||
<input id="speak" type="submit" value="speak">
|
||||
<input id="sign_out" type="button" value="sign out">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
console.real_log = console.log;
|
||||
console.log = () => {};
|
||||
//console.STAT = console.real_log;
|
||||
</script>
|
||||
<script src="jquery-ui/external/jquery/jquery.js"></script>
|
||||
<script src="jquery-ui/dist/jquery-ui.min.js"></script>
|
||||
<script src="jquery-ui-touch-punch/jquery.ui.touch-punch.min.js"></script>
|
||||
<script src="gun/gun.js"></script>
|
||||
<script src="gun/sea.js"></script>
|
||||
<script src="gun/lib/webrtc.js"></script>
|
||||
<script>
|
||||
console.log = console.real_log;
|
||||
</script>
|
||||
<script src="js/chess.js"></script>
|
||||
<script src="js/todo.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
<!-- vim:set expandtab sw=3 ts=8: -->
|
||||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit c6f1735249295bb37153861aa97e5b3e38d46b02
|
||||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 4bc009145202d9c7483ba85f3a236a8f3470354d
|
||||
|
|
@ -0,0 +1,473 @@
|
|||
'use strict';
|
||||
var gun = Gun(['https://jessemcdonald.info/gun']);
|
||||
|
||||
let initialBoard = (function (){
|
||||
var init = JSON.stringify({
|
||||
'light': [
|
||||
'rnbkqbnr',
|
||||
'pppppppp',
|
||||
' ',
|
||||
' ',
|
||||
' ',
|
||||
' ',
|
||||
' ',
|
||||
' ',
|
||||
],
|
||||
'dark': [
|
||||
' ',
|
||||
' ',
|
||||
' ',
|
||||
' ',
|
||||
' ',
|
||||
' ',
|
||||
'pppppppp',
|
||||
'rnbkqbnr',
|
||||
],
|
||||
'player': 'light',
|
||||
});
|
||||
return function (){ return JSON.parse(init); }
|
||||
})();
|
||||
|
||||
function cloneJSON(obj){
|
||||
return JSON.parse(JSON.stringify(obj));
|
||||
}
|
||||
|
||||
function normalizeSide(side){
|
||||
return (side[0] === 'd') ? 'dark' : 'light';
|
||||
}
|
||||
|
||||
function otherSide(side){
|
||||
return (side[0] === 'd') ? 'light' : 'dark';
|
||||
}
|
||||
|
||||
function boardGet(board, where, side){
|
||||
side = normalizeSide(side);
|
||||
if (where === 'phantom') {
|
||||
if (!board['phantom'] || board['phantom']['type'][1] !== side[0]) {
|
||||
return ' ';
|
||||
} else {
|
||||
return board['phantom']['type'][0];
|
||||
}
|
||||
} else {
|
||||
var column = 'abcdefgh'.indexOf(where[0]);
|
||||
var row = Number(where[1]) - 1;
|
||||
return board[side][row][column];
|
||||
}
|
||||
}
|
||||
|
||||
function boardPut(board, where, side, piece){
|
||||
side = (side[0] === 'd') ? 'dark' : 'light';
|
||||
var column = 'abcdefgh'.indexOf(where[0]);
|
||||
var row = Number(where[1]) - 1;
|
||||
var data = board[side][row];
|
||||
var prefix = data.substring(0, column);
|
||||
var suffix = data.substring(column + 1, 8);
|
||||
board[side][row] = prefix + piece + suffix;
|
||||
}
|
||||
|
||||
function movePiece(priorBoard, side, from, to){
|
||||
var other = otherSide(side);
|
||||
var type = boardGet(priorBoard, from, side);
|
||||
var took = boardGet(priorBoard, to, other);
|
||||
var replaced = boardGet(priorBoard, to, side);
|
||||
var alongside = (from === 'phantom') ? ' ' : boardGet(priorBoard, from, other);
|
||||
|
||||
var undoBoard = priorBoard;
|
||||
if (undoBoard['subsequent']) {
|
||||
undoBoard = cloneJSON(undoBoard);
|
||||
delete undoBoard['subsequent'];
|
||||
}
|
||||
|
||||
var board = cloneJSON(undoBoard);
|
||||
board['prior'] = undoBoard;
|
||||
|
||||
board['move'] = {
|
||||
'side': normalizeSide(side),
|
||||
'type': type,
|
||||
'from': from,
|
||||
'to': to
|
||||
};
|
||||
if (took !== ' ') {
|
||||
board['move']['took'] = took;
|
||||
}
|
||||
if (replaced !== ' ') {
|
||||
board['move']['replaced'] = replaced;
|
||||
}
|
||||
if (alongside !== ' ') {
|
||||
board['move']['alongside'] = alongside;
|
||||
}
|
||||
|
||||
if (from === 'phantom') {
|
||||
delete board['phantom'];
|
||||
} else {
|
||||
boardPut(board, from, side, ' ');
|
||||
boardPut(board, from, other, ' ');
|
||||
}
|
||||
|
||||
boardPut(board, to, side, type);
|
||||
|
||||
if (alongside !== ' ') {
|
||||
boardPut(board, to, other, alongside);
|
||||
}
|
||||
|
||||
if (replaced === ' ') {
|
||||
board['player'] = otherSide(board['player']);
|
||||
} else {
|
||||
board['phantom'] = { 'from': to, 'type': replaced + side[0] };
|
||||
}
|
||||
|
||||
return board;
|
||||
}
|
||||
|
||||
function renderHistory(board) {
|
||||
var list = [];
|
||||
|
||||
while (board && board['move']) {
|
||||
list.push(board['move']);
|
||||
board = board['prior'];
|
||||
}
|
||||
|
||||
var result = '';
|
||||
var n = 0;
|
||||
|
||||
while (list.length > 0) {
|
||||
var move = list.pop();
|
||||
if (move['from'] === 'phantom') {
|
||||
var took = move['took'] ? 'x' : '';
|
||||
result += '*' + move['type'].toUpperCase() + took + move['to'];
|
||||
} else {
|
||||
if (n > 0 || move['side'] === 'dark') {
|
||||
result += ' ';
|
||||
}
|
||||
|
||||
if (move['side'] === 'light') {
|
||||
++n;
|
||||
result += String(n) + '. ';
|
||||
}
|
||||
|
||||
if (move['pass']) {
|
||||
result += '...';
|
||||
} else if (move['alongside']) {
|
||||
if (move['side'] === 'light') {
|
||||
result += move['type'].toUpperCase() + move['alongside'].toUpperCase() + move['from'] + move['to'];
|
||||
} else {
|
||||
result += move['alongside'].toUpperCase() + move['type'].toUpperCase() + move['from'] + move['to'];
|
||||
}
|
||||
} else {
|
||||
var took = move['took'] ? 'x' : '';
|
||||
result += move['type'].toUpperCase() + move['from'] + took + move['to'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function pieceStartDrag(ev, ui){
|
||||
var board = $('#cb_board').data('board');
|
||||
var dragged = $(this);
|
||||
var type = dragged.data('type');
|
||||
var from = dragged.data('location');
|
||||
if (from === 'phantom' || boardGet(board, from, otherSide(type[1])) === ' ') {
|
||||
var clss = (type[1] === 'd') ? '.cb-dk-piece' : '.cb-lt-piece';
|
||||
var other = (type[1] === 'd') ? '.cb-lt-piece' : '.cb-dk-piece';
|
||||
$('.cb-square').not(':has('+clss+')').droppable('enable');
|
||||
$('.cb-square').filter(':has('+other+')').droppable('enable');
|
||||
} else {
|
||||
/* moving together, must go to an empty square */
|
||||
$('.cb-square').not(':has(.cb-piece)').droppable('enable');
|
||||
}
|
||||
};
|
||||
|
||||
function placePiece(where, type, count){
|
||||
var piece_id = 'cb_piece_' + type + '_' + count;
|
||||
var piece = $($('#' + piece_id)[0] || $('#cb_piece_' + type + ' img').clone());
|
||||
piece.attr('style', '');
|
||||
piece.attr('id', piece_id);
|
||||
piece.data({ 'type': type, 'location': where });
|
||||
piece.appendTo('#cb_' + where);
|
||||
piece.draggable({
|
||||
disabled: true,
|
||||
containment: '#cb_inner',
|
||||
revert: 'invalid',
|
||||
zIndex: 100,
|
||||
start: pieceStartDrag,
|
||||
});
|
||||
return piece;
|
||||
}
|
||||
|
||||
function renderBoard(board){
|
||||
$('#cb_board .cb-piece .ui-draggable').draggable('destroy');
|
||||
$('#cb_board .cb-piece').attr('style', '').appendTo('#cb_hidden');
|
||||
$('#cb_board .cb-start').removeClass('cb-start');
|
||||
$('#cb_board .cb-end').removeClass('cb-end');
|
||||
$('#cb_phantom').appendTo('#cb_hidden');
|
||||
|
||||
for (const side of ['light', 'dark']) {
|
||||
var counters = {};
|
||||
for (var row = 0; row < 8; ++row) {
|
||||
for (var column = 0; column < 8; ++column) {
|
||||
var here = 'abcdefgh'[column] + String(row+1);
|
||||
var type = board[side][row][column];
|
||||
if (type !== ' ') {
|
||||
if (!counters[type]) {
|
||||
counters[type] = 0;
|
||||
}
|
||||
var count = ++counters[type];
|
||||
placePiece(here, type + side[0], count);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var clss = board['player'] === 'light' ? '.cb-lt-piece' : '.cb-dk-piece';
|
||||
|
||||
if (board['phantom']) {
|
||||
var where = board['phantom']['from'];
|
||||
placePiece('phantom', board['phantom']['type'], 'ph');
|
||||
$('#cb_phantom').appendTo('#cb_' + where);
|
||||
$('#cb_board .ui-draggable').draggable('disable');
|
||||
$('#cb_phantom .ui-draggable-disabled').filter(clss).draggable('enable');
|
||||
} else {
|
||||
$('#cb_board .ui-draggable-disabled').filter(clss).draggable('enable');
|
||||
}
|
||||
|
||||
if (board['move']) {
|
||||
if (board['move']['from'] === 'phantom') {
|
||||
$('#cb_' + board['prior']['move']['to']).addClass('cb-start');
|
||||
} else {
|
||||
$('#cb_' + board['move']['from']).addClass('cb-start');
|
||||
}
|
||||
$('#cb_' + board['move']['to']).addClass('cb-end');
|
||||
}
|
||||
|
||||
$('#cb_' + otherSide(board['player']) + '_move').hide();
|
||||
$('#cb_' + normalizeSide(board['player']) + '_move').show();
|
||||
|
||||
$('#cb_history').text(renderHistory(board));
|
||||
|
||||
$('#cb_undo').attr('disabled', board['prior'] ? false : true);
|
||||
$('#cb_redo').attr('disabled', board['subsequent'] ? false : true);
|
||||
$('#cb_pass').attr('disabled', board['phantom'] ? true : false);
|
||||
}
|
||||
|
||||
function randomId(){
|
||||
var res = '';
|
||||
for (var i = 0; i < 4; ++i) {
|
||||
var part = Math.floor(Math.random() * 65536).toString(16);
|
||||
res = res + ("0000".substring(part.length, 4) + part);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
var PacoSakoUUID = '7c38edd4-c931-49c8-9f1a-84de560815db';
|
||||
|
||||
function putState(board){
|
||||
var boardElem = $('#cb_board');
|
||||
var gameId = boardElem.data('gameId');
|
||||
var game = gun.get(PacoSakoUUID).get('games').get(gameId);
|
||||
game.put({ 'board': JSON.stringify(board) });
|
||||
putMeta();
|
||||
}
|
||||
|
||||
function putMeta(){
|
||||
var gameId = $('#cb_board').data('gameId');
|
||||
var lightName = $('#cb_light_name').val() || 'Light';
|
||||
var darkName = $('#cb_dark_name').val() || 'Dark';
|
||||
var meta = gun.get(PacoSakoUUID).get('meta').get(gameId);
|
||||
meta.put({ 'gameId': gameId, 'lightName': lightName, 'darkName': darkName, 'timestamp': new Date().getTime() });
|
||||
}
|
||||
|
||||
function switchGameId(newId){
|
||||
var boardElem = $('#cb_board');
|
||||
var gameId = boardElem.data('gameId');
|
||||
|
||||
if (newId == gameId) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (gameId) {
|
||||
//gun.get(PacoSakoUUID).get('games').get(gameId).off();
|
||||
//gun.get(PacoSakoUUID).get('meta').get(gameId).off();
|
||||
}
|
||||
|
||||
boardElem.data('gameId', newId);
|
||||
location.hash = '#/' + newId;
|
||||
|
||||
/* this will be the starting state if no data is received from peers */
|
||||
var newBoard = initialBoard();
|
||||
boardElem.data('board', newBoard);
|
||||
renderBoard(newBoard);
|
||||
|
||||
gun.get(PacoSakoUUID).get('games').get(newId).on(function(d){
|
||||
if (d && d['board'] && $('#cb_board').data('gameId') === newId) {
|
||||
var board = JSON.parse(d['board']);
|
||||
$('#cb_board').data('board', board);
|
||||
renderBoard(board);
|
||||
}
|
||||
});
|
||||
|
||||
$('#cb_light_name').val('');
|
||||
$('#cb_dark_name').val('');
|
||||
|
||||
gun.get(PacoSakoUUID).get('meta').get(newId).on(function(d){
|
||||
if (d && $('#cb_board').data('gameId') === newId) {
|
||||
if (d['lightName']) {
|
||||
$('#cb_light_name').val(d['lightName']);
|
||||
}
|
||||
if (d['darkName']) {
|
||||
$('#cb_dark_name').val(d['darkName']);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var selOpt = $('#cb_game_' + newId);
|
||||
if (selOpt.length === 1) {
|
||||
$('#cb_select_game')[0].selectedIndex = selOpt.index();
|
||||
} else {
|
||||
$('#cb_select_game')[0].selectedIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
$(function (){
|
||||
$('.cb-square').droppable({
|
||||
accept: '.cb-piece',
|
||||
disabled: true,
|
||||
deactivate: function(ev, ui){
|
||||
$(this).droppable('disable');
|
||||
},
|
||||
drop: function(ev, ui) {
|
||||
var dragged = ui.draggable;
|
||||
var type = dragged.data('type');
|
||||
var from = dragged.data('location');
|
||||
var to = this.id.replace(/^cb_/, '');
|
||||
dragged.appendTo('#cb_hidden');
|
||||
|
||||
var newBoard = movePiece($('#cb_board').data('board'), type[1], from, to);
|
||||
putState(newBoard);
|
||||
},
|
||||
});
|
||||
|
||||
$('#cb_undo').on('click', function(){
|
||||
var board = $('#cb_board').data('board');
|
||||
if (board['prior']) {
|
||||
var newBoard = cloneJSON(board['prior']);
|
||||
var redoBoard = cloneJSON(board);
|
||||
delete redoBoard['prior'];
|
||||
newBoard['subsequent'] = redoBoard;
|
||||
putState(newBoard);
|
||||
}
|
||||
});
|
||||
|
||||
$('#cb_redo').on('click', function(){
|
||||
var board = $('#cb_board').data('board');
|
||||
if (board['subsequent']) {
|
||||
var newBoard = cloneJSON(board['subsequent']);
|
||||
var undoBoard = cloneJSON(board);
|
||||
delete undoBoard['subsequent'];
|
||||
newBoard['prior'] = undoBoard;
|
||||
putState(newBoard);
|
||||
}
|
||||
});
|
||||
|
||||
$('#cb_reset').on('click', function(){
|
||||
putState(initialBoard());
|
||||
});
|
||||
|
||||
$('#cb_pass').on('click', function(){
|
||||
var board = $('#cb_board').data('board');
|
||||
if (!board['phantom']) {
|
||||
var newBoard = cloneJSON(board);
|
||||
newBoard['prior'] = board;
|
||||
newBoard['move'] = { 'side': board['player'], 'pass': true };
|
||||
newBoard['player'] = otherSide(board['player']);
|
||||
putState(newBoard);
|
||||
}
|
||||
});
|
||||
|
||||
$('#cb_select_game').on('change', function(){
|
||||
var optIndex = $('#cb_select_game')[0].selectedIndex;
|
||||
if (optIndex === 0) {
|
||||
switchGameId(randomId());
|
||||
} else if (optIndex >= 1) {
|
||||
var opt = $('#cb_select_game option')[optIndex];
|
||||
if (opt) {
|
||||
switchGameId(opt.id.replace(/^cb_game_/, ''));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let updateMeta = function() { putMeta(); }
|
||||
$('#cb_light_name').on('input', updateMeta);
|
||||
$('#cb_dark_name').on('input', updateMeta);
|
||||
|
||||
gun.get(PacoSakoUUID).get('meta').map().on(function(d){
|
||||
if (d && d['gameId'] && d['lightName'] && d['darkName']) {
|
||||
function updateTitle(opt){
|
||||
const then = opt.data('then');
|
||||
const now = new Date().getTime();
|
||||
var age_str = '';
|
||||
if (then > now) {
|
||||
age_str = ' (future)';
|
||||
} else if ((now - then) < 60*60*1000) {
|
||||
age_str = ' (' + Math.floor((now - then) / (60*1000)) + 'm)';
|
||||
} else if ((now - then) < 24*60*60*1000) {
|
||||
age_str = ' (' + Math.floor((now - then) / (60*60*1000)) + 'h)';
|
||||
} else if ((now - then) < 14*24*60*60*1000) {
|
||||
age_str = ' (' + Math.floor((now - then) / (24*60*60*1000)) + 'd)';
|
||||
} else if (d['gameId'] !== $('#cb_board').data('gameId')) {
|
||||
opt.remove();
|
||||
return;
|
||||
}
|
||||
opt.text(opt.data('title') + age_str);
|
||||
}
|
||||
|
||||
var opt = $('#cb_game_' + d['gameId']);
|
||||
if (opt.length === 0) {
|
||||
opt = $('<option></option>');
|
||||
opt.attr('id', 'cb_game_' + d['gameId']);
|
||||
|
||||
function refreshTitle(){
|
||||
updateTitle(opt);
|
||||
window.setTimeout(refreshTitle, 15000);
|
||||
};
|
||||
|
||||
window.setTimeout(refreshTitle, 0);
|
||||
}
|
||||
|
||||
opt.data('title', d['lightName'] + ' vs. ' + d['darkName']);
|
||||
opt.data('then', d['timestamp'] || new Date().getTime());
|
||||
opt.addClass('cb-game-option');
|
||||
opt.appendTo('#cb_select_game');
|
||||
updateTitle(opt);
|
||||
|
||||
var select = $('#cb_select_game');
|
||||
var list = select.children('.cb-game-option').get();
|
||||
list.sort(function(a,b) {
|
||||
const then_a = $(a).data('then');
|
||||
const then_b = $(b).data('then');
|
||||
return (then_a < then_b) ? 1 : (then_a == then_b) ? 0 : -1;
|
||||
});
|
||||
|
||||
for (const e of list) {
|
||||
$(e).appendTo(select);
|
||||
}
|
||||
|
||||
var selOpt = $('#cb_game_' + $('#cb_board').data('gameId'));
|
||||
if (selOpt.length === 1) {
|
||||
$('#cb_select_game')[0].selectedIndex = selOpt.index();
|
||||
} else {
|
||||
$('#cb_select_game')[0].selectedIndex = -1;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var gameId = location.hash.replace(/^#\//, '');
|
||||
if (gameId.length !== 16) {
|
||||
gameId = randomId();
|
||||
}
|
||||
|
||||
switchGameId(gameId);
|
||||
});
|
||||
|
||||
/* vim:set expandtab sw=3 ts=8: */
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
var user = gun.user();
|
||||
|
||||
function UI(say, id){
|
||||
var li = $('#' + id).get(0) || $('<li>').attr('id', id).appendTo('ul');
|
||||
$(li).text(say);
|
||||
};
|
||||
|
||||
function auth(alias, pass){
|
||||
$('#message').text('Looking up alias "' + alias + '"...').show();
|
||||
gun.get('~@' + alias).once(function(){
|
||||
$('#message').text('Signing in as "' + alias + '"...').show();
|
||||
user.auth(alias, pass, function (ack){
|
||||
if (ack.err) {
|
||||
$('#message').text(ack.err).show();
|
||||
} else {
|
||||
$('#message').hide();
|
||||
$('#pass').val('');
|
||||
$('#sign').hide();
|
||||
$('#todo').show();
|
||||
user.get('said').map().once(UI);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$('#up').on('click', function(e){
|
||||
var alias = $('#alias').val();
|
||||
var pass = $('#pass').val();
|
||||
$('#message').text('Creating alias "' + alias + '"...').show();
|
||||
user.create(alias, pass, function (ack){
|
||||
if (ack.err) {
|
||||
$('#message').text(ack.err).show();
|
||||
} else {
|
||||
auth(alias, pass);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#sign').on('submit', function(e){
|
||||
e.preventDefault();
|
||||
auth($('#alias').val(), $('#pass').val());
|
||||
});
|
||||
|
||||
$('#said').on('submit', function(e){
|
||||
e.preventDefault();
|
||||
if(!user.is){ return }
|
||||
user.get('said').set($('#say').val());
|
||||
$('#say').val('');
|
||||
});
|
||||
|
||||
$('#sign_out').on('click', function (){
|
||||
$('ul').empty();
|
||||
user.leave();
|
||||
$('#sign').show();
|
||||
$('#todo').hide();
|
||||
});
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="45">
|
||||
<g style="opacity:1; fill:none; fill-rule:evenodd; fill-opacity:1; stroke:#000000; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">
|
||||
<g style="fill:#000000; stroke:#000000; stroke-linecap:butt;">
|
||||
<path
|
||||
d="M 9,36 C 12.39,35.03 19.11,36.43 22.5,34 C 25.89,36.43 32.61,35.03 36,36 C 36,36 37.65,36.54 39,38 C 38.32,38.97 37.35,38.99 36,38.5 C 32.61,37.53 25.89,38.96 22.5,37.5 C 19.11,38.96 12.39,37.53 9,38.5 C 7.646,38.99 6.677,38.97 6,38 C 7.354,36.06 9,36 9,36 z" />
|
||||
<path
|
||||
d="M 15,32 C 17.5,34.5 27.5,34.5 30,32 C 30.5,30.5 30,30 30,30 C 30,27.5 27.5,26 27.5,26 C 33,24.5 33.5,14.5 22.5,10.5 C 11.5,14.5 12,24.5 17.5,26 C 17.5,26 15,27.5 15,30 C 15,30 14.5,30.5 15,32 z" />
|
||||
<path
|
||||
d="M 25 8 A 2.5 2.5 0 1 1 20,8 A 2.5 2.5 0 1 1 25 8 z" />
|
||||
</g>
|
||||
<path
|
||||
d="M 17.5,26 L 27.5,26 M 15,30 L 30,30 M 22.5,15.5 L 22.5,20.5 M 20,18 L 25,18"
|
||||
style="fill:none; stroke:#ffffff; stroke-linejoin:miter;" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="45">
|
||||
<g style="opacity:1; fill:none; fill-rule:evenodd; fill-opacity:1; stroke:#000000; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">
|
||||
<g style="fill:#ffffff; stroke:#000000; stroke-linecap:butt;">
|
||||
<path
|
||||
d="M 9,36 C 12.39,35.03 19.11,36.43 22.5,34 C 25.89,36.43 32.61,35.03 36,36 C 36,36 37.65,36.54 39,38 C 38.32,38.97 37.35,38.99 36,38.5 C 32.61,37.53 25.89,38.96 22.5,37.5 C 19.11,38.96 12.39,37.53 9,38.5 C 7.646,38.99 6.677,38.97 6,38 C 7.354,36.06 9,36 9,36 z" />
|
||||
<path
|
||||
d="M 15,32 C 17.5,34.5 27.5,34.5 30,32 C 30.5,30.5 30,30 30,30 C 30,27.5 27.5,26 27.5,26 C 33,24.5 33.5,14.5 22.5,10.5 C 11.5,14.5 12,24.5 17.5,26 C 17.5,26 15,27.5 15,30 C 15,30 14.5,30.5 15,32 z" />
|
||||
<path
|
||||
d="M 25 8 A 2.5 2.5 0 1 1 20,8 A 2.5 2.5 0 1 1 25 8 z" />
|
||||
</g>
|
||||
<path
|
||||
d="M 17.5,26 L 27.5,26 M 15,30 L 30,30 M 22.5,15.5 L 22.5,20.5 M 20,18 L 25,18"
|
||||
style="fill:none; stroke:#000000; stroke-linejoin:miter;" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="45">
|
||||
<g style="fill:none; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">
|
||||
<path
|
||||
d="M 22.5,11.63 L 22.5,6"
|
||||
style="fill:none; stroke:#000000; stroke-linejoin:miter;"
|
||||
id="path6570" />
|
||||
<path
|
||||
d="M 22.5,25 C 22.5,25 27,17.5 25.5,14.5 C 25.5,14.5 24.5,12 22.5,12 C 20.5,12 19.5,14.5 19.5,14.5 C 18,17.5 22.5,25 22.5,25"
|
||||
style="fill:#000000;fill-opacity:1; stroke-linecap:butt; stroke-linejoin:miter;" />
|
||||
<path
|
||||
d="M 11.5,37 C 17,40.5 27,40.5 32.5,37 L 32.5,30 C 32.5,30 41.5,25.5 38.5,19.5 C 34.5,13 25,16 22.5,23.5 L 22.5,27 L 22.5,23.5 C 19,16 9.5,13 6.5,19.5 C 3.5,25.5 11.5,29.5 11.5,29.5 L 11.5,37 z "
|
||||
style="fill:#000000; stroke:#000000;" />
|
||||
<path
|
||||
d="M 20,8 L 25,8"
|
||||
style="fill:none; stroke:#000000; stroke-linejoin:miter;" />
|
||||
<path
|
||||
d="M 32,29.5 C 32,29.5 40.5,25.5 38.03,19.85 C 34.15,14 25,18 22.5,24.5 L 22.51,26.6 L 22.5,24.5 C 20,18 9.906,14 6.997,19.85 C 4.5,25.5 11.85,28.85 11.85,28.85"
|
||||
style="fill:none; stroke:#ffffff;" />
|
||||
<path
|
||||
d="M 11.5,30 C 17,27 27,27 32.5,30 M 11.5,33.5 C 17,30.5 27,30.5 32.5,33.5 M 11.5,37 C 17,34 27,34 32.5,37"
|
||||
style="fill:none; stroke:#ffffff;" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="45">
|
||||
<g style="fill:none; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">
|
||||
<path
|
||||
d="M 22.5,11.63 L 22.5,6"
|
||||
style="fill:none; stroke:#000000; stroke-linejoin:miter;" />
|
||||
<path
|
||||
d="M 20,8 L 25,8"
|
||||
style="fill:none; stroke:#000000; stroke-linejoin:miter;" />
|
||||
<path
|
||||
d="M 22.5,25 C 22.5,25 27,17.5 25.5,14.5 C 25.5,14.5 24.5,12 22.5,12 C 20.5,12 19.5,14.5 19.5,14.5 C 18,17.5 22.5,25 22.5,25"
|
||||
style="fill:#ffffff; stroke:#000000; stroke-linecap:butt; stroke-linejoin:miter;" />
|
||||
<path
|
||||
d="M 11.5,37 C 17,40.5 27,40.5 32.5,37 L 32.5,30 C 32.5,30 41.5,25.5 38.5,19.5 C 34.5,13 25,16 22.5,23.5 L 22.5,27 L 22.5,23.5 C 19,16 9.5,13 6.5,19.5 C 3.5,25.5 11.5,29.5 11.5,29.5 L 11.5,37 z "
|
||||
style="fill:#ffffff; stroke:#000000;" />
|
||||
<path
|
||||
d="M 11.5,30 C 17,27 27,27 32.5,30"
|
||||
style="fill:none; stroke:#000000;" />
|
||||
<path
|
||||
d="M 11.5,33.5 C 17,30.5 27,30.5 32.5,33.5"
|
||||
style="fill:none; stroke:#000000;" />
|
||||
<path
|
||||
d="M 11.5,37 C 17,34 27,34 32.5,37"
|
||||
style="fill:none; stroke:#000000;" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="45">
|
||||
<g style="opacity:1; fill:none; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">
|
||||
<path
|
||||
d="M 22,10 C 32.5,11 38.5,18 38,39 L 15,39 C 15,30 25,32.5 23,18"
|
||||
style="fill:#000000; stroke:#000000;" />
|
||||
<path
|
||||
d="M 24,18 C 24.38,20.91 18.45,25.37 16,27 C 13,29 13.18,31.34 11,31 C 9.958,30.06 12.41,27.96 11,28 C 10,28 11.19,29.23 10,30 C 9,30 5.997,31 6,26 C 6,24 12,14 12,14 C 12,14 13.89,12.1 14,10.5 C 13.27,9.506 13.5,8.5 13.5,7.5 C 14.5,6.5 16.5,10 16.5,10 L 18.5,10 C 18.5,10 19.28,8.008 21,7 C 22,7 22,10 22,10"
|
||||
style="fill:#000000; stroke:#000000;" />
|
||||
<path
|
||||
d="M 9.5 25.5 A 0.5 0.5 0 1 1 8.5,25.5 A 0.5 0.5 0 1 1 9.5 25.5 z"
|
||||
style="fill:#ffffff; stroke:#ffffff;" />
|
||||
<path
|
||||
d="M 15 15.5 A 0.5 1.5 0 1 1 14,15.5 A 0.5 1.5 0 1 1 15 15.5 z"
|
||||
transform="matrix(0.866,0.5,-0.5,0.866,9.693,-5.173)"
|
||||
style="fill:#ffffff; stroke:#ffffff;" />
|
||||
<path
|
||||
d="M 24.55,10.4 L 24.1,11.85 L 24.6,12 C 27.75,13 30.25,14.49 32.5,18.75 C 34.75,23.01 35.75,29.06 35.25,39 L 35.2,39.5 L 37.45,39.5 L 37.5,39 C 38,28.94 36.62,22.15 34.25,17.66 C 31.88,13.17 28.46,11.02 25.06,10.5 L 24.55,10.4 z "
|
||||
style="fill:#ffffff; stroke:none;" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
|
|
@ -0,0 +1,75 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
width="45"
|
||||
height="45"
|
||||
id="svg12"
|
||||
sodipodi:docname="Chess_nlt45.svg"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)">
|
||||
<metadata
|
||||
id="metadata18">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs16" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="846"
|
||||
inkscape:window-height="480"
|
||||
id="namedview14"
|
||||
showgrid="false"
|
||||
inkscape:zoom="5.2444444"
|
||||
inkscape:cx="19.330131"
|
||||
inkscape:cy="22.5"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg12" />
|
||||
<g
|
||||
style="opacity:1;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="g10"
|
||||
transform="matrix(-1,0,0,1,44.029252,0)">
|
||||
<path
|
||||
d="m 22,10 c 10.5,1 16.5,8 16,29 H 15 c 0,-9 10,-6.5 8,-21"
|
||||
style="fill:#ffffff;stroke:#000000"
|
||||
id="path2"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
d="m 24,18 c 0.38,2.91 -5.55,7.37 -8,9 -3,2 -2.82,4.34 -5,4 -1.042,-0.94 1.41,-3.04 0,-3 -1,0 0.19,1.23 -1,2 -1,0 -4.003,1 -4,-4 0,-2 6,-12 6,-12 0,0 1.89,-1.9 2,-3.5 -0.73,-0.994 -0.5,-2 -0.5,-3 1,-1 3,2.5 3,2.5 h 2 c 0,0 0.78,-1.992 2.5,-3 1,0 1,3 1,3"
|
||||
style="fill:#ffffff;stroke:#000000"
|
||||
id="path4"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
d="m 9.5,25.5 a 0.5,0.5 0 1 1 -1,0 0.5,0.5 0 1 1 1,0 z"
|
||||
style="fill:#000000;stroke:#000000"
|
||||
id="path6"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
d="m 15,15.5 a 0.5,1.5 0 1 1 -1,0 0.5,1.5 0 1 1 1,0 z"
|
||||
transform="matrix(0.866,0.5,-0.5,0.866,9.693,-5.173)"
|
||||
style="fill:#000000;stroke:#000000"
|
||||
id="path8"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.6 KiB |
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="45">
|
||||
<path
|
||||
d="M 22,9 C 19.79,9 18,10.79 18,13 C 18,13.89 18.29,14.71 18.78,15.38 C 16.83,16.5 15.5,18.59 15.5,21 C 15.5,23.03 16.44,24.84 17.91,26.03 C 14.91,27.09 10.5,31.58 10.5,39.5 L 33.5,39.5 C 33.5,31.58 29.09,27.09 26.09,26.03 C 27.56,24.84 28.5,23.03 28.5,21 C 28.5,18.59 27.17,16.5 25.22,15.38 C 25.71,14.71 26,13.89 26,13 C 26,10.79 24.21,9 22,9 z "
|
||||
style="opacity:1; fill:#000000; fill-opacity:1; fill-rule:nonzero; stroke:#000000; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:miter; stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 816 B |
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="45">
|
||||
<path
|
||||
d="M 22,9 C 19.79,9 18,10.79 18,13 C 18,13.89 18.29,14.71 18.78,15.38 C 16.83,16.5 15.5,18.59 15.5,21 C 15.5,23.03 16.44,24.84 17.91,26.03 C 14.91,27.09 10.5,31.58 10.5,39.5 L 33.5,39.5 C 33.5,31.58 29.09,27.09 26.09,26.03 C 27.56,24.84 28.5,23.03 28.5,21 C 28.5,18.59 27.17,16.5 25.22,15.38 C 25.71,14.71 26,13.89 26,13 C 26,10.79 24.21,9 22,9 z "
|
||||
style="opacity:1; fill:#ffffff; fill-opacity:1; fill-rule:nonzero; stroke:#000000; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:miter; stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 816 B |
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="45">
|
||||
<g style="opacity:1; fill:000000; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">
|
||||
<g style="fill:#000000; stroke:none;">
|
||||
<circle cx="6" cy="12" r="2.75" />
|
||||
<circle cx="14" cy="9" r="2.75" />
|
||||
<circle cx="22.5" cy="8" r="2.75" />
|
||||
<circle cx="31" cy="9" r="2.75" />
|
||||
<circle cx="39" cy="12" r="2.75" />
|
||||
</g>
|
||||
<path
|
||||
d="M 9,26 C 17.5,24.5 30,24.5 36,26 L 38.5,13.5 L 31,25 L 30.7,10.9 L 25.5,24.5 L 22.5,10 L 19.5,24.5 L 14.3,10.9 L 14,25 L 6.5,13.5 L 9,26 z"
|
||||
style="stroke-linecap:butt; stroke:#000000;" />
|
||||
<path
|
||||
d="M 9,26 C 9,28 10.5,28 11.5,30 C 12.5,31.5 12.5,31 12,33.5 C 10.5,34.5 10.5,36 10.5,36 C 9,37.5 11,38.5 11,38.5 C 17.5,39.5 27.5,39.5 34,38.5 C 34,38.5 35.5,37.5 34,36 C 34,36 34.5,34.5 33,33.5 C 32.5,31 32.5,31.5 33.5,30 C 34.5,28 36,28 36,26 C 27.5,24.5 17.5,24.5 9,26 z"
|
||||
style="stroke-linecap:butt;" />
|
||||
<path
|
||||
d="M 11,38.5 A 35,35 1 0 0 34,38.5"
|
||||
style="fill:none; stroke:#000000; stroke-linecap:butt;" />
|
||||
<path
|
||||
d="M 11,29 A 35,35 1 0 1 34,29"
|
||||
style="fill:none; stroke:#ffffff;" />
|
||||
<path
|
||||
d="M 12.5,31.5 L 32.5,31.5"
|
||||
style="fill:none; stroke:#ffffff;" />
|
||||
<path
|
||||
d="M 11.5,34.5 A 35,35 1 0 0 33.5,34.5"
|
||||
style="fill:none; stroke:#ffffff;" />
|
||||
<path
|
||||
d="M 10.5,37.5 A 35,35 1 0 0 34.5,37.5"
|
||||
style="fill:none; stroke:#ffffff;" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="45">
|
||||
<g style="opacity:1; fill:#ffffff; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">
|
||||
<path
|
||||
d="M 9 13 A 2 2 0 1 1 5,13 A 2 2 0 1 1 9 13 z"
|
||||
transform="translate(-1,-1)" />
|
||||
<path
|
||||
d="M 9 13 A 2 2 0 1 1 5,13 A 2 2 0 1 1 9 13 z"
|
||||
transform="translate(15.5,-5.5)" />
|
||||
<path
|
||||
d="M 9 13 A 2 2 0 1 1 5,13 A 2 2 0 1 1 9 13 z"
|
||||
transform="translate(32,-1)" />
|
||||
<path
|
||||
d="M 9 13 A 2 2 0 1 1 5,13 A 2 2 0 1 1 9 13 z"
|
||||
transform="translate(7,-4.5)" />
|
||||
<path
|
||||
d="M 9 13 A 2 2 0 1 1 5,13 A 2 2 0 1 1 9 13 z"
|
||||
transform="translate(24,-4)" />
|
||||
<path
|
||||
d="M 9,26 C 17.5,24.5 30,24.5 36,26 L 38,14 L 31,25 L 31,11 L 25.5,24.5 L 22.5,9.5 L 19.5,24.5 L 14,10.5 L 14,25 L 7,14 L 9,26 z "
|
||||
style="stroke-linecap:butt;" />
|
||||
<path
|
||||
d="M 9,26 C 9,28 10.5,28 11.5,30 C 12.5,31.5 12.5,31 12,33.5 C 10.5,34.5 10.5,36 10.5,36 C 9,37.5 11,38.5 11,38.5 C 17.5,39.5 27.5,39.5 34,38.5 C 34,38.5 35.5,37.5 34,36 C 34,36 34.5,34.5 33,33.5 C 32.5,31 32.5,31.5 33.5,30 C 34.5,28 36,28 36,26 C 27.5,24.5 17.5,24.5 9,26 z "
|
||||
style="stroke-linecap:butt;" />
|
||||
<path
|
||||
d="M 11.5,30 C 15,29 30,29 33.5,30"
|
||||
style="fill:none;" />
|
||||
<path
|
||||
d="M 12,33.5 C 18,32.5 27,32.5 33,33.5"
|
||||
style="fill:none;" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="45">
|
||||
<g style="opacity:1; fill:000000; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">
|
||||
<path
|
||||
d="M 9,39 L 36,39 L 36,36 L 9,36 L 9,39 z "
|
||||
style="stroke-linecap:butt;" />
|
||||
<path
|
||||
d="M 12.5,32 L 14,29.5 L 31,29.5 L 32.5,32 L 12.5,32 z "
|
||||
style="stroke-linecap:butt;" />
|
||||
<path
|
||||
d="M 12,36 L 12,32 L 33,32 L 33,36 L 12,36 z "
|
||||
style="stroke-linecap:butt;" />
|
||||
<path
|
||||
d="M 14,29.5 L 14,16.5 L 31,16.5 L 31,29.5 L 14,29.5 z "
|
||||
style="stroke-linecap:butt;stroke-linejoin:miter;" />
|
||||
<path
|
||||
d="M 14,16.5 L 11,14 L 34,14 L 31,16.5 L 14,16.5 z "
|
||||
style="stroke-linecap:butt;" />
|
||||
<path
|
||||
d="M 11,14 L 11,9 L 15,9 L 15,11 L 20,11 L 20,9 L 25,9 L 25,11 L 30,11 L 30,9 L 34,9 L 34,14 L 11,14 z "
|
||||
style="stroke-linecap:butt;" />
|
||||
<path
|
||||
d="M 12,35.5 L 33,35.5 L 33,35.5"
|
||||
style="fill:none; stroke:#ffffff; stroke-width:1; stroke-linejoin:miter;" />
|
||||
<path
|
||||
d="M 13,31.5 L 32,31.5"
|
||||
style="fill:none; stroke:#ffffff; stroke-width:1; stroke-linejoin:miter;" />
|
||||
<path
|
||||
d="M 14,29.5 L 31,29.5"
|
||||
style="fill:none; stroke:#ffffff; stroke-width:1; stroke-linejoin:miter;" />
|
||||
<path
|
||||
d="M 14,16.5 L 31,16.5"
|
||||
style="fill:none; stroke:#ffffff; stroke-width:1; stroke-linejoin:miter;" />
|
||||
<path
|
||||
d="M 11,14 L 34,14"
|
||||
style="fill:none; stroke:#ffffff; stroke-width:1; stroke-linejoin:miter;" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="45">
|
||||
<g style="opacity:1; fill:#ffffff; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">
|
||||
<path
|
||||
d="M 9,39 L 36,39 L 36,36 L 9,36 L 9,39 z "
|
||||
style="stroke-linecap:butt;" />
|
||||
<path
|
||||
d="M 12,36 L 12,32 L 33,32 L 33,36 L 12,36 z "
|
||||
style="stroke-linecap:butt;" />
|
||||
<path
|
||||
d="M 11,14 L 11,9 L 15,9 L 15,11 L 20,11 L 20,9 L 25,9 L 25,11 L 30,11 L 30,9 L 34,9 L 34,14"
|
||||
style="stroke-linecap:butt;" />
|
||||
<path
|
||||
d="M 34,14 L 31,17 L 14,17 L 11,14" />
|
||||
<path
|
||||
d="M 31,17 L 31,29.5 L 14,29.5 L 14,17"
|
||||
style="stroke-linecap:butt; stroke-linejoin:miter;" />
|
||||
<path
|
||||
d="M 31,29.5 L 32.5,32 L 12.5,32 L 14,29.5" />
|
||||
<path
|
||||
d="M 11,14 L 34,14"
|
||||
style="fill:none; stroke:#000000; stroke-linejoin:miter;" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
|
@ -0,0 +1,54 @@
|
|||
<html>
|
||||
<body>
|
||||
<h1>Todo</h1>
|
||||
|
||||
<form id="sign">
|
||||
<input id="alias" placeholder="username">
|
||||
<input id="pass" type="password" placeholder="passphrase">
|
||||
<input id="in" type="submit" value="sign in">
|
||||
<input id="up" type="button" value="sign up">
|
||||
</form>
|
||||
|
||||
<ul></ul>
|
||||
|
||||
<form id="said">
|
||||
<input id="say">
|
||||
<input id="speak" type="submit" value="speak">
|
||||
</form>
|
||||
|
||||
<script src="js/jquery.js"></script>
|
||||
<script src="js/gun.js"></script>
|
||||
<script src="js/sea.js"></script>
|
||||
<script src="js/webrtc.js"></script>
|
||||
<script>
|
||||
var gun = Gun(['https://jessemcdonald.info/gun']);
|
||||
var user = gun.user();
|
||||
|
||||
$('#up').on('click', function(e){
|
||||
user.create($('#alias').val(), $('#pass').val());
|
||||
});
|
||||
|
||||
$('#sign').on('submit', function(e){
|
||||
e.preventDefault();
|
||||
user.auth($('#alias').val(), $('#pass').val());
|
||||
});
|
||||
|
||||
$('#said').on('submit', function(e){
|
||||
e.preventDefault();
|
||||
if(!user.is){ return }
|
||||
user.get('said').set($('#say').val());
|
||||
$('#say').val("");
|
||||
});
|
||||
|
||||
function UI(say, id){
|
||||
var li = $('#' + id).get(0) || $('<li>').attr('id', id).appendTo('ul');
|
||||
$(li).text(say);
|
||||
};
|
||||
|
||||
gun.on('auth', function(){
|
||||
$('#sign').hide();
|
||||
user.get('said').map().once(UI);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||