jwinslow
01 Jul 2010, 10:12 AM
Hey all, I have the old Yahoo! chess engine and Im making a webpage with a chessboard. Currently everything involved with this chessboard is wrapped up inside the code and dynamically creates everything it needs to operate.
I have made a few customizations on several elements such as the PHP dropdown box that it dynamically creates as a quickjump to games. But i am wondering if someone wouldn't mind helping me in finding a way to write an amendment that reads 3 parts of the pgn file (Black)(Result)(White) (which it already does read them but just shows the info in the dropdown box) and display them as a header to the board.
Everything in this script as far as variables go, are numbers... which makes it difficult at best which makes visual mapping harder. So I thought I would ask a professional what I should be looking for in the script so that I can go ahead and modify it and reuse some functionality to display a game header from javascript.
The pgn viewer will read either string format directly input into the setup configuration in the html page, or it will read from a file. It them parses the elements based on the pgn tags.
var tag=this.parseTag("FEN",pgn,i);
if(tag&&tag!="?"){
this.board.startFen=tag;
}else{
tag=this.parseTag("White",pgn,i);
if(tag&&tag!="?"){
_68=tag;
}else{
tag=this.parseTag("Black",pgn,i);
if(tag&&tag!="?"){
_63=tag;
}else{
tag=this.parseTag("Result",pgn,i);
if(tag&&tag!="?"){
_62=tag;
}else{
tag=this.parseTag("Event",pgn,i);
if(tag&&tag!="?"){
_64=tag;
}else{
tag=this.parseTag("Site",pgn,i);
if(tag&&tag!="?"){
_65=tag;
}else{
tag=this.parseTag("Date",pgn,i);
if(tag&&tag!="?"){
_66=tag;
So the variables I want to use are _68, _63, & _62 and display them as a header to the board. Any help is appreciated.
I have made a few customizations on several elements such as the PHP dropdown box that it dynamically creates as a quickjump to games. But i am wondering if someone wouldn't mind helping me in finding a way to write an amendment that reads 3 parts of the pgn file (Black)(Result)(White) (which it already does read them but just shows the info in the dropdown box) and display them as a header to the board.
Everything in this script as far as variables go, are numbers... which makes it difficult at best which makes visual mapping harder. So I thought I would ask a professional what I should be looking for in the script so that I can go ahead and modify it and reuse some functionality to display a game header from javascript.
The pgn viewer will read either string format directly input into the setup configuration in the html page, or it will read from a file. It them parses the elements based on the pgn tags.
var tag=this.parseTag("FEN",pgn,i);
if(tag&&tag!="?"){
this.board.startFen=tag;
}else{
tag=this.parseTag("White",pgn,i);
if(tag&&tag!="?"){
_68=tag;
}else{
tag=this.parseTag("Black",pgn,i);
if(tag&&tag!="?"){
_63=tag;
}else{
tag=this.parseTag("Result",pgn,i);
if(tag&&tag!="?"){
_62=tag;
}else{
tag=this.parseTag("Event",pgn,i);
if(tag&&tag!="?"){
_64=tag;
}else{
tag=this.parseTag("Site",pgn,i);
if(tag&&tag!="?"){
_65=tag;
}else{
tag=this.parseTag("Date",pgn,i);
if(tag&&tag!="?"){
_66=tag;
So the variables I want to use are _68, _63, & _62 and display them as a header to the board. Any help is appreciated.