/*
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
if(!dojo._hasResource["acf.CheckerBoard"]){dojo._hasResource["acf.CheckerBoard"]=true;dojo.provide("acf.CheckerBoard");dojo.require("acf.Board");dojo.require("dojo.io.script");dojo.declare("acf.CheckerBoard",[acf.Board],{constructor:function(){this.position=this.emptyPosition;this.move="b";},gameSearchFile:"https://usacheckers.com/games/search.php",positionSearchFile:"https://usacheckers.com/games/findPosition.php",loadFile:"https://usacheckers.com/games/load.php",parseFile:"https://usacheckers.com/games/parseGame.php",uploadFile:"https://usacheckers.com/games/upload.php",playableSquares:"d",mode:"SETUP",pdnText:"",fen:"",position:"",positionList:null,startPosition:0,move:"",defaultPosition:"bbbbbbbbbbbb........wwwwwwwwwwww",emptyPosition:"................................",gameId:-1,hiddenToolbar:false,wmImg:dojo.moduleUrl("acf","resources/images/wm.gif"),bmImg:dojo.moduleUrl("acf","resources/images/bm.gif"),wkImg:dojo.moduleUrl("acf","resources/images/wk.gif"),bkImg:dojo.moduleUrl("acf","resources/images/bk.gif"),delImg:dojo.moduleUrl("acf","resources/images/trash_can.png"),drawPosition:function(){var p=this.position;for(var i=0;i
0){this.move=this.move.toLowerCase();var m=(this.move=="w")?"White":"Black";m=""+m+" to Move";var t=(this.titleText.length==0)?m:this.titleText+"
"+m;this.title.innerHTML=t;}},_isAccepted:function(_1,_2){var s=this.square;var p=dojo.attr(_2[0],"value");return true;},_doDrop:function(_3,_4,_5,_6){if(dojo.dnd.manager().target!==this){return;}var s=this.square;var p=dojo.attr(_4[0],"value");if(!_5){var f=_3.square;this.board._setPiece(f,".");}this.board._setPiece(s,p);},_setPiece:function(_7,_8){var p=this.position;var re=new RegExp("^(.{"+--_7+"}).(.*)$","");this.position=p.replace(re,"$1"+_8+"$2");},generateFEN:function(){var s="[FEN \""+this.move.toUpperCase();var w="";var b="";var p=this.position;for(var i=0;iFailed to Load Game";this.setTitle(t);},setMove:function(_12){this.inherited(arguments);this.setPosition(_12);},setPosition:function(_13){if(this.positionList&&this.positionList.length>_13){this.position=this.positionList[_13];this.drawPosition();}},doSearch:function(){},findPosition:function(){if(this.postion!=this.emptyPosition){dojo.io.script.get({url:this.positionSearchFile,content:{"P_POSITION":this.position,"P_CALLBACK":"acf_callback"},callbackParamName:"acf_callback",handleAs:"json",load:dojo.hitch(this,"listGames"),error:function(_14){}});}},getGame:function(){if(this.gameId!=-1){dojo.io.script.get({url:this.loadFile,content:{"P_GAME_ID":this.gameId,"P_CALLBACK":"acf_callback"},callbackParamName:"acf_callback",handleAs:"json",load:dojo.hitch(this,"loadXHRGame"),error:function(_15){}});}},parseGame:function(){if(this.pdnText.length){dojo.io.script.get({url:this.parseFile,content:{"P_PDN":this.pdnText,"P_CALLBACK":"acf_callback"},callbackParamName:"acf_callback",handleAs:"json",load:dojo.hitch(this,"loadXHRGames"),error:function(_16){}});}},uploadPDN:function(){},listGames:function(_17){},postCreate:function(){this.inherited(arguments);this.startPosition=(this.startPosition)?parseInt(this.startPosition):0;this.setMode();}});}