Main Class
Main methods This is not actually a class, but a necessary convention to get YUIdoc to document standalone items.
Item Index
Methods
cancelGame
()
hides #cancel-search div, shows #start-search and sends stop search request to the server
connect
()
Object
ajax request to connect to the server
Returns:
ajax result
displayDrawOffer
-
offer
display draw offer menu
Parameters:
-
offer
Stringoffer side, valid values are 'white', 'black' or 'none'
finishGame
-
result
-
message
displays the game result and prompts user to start new game
Parameters:
-
result
Stringresult of the game, valid values are 'white', 'black' or 'draw'
-
message
Stringthe reason to finish the game
load
()
document.load event
playAgain
()
hides #start-search div, shows #cancel-search and requests for the game
render
()
renders the chess board in case of initial window load or window resize events
reqGame
()
Object
Recursively calls ajax request to check for the start of the game
Returns:
ajax result
reqGame
-
game_id
Recursively calls ajax request to check for an opponent move
Parameters:
-
game_id
Numberthe id of the game
Returns:
ajax result
requestGame
()
hides #play-again div, shows #cancel-search and requests for the game
requestHistory
-
game_id
ajax request to retrieve game history
Parameters:
-
game_id
Numberthe id of the game
Returns:
ajax result
setClock
-
wc
-
bc
sets a clock
Parameters:
-
wc
Numberwhite side clock
-
bc
Numberblack side clock
stopSearch
()
Object
ajax request to stop the search for the game
Returns:
ajax result
submitMove
-
game_id
-
fen
-
move
-
castling
-
enpassant
-
draw_moves
-
wlc
-
wsc
-
blc
-
bsc
-
result
-
gameFinished
Sends ajax request to submit a move
Parameters:
-
game_id
Numberthe id of the game
-
fen
StringForsyth–Edwards notation of the current state of the chess game
-
move
Stringnotation representation of the move
-
castling
Stringvalid values are 'long', 'short' or 'none'
-
enpassant
Stringthe notation coordinates of the pawn which can be taken en passant
-
draw_moves
Numbernumber of moves to finish a game under 50 moves rule
-
wlc
Stringwhite long castling right, valid values 'true' and 'false'
-
wsc
Stringwhite short castling right, valid values 'true' and 'false'
-
blc
Stringblack short castling right, valid values 'true' and 'false'
-
bsc
Stringblack short castling right, valid values 'true' and 'false'
-
result
Stringthe result of the game in case the game has finished, valid values are 'white', 'black or 'draw'
-
gameFinished
Stringthe reason to finish the game
submitResult
-
result
-
game_finished
ajax request to submit the result of the game
Parameters:
-
result
Stringthe result of the game, valid values are 'black', 'white' or 'draw'
-
game_finished
Stringthe reason to finish the game
Returns:
ajax result
updateHistoryTable
-
res
updates history table
Parameters:
-
res
Objectdata to be colected from the requestHistory ajax request