Compare commits

..

No commits in common. "master" and "v0.8.0" have entirely different histories.

8 changed files with 5725 additions and 17613 deletions

View File

@ -207,33 +207,6 @@ button#settings, button#cb_choose_game {
color: grey;
}
#cb_times {
display: flex;
flex-flow: row nowrap;
white-space: nowrap;
justify-content: stretch;
align-items: flex-end;
width: 100%;
padding-left: 3rem;
padding-right: 3rem;
}
#cb_times.cb-hide-times {
visibility: hidden;
}
#cb_light_time, #cb_dark_time {
width: 100%;
}
#cb_light_time {
text-align: left;
}
#cb_dark_time {
text-align: right;
}
#cb_names {
position: relative;
display: flex;
@ -271,16 +244,6 @@ button#settings, button#cb_choose_game {
height: 3rem;
}
#cb_names.cb-light-turn::before {
filter: drop-shadow(0 0 5px blue);
-webkit-filter: drop-shadow(0 0 5px blue);
}
#cb_names.cb-light-won::before {
filter: drop-shadow(0 0 5px darkviolet);
-webkit-filter: drop-shadow(0 0 5px darkviolet);
}
#cb_names::after {
content: '';
display: block;
@ -294,16 +257,6 @@ button#settings, button#cb_choose_game {
height: 3rem;
}
#cb_names.cb-dark-turn::after {
filter: drop-shadow(0 0 5px blue);
-webkit-filter: drop-shadow(0 0 5px blue);
}
#cb_names.cb-dark-won::after {
filter: drop-shadow(0 0 5px darkviolet);
-webkit-filter: drop-shadow(0 0 5px darkviolet);
}
#cb_names .cb-names-vs {
padding-left: 0.25em;
padding-right: 0.25em;
@ -559,10 +512,6 @@ div.hbox {
color: blue;
}
.jBox-wrapper.jBox-hasTitle > .jBox-container {
padding: 4px; /* same as border-radius */
}
.jBox-title h2 {
margin: 0;
}
@ -609,13 +558,10 @@ div.hbox {
}
.game-tiles {
width: calc(100vw - 6rem);
max-width: calc(100vw - 6rem);
max-height: calc(100vh - 12rem);
display: grid;
grid-template-columns: repeat(auto-fill, minmax(15em, auto));
align-items: center;
justify-items: center;
max-width: 80vw;
max-height: 80vh;
overflow-y: auto;
text-align: center;
}
.game-tiles > * {
@ -624,14 +570,14 @@ div.hbox {
.game-tile {
position: relative;
display: flex;
display: inline-flex;
flex-flow: column nowrap;
justify-content: center;
align-items: center;
width: 14em;
height: 14em;
box-shadow: 0 0 0 1px black, 5px 5px 3px #00000080;
margin: 0.5em;
margin: 1em;
padding: 0.5em;
border-radius: 6pt;
background-color: #FFFFF0;
@ -664,7 +610,6 @@ div.hbox {
font-size: 3em;
text-shadow: 2px 2px 4px #000000c0;
font-weight: bold;
text-align: center;
}
.new-game-text::before {
@ -787,19 +732,19 @@ div.hbox {
margin-top: 0.5em;
}
.game-tiles {
font-size: calc(12in * 0.014);
.game-tile {
font-size: calc(12in * 0.015);
}
@media only screen and (min-width: 6in) and (max-width: 12in) {
.game-tiles {
font-size: 1.4vw;
.game-tile {
font-size: 1.5vw;
}
}
@media only screen and (max-width: 6in) {
.game-tiles {
font-size: calc(6in * 0.014);
.game-tile {
font-size: calc(6in * 0.015);
}
}

View File

@ -1,4 +1,3 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
@ -168,10 +167,6 @@
<input id="cb_dark_name" autocomplete="off" placeholder="Dark">
</div>
</div>
<div id="cb_times" class="cb-hide-if-private">
<div id="cb_light_time">0:00:00</div>
<div id="cb_dark_time">0:00:00</div>
</div>
<div id="cb_navigate">
<button id="cb_undo" title="Undo" type="button" disabled="true"><span class="fas fa-undo"></span></button>
<button id="cb_redo" title="Redo" type="button" disabled="true"><span class="fas fa-redo"></span></button>

View File

@ -1,6 +1,5 @@
import './css/chess.css';
import './css/theme/pacosako.css';
import './css/theme/traditional.css';
import '@fortawesome/fontawesome-free/css/fontawesome.css';
import '@fortawesome/fontawesome-free/css/solid.css';

View File

@ -370,9 +370,9 @@ function startMetaPoll(afterTime) {
const thisRequest = meta.currentRequest = $.ajax({
dataType: 'json',
contentType: 'application/json',
url: `${API_BASE}/games${(afterTime === undefined) ? '' : `/poll/${afterTime}`}`,
url: `${API_BASE}/games${!afterTime ? '' : `/poll/${afterTime}`}`,
cache: false,
timeout: (afterTime === undefined) ? SHORT_TIMEOUT : LONG_TIMEOUT,
timeout: afterTime ? LONG_TIMEOUT : SHORT_TIMEOUT,
}).done((data, textStatus, jqXHR) => {
if (meta.currentRequest === thisRequest) {
meta.currentRequest = null;

View File

@ -8,7 +8,7 @@ import deepEqual from 'deep-equal';
import 'webpack-jquery-ui/draggable';
import 'webpack-jquery-ui/droppable';
import 'webpack-jquery-ui/selectmenu';
import 'webpack-jquery-ui/clip-effect';
import 'webpack-jquery-ui/fold-effect';
import 'webpack-jquery-ui/css';
import 'jquery-ui-touch-punch';
@ -25,7 +25,6 @@ ElementQueries.listen();
import {Buffer} from 'buffer';
import pako from 'pako';
import {sprintf} from 'sprintf-js';
/* "Waterdrop" by Porphyr (freesound.org/people/Porphyr) / CC BY 3.0 (creativecommons.org/licenses/by/3.0) */
import Waterdrop from '../mp3/191678__porphyr__waterdrop.mp3';
@ -255,81 +254,6 @@ $(function (){
return piece;
}
function updatePlayerTimes() {
let lightTime = 0;
let darkTime = 0;
let moveStartTime = undefined;
for (const move of visibleGame.moves) {
if (!move.meta || !Number.isInteger(move.meta.timestamp)) {
lightTime = darkTime = undefined;
break;
}
if (move.replaced) {
/* not the final move in the chain */
continue;
}
/* start counting when the dark player finishes their first move */
if (moveStartTime === undefined) {
if (move.side === PS.DARK) {
moveStartTime = move.meta.timestamp;
} else {
continue;
}
}
const moveTime = move.meta.timestamp - moveStartTime;
if (moveTime > 0) {
if (move.side === PS.LIGHT) {
lightTime += moveTime;
} else {
darkTime += moveTime;
}
}
moveStartTime = move.meta.timestamp;
}
if (moveStartTime === undefined) {
$('#cb_light_time, #cb_dark_time').text('0:00:00');
$('#cb_times').addClass('cb-hide-times');
return;
}
if (visibleGame.status === PS.PLAYING) {
if (!visibleGame.canRedo) {
const currentMoveTime = +new Date() - moveStartTime;
if (currentMoveTime > 0) {
if (visibleGame.player === PS.LIGHT) {
lightTime += currentMoveTime;
} else {
darkTime += currentMoveTime;
}
}
}
}
$('#cb_times').removeClass('cb-hide-times');
function formatTime(milliseconds) {
let seconds = milliseconds / 1000;
const hours = seconds / 3600;
seconds %= 3600;
const minutes = seconds / 60;
seconds %= 60;
return sprintf('%d:%02d:%02d', hours, minutes, seconds);
}
$('#cb_light_time').text(formatTime(lightTime));
$('#cb_dark_time').text(formatTime(darkTime));
}
setInterval(() => { updatePlayerTimes(); }, 250);
function renderBoard(animate) {
$('#cb_board').removeData('dragging_from');
$('#cb_board .cb-piece').remove();
@ -340,8 +264,6 @@ $(function (){
$('#cb_board .cb-end').removeClass('cb-end');
$('#cb_board .cb-legal').removeClass('cb-legal');
$('#cb_explain_check').text('');
$('#cb_names').removeClass('cb-light-turn').removeClass('cb-dark-turn');
$('#cb_names').removeClass('cb-light-won').removeClass('cb-dark-won');
$('#cb_phantom').remove();
const game = visibleGame;
@ -467,20 +389,6 @@ $(function (){
} else {
$('#cb_board').removeClass('cb-live').addClass('cb-archive');
}
if (game.status === PS.PLAYING) {
if (game.player === PS.LIGHT) {
$('#cb_names').addClass('cb-light-turn');
} else {
$('#cb_names').addClass('cb-dark-turn');
}
} else if (game.winner === PS.LIGHT) {
$('#cb_names').addClass('cb-light-won');
} else if (game.winner === PS.DARK) {
$('#cb_names').addClass('cb-dark-won');
}
updatePlayerTimes();
}
function applyTheme(theme) {
@ -780,8 +688,6 @@ $(function (){
$('#cb_dark_name').val(String(d.darkName || ''));
$('#cb_board').data('modified', data.modified);
updateSelectGameMeta(data, newId);
}
});
});
@ -1238,7 +1144,6 @@ $(function (){
var selectBoxIntervalID = undefined;
var selectBox = new jBox('Modal', {
title: '<h2>Recent Games</h2>',
content: gameSelectContent,
blockScroll: false,
blockScrollAdjust: false,
@ -1308,6 +1213,11 @@ $(function (){
}
function updateSelectGameMeta(data, gameId) {
data = Object.assign({}, data, {
gameId: gameId || data.gameId,
timestamp: data.timestamp || +new Date(),
});
if (typeof gameId !== 'string' || !gameId.match(/^[0-9a-f]{16}$/)) {
debug('invalid game ID', gameId);
return;
@ -1317,11 +1227,10 @@ $(function (){
const oldTile = $('#game_tile_' + gameId).first();
if (!data.lightName && !data.darkName && !data.moves && gameId !== currentGameId) {
if (oldTile.length >= 1) {
oldTile.removeAttr('id');
if (oldTile.length >= 1) {
oldTile.hide({
effect: "clip",
direction: "horizontal",
effect: "fold",
complete() {
oldTile.remove();
},
@ -1330,13 +1239,6 @@ $(function (){
return;
}
if (oldTile.length && data.modified && oldTile.data('gameMeta').modified >= data.modified) {
return;
}
data = Object.assign({ gameId, timestamp: +new Date(), modified: 0 }, data);
delete data.board;
const tile = oldTile.length ? oldTile :
$(`<div class="game-tile existing-game-tile"></div>`).hide();
tile.attr('id', 'game_tile_' + gameId).data('gameMeta', data).empty();
@ -1386,10 +1288,7 @@ $(function (){
$(list).appendTo(gameTiles);
updateTileAges();
tile.show({
effect: "clip",
direction: "horizontal",
});
tile.show("fold");
selectBox.setContent(gameSelectContent);
}
@ -1527,7 +1426,6 @@ $(function (){
$('#header').appendTo('#board_ui');
$('#cb_status').appendTo('#board_ui');
$('#cb_names').appendTo('#board_ui');
$('#cb_times').appendTo('#board_ui');
$('#cb_navigate').appendTo('#board_ui');
$('#board_ui').appendTo('#page');
$('#page').removeClass('vertical-layout').addClass('horizontal-layout');
@ -1536,7 +1434,6 @@ $(function (){
$('#cb_container').appendTo('#board_ui');
$('#cb_status').appendTo('#board_ui');
$('#cb_names').appendTo('#board_ui');
$('#cb_times').appendTo('#board_ui');
$('#cb_navigate').appendTo('#board_ui');
$('#board_ui').appendTo('#page');
$('#page').removeClass('horizontal-layout').addClass('vertical-layout');

23038
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "paco-sako",
"version": "0.8.7",
"version": "0.8.0",
"description": "Online version of the Paco Ŝako chess variation",
"keywords": [
"game",
@ -32,34 +32,31 @@
},
"devDependencies": {
"@fortawesome/fontawesome-free": "^5.13.0",
"buffer": "^6.0.3",
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^6.4.1",
"buffer": "^4.9.2",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^5.1.1",
"css-element-queries": "^1.2.3",
"deep-equal": "git+https://jessemcdonald.info/gogs/nybble/node-deep-equal",
"extract-loader": "^5.0.1",
"html-webpack-plugin": "^4.5.2",
"html-webpack-plugin": "^4.3.0",
"jbox": "^1.2.0",
"jquery-ui-touch-punch": "^0.2.3",
"lodash": "^4.17.15",
"mini-css-extract-plugin": "^1.6.2",
"optimize-css-assets-webpack-plugin": "^6.0.1",
"pako": "^2.0.4",
"sprintf-js": "^1.0.3",
"svgo": "^2.7.0",
"svgo-loader": "^3.0.0",
"webpack": "^4.46.0",
"webpack-cli": "^4.8.0",
"mini-css-extract-plugin": "^0.9.0",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"pako": "^1.0.11",
"svgo": "^1.3.2",
"svgo-loader": "^2.2.1",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"webpack-jquery-ui": "^2.0.1",
"workbox-precaching": "^6.3.0",
"workbox-routing": "^6.3.0",
"workbox-strategies": "^6.3.0",
"workbox-webpack-plugin": "^6.3.0",
"workbox-window": "^6.3.0"
},
"dependencies": {
"paco-sako-server": "git+https://jessemcdonald.info/gogs/nybble/paco_sako_server"
"workbox-precaching": "^5.1.3",
"workbox-routing": "^5.1.3",
"workbox-strategies": "^5.1.3",
"workbox-webpack-plugin": "^5.1.3",
"workbox-window": "^5.1.3"
},
"dependencies": {},
"optionalDependencies": {
"paco-sako-server": "git+https://jessemcdonald.info/gogs/nybble/paco_sako_server"
},

View File

@ -52,14 +52,7 @@ module.exports = {
loader: "svgo-loader",
options: {
plugins: [
{
name: "preset-default",
params: {
overrides: {
cleanupIDs: false,
}
}
},
{ cleanupIDs: false }
]
}
}
@ -95,11 +88,9 @@ module.exports = {
"window.jQuery": "jquery'",
"window.$": "jquery"
}),
new CopyPlugin({
patterns: [
new CopyPlugin([
{ from: '.htaccess' },
],
}),
]),
new InjectManifest({
swSrc: './sw.js',
dontCacheBustURLsMatching: /\.[0-9a-f]{16,}\.\w{2,4}$/,