/*! chessboard.js v0.3.0 | © 2013 Chris Oakman | MIT License chessboardjs.com/license */ (function(){function l(f){return“string”!==typeof f?!1:-1!==f.search(/^[1-8]$/)}function Q(f){if(“string”!==typeof f)return!1;f=f.replace(/ .+$/,“”);f=f.split(“/”);if(8!==f.length)return!1;for(var b=0;8>b;b++)if(“”===f||8a
“: ”+e;“console”===b.showErrors&&“object”===typeof console&&“function”===typeof console.log?(console.log(d),2<=arguments.length&&console.log©):“alert”===b.showErrors?(c&&(d+=“nn”+JSON.stringify©),window.alert(d)):“function”===typeof b.showErrors&&b.showErrors(a,e,c)}}function w(a){return“fast”=== a||“slow”===a?!0:parseInt(a,10)+“”!==a+“”?!1:0<=a}function I(){for(var a=0;a<B.length;a++)for(var b=1;8>=b;b++){var c=B+b;s=c+“-”+n()}b=“KQRBNP”.split(“”);for(a=0;a<b.length;a++){var c=“w”+b,d=“b”+b;M=c+“-”+n();M=d+“-”+n()}}function ga(){var a='<div class=“'h.chessboard
'”>';!0===b.sparePieces&&(a+='<div class=“'h.sparePieces
” “h.sparePiecesTop
'”></div>');a+='<div class=“'h.board
'”></div>';!0===b.sparePieces&&(a+='<div class=“'h.sparePieces
” “h.sparePiecesBottom
'”></div>'); return a+“</div>”}function A(a){“black”!==a&&(a=“white”);var e=“”,c=m(B),d=8;“black”===a&&(c.reverse(),d=1);for(var C=“white”,f=0;8>f;f++){for(var e=e+('<div class=“'h.row
'”>'),k=0;8>k;k++){var g=c+d,e=e+('<div class=“'h.square
” “h[C]
” square-“g
'” style=“width: 'p
”px; height: “p
'px” id=“‘s[g]
'” data-square=“'g
'”>');if(!0===b.showNotation){if(“white”===a&&1===d||“black”===a&&8===d)e+='<div class=“'h.notation
” “h.alpha
’”>‘c[k]
“</div>”;0===k&&(e+='<div class=“'h.notation
” “+ h.numeric+'”>'d
“</div>”)}e+=“</div>”;C=“white”===C?“black”:“white”}e+='<div class=“'h.clearfix
'”></div></div>';C=“white”===C?“black”:“white”;“white”===a?d–:d++}return e}function Y(a){if(“function”===typeof b.pieceTheme)return b.pieceTheme(a);if(“string”===typeof b.pieceTheme)return b.pieceTheme.replace(/{piece}/g,a);r(8272,“Unable to build image source for cfg.pieceTheme.”);return“”}function D(a,b,c){var d='<img src=“'+Y(a)+'” ';c&&“string”===typeof c&&(d+='id=“'c
'” ');d+='alt=“” class=“'+ h.piece+'” data-piece=“'a
'” style=“width: 'p
”px;height: “p
”px;“;!0===b&&(d+=”display:none;“);return d+'” />'}function N(a){var b=“wK wQ wR wB wN wP”.split(“ ”);“black”===a&&(b=“bK bQ bR bB bN bP”.split(“ ”));a=“”;for(var c=0;cs[a[g].square]
“ .”+h.piece).fadeOut(b.trashSpeed,d),“add”===a.type&&!0!==b.sparePieces&&$(“#”+s[a.square]).append(D(a.piece,!0)).find(“.”+h.piece).fadeIn(b.appearSpeed,d),“add”===a.type&&!0===b.sparePieces&&ia(a.piece,a.square,d),“move”===a.type&&ha(a.source,a.destination,a.piece,d)}function ka(a,b){a=a.split(“”);var c=B.indexOf(a)+1,d=parseInt(a,10); b=b.split(“”);var g=B.indexOf(b)+1,f=parseInt(b,10),c=Math.abs(c-g),d=Math.abs(d-f);return c>=d?c:d}function la(a){for(var b=[],c=0;8>c;c++)for(var d=0;8>d;d++){var g=B+(d+1);a!==g&&b.push({square:g,distance:ka(a,g)})}b.sort(function(a,b){return a.distance-b.distance});a=[];for(c=0;ch.sparePieces
“ .”+h.piece,ra);x.on(“mouseenter”,“.”+h.square,va);x.on(“mouseleave”,“.”+h.square,wa);!0===(navigator&&navigator.userAgent&&-1!==navigator.userAgent.search(/MSIE/))?(document.ondragstart=function(){return!1},$(“body”).on(“mousemove”,ca),$(“body”).on(“mouseup”,da)):($(window).on(“mousemove”,ca),$(window).on(“mouseup”,da));!0===“ontouchstart”in document.documentElement&&(x.on(“touchstart”,“.”+h.square,qa),v.on(“touchstart”,“.”h.sparePieces
“ .”+h.piece,sa),$(window).on(“touchmove”,ta),$(window).on(“touchend”,ua))}function ya(){v.html(ga());x=v.find(“.”+h.board);!0===b.sparePieces&&(S=v.find(“.”+h.sparePiecesTop),T=v.find(“.”+h.sparePiecesBottom));var a=n();$(“body”).append(D(“wP”,!0,a));y=$(“#”+a);ea=parseInt(x.css(“borderLeftWidth”),10);q.resize()}b=b||{};var fa=K(“rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR”),h={alpha:“alpha-d2270”,black:“black-3c85d”, board:“board-b72b1”,chessboard:“chessboard-63f37”,clearfix:“clearfix-7da63”,highlight1:“highlight1-32417”,highlight2:“highlight2-9c5d2”,notation:“notation-322f9”,numeric:“numeric-fc462”,piece:“piece-417db”,row:“row-5277c”,sparePieces:“spare-pieces-7492f”,sparePiecesBottom:“spare-pieces-bottom-ae20f”,sparePiecesTop:“spare-pieces-top-4028b”,square:“square-55d63”,white:“white-1e1d7”},v,x,y,S,T,q={},ea=2,u=“white”,g={},p,E,H,t,z=!1,M={},s={},J;q.clear=function(a){q.position({},a)};q.destroy=function(){v.html(“”); y.remove();v.unbind()};q.fen=function(){return q.position(“fen”)};q.flip=function(){q.orientation(“flip”)};q.move=function(){if(0!==arguments.length){for(var a=!0,b={},c=0;cf
'” does not exist in the DOM.nnExiting…'),!1;v=$(a)}else if(v=$(f),1!==v.length)return window.alert(“ChessBoard Error 1003: The first argument to ChessBoard() must be an ID or a single DOM node.nnExiting…”),!1;if(!window.JSON|| “function”!==typeof JSON.stringify||“function”!==typeof JSON.parse)return window.alert(“ChessBoard Error 1004: JSON does not exist. Please include a JSON polyfill.nnExiting…”),!1;if(a=typeof window.$)if(a=$.fn)if(a=$.fn.jquery)var a=$.fn.jquery,b=“1.7.0”,a=X(a),b=X(b),a=!0===1E8*a.major+1E4*a.minor+a.patch>=1E8*b.major+1E4*b.minor+b.patch;return a?!0:(window.alert(“ChessBoard Error 1005: Unable to find a valid version of jQuery. Please include jQuery 1.7.0 or higher on the page.nnExiting…”), !1)}()){if(“string”===typeof b||!0===F(b))b={position:b};“black”!==b.orientation&&(b.orientation=“white”);u=b.orientation;!1!==b.showNotation&&(b.showNotation=!0);!0!==b.draggable&&(b.draggable=!1);“trash”!==b.dropOffBoard&&(b.dropOffBoard=“snapback”);!0!==b.sparePieces&&(b.sparePieces=!1);!0===b.sparePieces&&(b.draggable=!0);if(!0!==b.hasOwnProperty(“pieceTheme”)||“string”!==typeof b.pieceTheme&&“function”!==typeof b.pieceTheme)b.pieceTheme=“assets/chesspieces/wikipedia/{piece}.png”;if(!0!==b.hasOwnProperty(“appearSpeed”)|| !0!==w(b.appearSpeed))b.appearSpeed=200;if(!0!==b.hasOwnProperty(“moveSpeed”)||!0!==w(b.moveSpeed))b.moveSpeed=200;if(!0!==b.hasOwnProperty(“snapbackSpeed”)||!0!==w(b.snapbackSpeed))b.snapbackSpeed=50;if(!0!==b.hasOwnProperty(“snapSpeed”)||!0!==w(b.snapSpeed))b.snapSpeed=25;if(!0!==b.hasOwnProperty(“trashSpeed”)||!0!==w(b.trashSpeed))b.trashSpeed=100;!0===b.hasOwnProperty(“position”)&&(“start”===b.position?g=m(fa):!0===Q(b.position)?g=K(b.position):!0===F(b.position)?g=m(b.position):r(7263,“Invalid value passed to config.position.”, b.position));W=!0}W&&(I(),ya(),xa());return q};window.ChessBoard.fenToObj=K;window.ChessBoard.objToFen=L})();