Extension:EmbedChessboard

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
EmbedChessboard

Release status: stable

EmbedChessboard Screenshot.png
Implementation Tag
Description show chess games in a javascript chessboard
Last version 1.55 (2012-04-27)
MediaWiki 1.15 or later
License GPL
Download pgn4web download site
Example pgn4web test site
Parameters

$wgEmbedChessboard_horizontal_layout $wgEmbedChessboard_height $wgEmbedChessboard_background_color $wgEmbedChessboard_light_squares_color $wgEmbedChessboard_dark_squares_color $wgEmbedChessboard_board_border_color $wgEmbedChessboard_square_highlight_color $wgEmbedChessboard_control_buttons_background_color $wgEmbedChessboard_control_buttons_text_color $wgEmbedChessboard_header_text_color $wgEmbedChessboard_moves_text_color $wgEmbedChessboard_move_highlight_color $wgEmbedChessboard_comments_text_color $wgEmbedChessboard_autoplay_mode

Tags
pgn

Check usage (experimental)

Contents

[edit] What can this extension do?

The EmbedChessboard extension shows chess games in a javascript chessboard on MediaWiki articles, using PGN input that includes algebraic notation.

See the pgn4web test site for an example.


[edit] Usage

To add a chessboard to a MediaWiki article, use the <pgn> tag:

<pgn parameter=value ...> 
... chess games in PGN format ...
</pgn>


Tag parameters:

  • display=horizontal|vertical
  • height=auto|number
  • showMoves=figurine|text|puzzle|hidden
  • initialGame=first|last|random|number
  • initialVariation=number
  • initialHalfmove=start|end|random|comment|number
  • autoplayMode=game|loop|none


Example:

<pgn layout=horizontal initialHalfmove=16 autoplayMode=none>

[Event "World championship"]
[Site "Moscow URS"]
[Date "1985.10.15"]
[Round "16"]
[White "Karpov"]
[Black "Kasparov"]
[Result "0-1"]

1.e4 c5 2.Nf3 e6 3.d4 cxd4 4.Nxd4 Nc6 5.Nb5 d6 6.c4 Nf6 7.N1c3 a6 8.Na3 d5
9.cxd5 exd5 10.exd5 Nb4 11.Be2 Bc5 12.O-O O-O 13.Bf3 Bf5 14.Bg5 Re8 15.Qd2
b5 16.Rad1 Nd3 17.Nab1 h6 18.Bh4 b4 19.Na4 Bd6 20.Bg3 Rc8 21.b3 g5 22.Bxd6
Qxd6 23.g3 Nd7 24.Bg2 Qf6 25.a3 a5 26.axb4 axb4 27.Qa2 Bg6 28.d6 g4 29.Qd2
Kg7 30.f3 Qxd6 31.fxg4 Qd4+ 32.Kh1 Nf6 33.Rf4 Ne4 34.Qxd3 Nf2+ 35.Rxf2
Bxd3 36.Rfd2 Qe3 37.Rxd3 Rc1 38.Nb2 Qf2 39.Nd2 Rxd1+ 40.Nxd1 Re1+ 0-1

</pgn>


[edit] Screenshot

EmbedChessboard Screenshot.png



[edit] Download instructions

Please download the extension package at the pgn4web download site.


[edit] Installation

Unzip the extension package and copy the full EmbedChessboard folder in the extensions folder of your MediaWiki installation.


To activate the extension, include following statement at the end of the MediaWiki configuration script LocalSettings.php:

require_once("$IP/extensions/EmbedChessboard/EmbedChessboard.php");


[edit] Configuration parameters

To customize chessboard colors and behaviour, at the end of the mediawiki configuration script LocalSettings.php, please set to your liking any the following parameters:

//
// EmbedChessboard customization parameters:
// set those in your LocalSettings.php to change values from defaults
//
 
// Layout
// set to 't' for horizontal layout,
// set to 'f' for vertical layout
//
$wgEmbedChessboard_horizontal_layout                = 't'; // 't'
 
// Height
// set to 'auto' for automatic calculation of the chessboard frame height
// set to a number to assign the chessboard frame height
//
$wgEmbedChessboard_height                           = 'auto'; // 'auto'
 
// Colors
// set to the hexadecimal color value (without #), such as 'FF0000' for red
//
$wgEmbedChessboard_background_color                 = 'F9F9F9'; // 'F9F9F9'
$wgEmbedChessboard_light_squares_color              = 'F9F9F9'; // 'F9F9F9'
$wgEmbedChessboard_dark_squares_color               = 'DEDEDE'; // 'DEDEDE'
$wgEmbedChessboard_board_border_color               = 'DEDEDE'; // 'DEDEDE'
$wgEmbedChessboard_square_highlight_color           = 'ABABAB'; // 'ABABAB'
$wgEmbedChessboard_control_buttons_background_color = 'F0F0F0'; // 'F0F0F0'
$wgEmbedChessboard_control_buttons_text_color       = '585858'; // '585858'
$wgEmbedChessboard_header_text_color                = '000000'; // '000000'
$wgEmbedChessboard_moves_text_color                 = '000000'; // '000000'
$wgEmbedChessboard_move_highlight_color             = 'E0E0E0'; // 'E0E0E0'
$wgEmbedChessboard_comments_text_color              = '808080'; // '808080'
 
// AutoplayMode
// set to 'l' for autoplay through games in a loop,
// set to 'g' for autoplay first game only,
// set to 'n' for no autoplay
//
$wgEmbedChessboard_autoplay_mode                    = 'l'; // 'l'
 
// ExtendedOptions
// undocumented feature, normally left blank: improper use will break the chessboard display
$wgEmbedChessboard_extended_options                 = ''; // ''
 
//
// end of EmbedChessboard customization parameters
//

Values shown above are default values applied if parameters are not set in LocalSettings.php.


[edit] See also

The EmbedChessboard extension is part of the pgn4web initiative, developing a general purpose javascript chessboard. More info at the pgn4web project site.


Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox