Saturday, 31 October 2009

How to configure the chess game viewer?

This post explains how you can adapt your template in order to use the Chess Game Viewer, but first configure and try the FEN-viewer.

If the FEN-viewer is working fine we start to configure the chess game viewer.
Go to Layout » Edit html
and make a backup of your template

Then find something like
]]></b:skin>
</head>
<body>
We are going to add some lines above and below this, but also adding an onLoad statement to the body tag.
#pc1 {position:absolute; visibility:hidden; cursor:hand;}
.qzs {position:relative; visibility:hidden;}

]]></b:skin>
</head>
<body onLoad='InitSys();'>
<div id='pc1' onClick='DropPc(cg)'>
<img name='dpc'
src='http://sites.google.com/site/viewchessgame/pcs/i.gif'/>
</div>
And (after saving your template) the configuration part is finished.



Let's try it by adding the following code to a post.
<SCRIPT language='JavaScript' 
type='text/javascript'>
Game('rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR 1',
'sc@@K[@@z^@@@Q@@|a@@ET@@^L@A',
'1.e4 e5 2.Qh5 Nc6 3.Bc4 Nf6 4.Qxf7# 1-0',
1,6);</SCRIPT>


This is the Scholar's Mate.

The arguments for the Game function are similar to the Fen2Page function. At the moment we still have to add the coded moves (that can be copied from the file generated by Palview). The last optional argument indicates the initial position that has to be shown, because the starting position of the chess board isn't very informative.

No comments:

Post a Comment