User:קיפודנחש/pgn viewer demo

__NEWSECTIONLINK__

This is a simulation for chess-related article

to view it, please add to your your personal JS page the following line:

The tournament
Everything You Always Wanted to Know About Chess, But Were Afraid to Ask

The games
Below are the games of all the rounds in the tournament.

Viewer Demo: First Round: January 12, 2013
showing the viewer with square size of 30 (default is 45), and, to display the "hide" button, and   (the default is 45).
 * Please select a game:


 * below is the wikicode to create the viewer above. the actual "pgn" passed as parameters 1-7

the pgn data is practically taken "as is" from one of the many chess databases, such as chessgames (i do not know what database did the editor use - there's no difference). the PGN itself (sans commentary) is not copyrightable. The commentary was added by an editor in hewiki.

note that some databases may contain commentary, which may be protected under copyright law, so care must be taken to ensure no copyrighted commentary is added. ideally, only comments written by WP editors should be used, if any. in the demo, the comments (in Hebrew) were added by an editor in hewiki.



Deep blue vs. Kasparov
the following is a viewer with the games copied from wikipedia article Deep Blue versus Garry Kasparov, with no change.

The article contains only the algebraic notation of the PGN - still, (almost) legal pgn [the only exception being the fact that algebraic notation allows use of zeros for castlings, i.e., 0-0 and 0-0-0 in addition to O-O and O-O-O) that the script can handle, but the lack of "metadata" in the pgn would results in empty selector text. To rectify this, a single "metadata" item, namely  was added before the Algebraic notation, so the selector shows these labels. "Naked" Algebraic notation is still perfectly acceptable when showing a single game, in which case there's no selector anyway.

note that this demo has the following parameters:,   ,  , and.

This means it will be displayed in collapsed initial state, right aligned, with the smallest allowed size (20 pixel for square height and width). Click "show" to see the viewer, and the 2nd "show" to see the wikicode.

here is the wikicode of the viewer above: 

Display single game
When displaying a single game, naturally no selector is shown:

Features

 * accepts unprocessed PGN as input
 * can display one or more games. when displaying more than one game, a game selector appears above the board
 * multiple viewers can exist on one page
 * displays the game with all the usual controls: jump to start and end, advance one step forward and back, autoplay, jump to any move (via the PGN view)
 * single move forward and autoplay are animated. jump to start/end, and backword move are not
 * display the game (aka "pgn", or "algebraic notation"). the current move is highlighted, and as the game progressed the highlighted move advances. same display can be used to "jump" to any specific position
 * can rotate the board, to show the game from the black's POV
 * user controls the autoplay speed (actually, the interval between two animated moves)
 * generates FEN, which can be used in Chess diagram
 * lightweight: the script is less than 900 lines of JS code, weighing about 25Kb, and will only load for pages that actually contain chess games. there is also a 20-lines or so of CSS - also, only loads for pages using the viewer. in addition to the script, there is a template, which is straightforward and simple, using a "helper template", which is also straightforward and simple: Template:Pgnviewer, and the helper Template:Pgnviewer/Onegame.
 * with all the pieces in place, users with no JS will see more or less stylized rendering of the PGN itself, which can be used to recreate the game using chessboard (and chess pieces...)