feat: add PGN4Web block support and integrate chess game replay features
Implemented a new PGN4Web block with a PHP snippet for game replay functionality. Updated blueprints with PGN-specific fields, modified layout and blockpage templates, and included necessary JavaScript and assets for interactive chess game rendering. Enhanced memorial page with replayable game content.
This commit is contained in:
@@ -37,4 +37,11 @@ fields:
|
||||
type: textarea
|
||||
image:
|
||||
label: Bild
|
||||
type: files
|
||||
- type: pgn4web
|
||||
label: PGN-Datei
|
||||
preview: fields
|
||||
fields:
|
||||
pgn:
|
||||
label: PGN-Datei
|
||||
type: files
|
||||
@@ -0,0 +1,35 @@
|
||||
<script>
|
||||
SetPgnUrl("<?= $block->pgn()->toFile()->url() ?>");
|
||||
SetImagePath("/assets/pgnviewer/images");
|
||||
SetImageType("png");
|
||||
SetHighlightOption(true);
|
||||
SetGameSelectorOptions(null, false, 0, 0, 0, 15, 15, 0, 10);
|
||||
SetCommentsIntoMoveText(false);
|
||||
SetCommentsOnSeparateLines(false);
|
||||
SetAutoplayDelay(1000);
|
||||
SetAutostartAutoplay(false);
|
||||
SetAutoplayNextGame(false);
|
||||
SetInitialGame(1);
|
||||
SetInitialVariation(0);
|
||||
SetInitialHalfmove(0, false);
|
||||
SetShortcutKeysEnabled(false);
|
||||
|
||||
SetLiveBroadcast(1, false, false, false, false);
|
||||
</script>
|
||||
|
||||
|
||||
<div class="gap-2 grid grid-cols-1 lg:grid lg:grid-cols-2 lg:px-8 max-w-7xl mx-auto px-4 py-8 sm:px-6 text-black">
|
||||
<div>
|
||||
<div class="w-full" id="GameBoard"></div>
|
||||
<div class="hover:cursor-pointer" id="GameButtons"></div>
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
<div id="GameEvent" class="text-2xl py-2"></div>
|
||||
<div id="GameWhite" class="text-xl pt-2"></div>
|
||||
<div id="GameBlack" class="text-xl"></div>
|
||||
<div id="GameResult" class="text-xl"></div>
|
||||
</div>
|
||||
<div id="GameText" class="py-2"></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -11,6 +11,10 @@
|
||||
'assets/css/chess.css'
|
||||
]) ?>
|
||||
|
||||
<?= js([
|
||||
'assets/js/pgn4web.js'
|
||||
]) ?>
|
||||
|
||||
<link rel="shortcut icon" type="image/x-icon"
|
||||
href="<?= url('assets/favicon.ico') ?>">
|
||||
</head>
|
||||
|
||||
@@ -20,13 +20,12 @@ function fenToBoard($fen) {
|
||||
}
|
||||
|
||||
return $board;
|
||||
} ?>
|
||||
|
||||
}?>
|
||||
|
||||
<?php
|
||||
snippet('layout', slots: true) ?>
|
||||
|
||||
<?= $page->blocks()->toBlocks() ?>
|
||||
<?= $page->blocks()->toBlocks() ?>
|
||||
|
||||
<?php
|
||||
endsnippet() ?>
|
||||
endsnippet() ?>
|
||||
Reference in New Issue
Block a user