upgrade chessboardjs
|
@ -4,11 +4,11 @@
|
|||
@import chess.{ KingSide, QueenSide }
|
||||
|
||||
@moreCss = {
|
||||
@cssVendorTag("chessboard/css/chessboard-0.1.0.css")
|
||||
@cssTag("chessboardjs.css")
|
||||
@cssTag("boardEditor.css")
|
||||
}
|
||||
@moreJs = {
|
||||
@jsAt("vendor/chessboard/js/chessboard-0.1.0.js")
|
||||
@jsTagCompiled("chessboard.js")
|
||||
@jsTagCompiled("boardEditor.js")
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
|
||||
mkdir -p public/compiled
|
||||
for file in big.js chart2.js user.js boardEditor.js pgn4hacks.js; do
|
||||
for file in big.js chart2.js user.js boardEditor.js pgn4hacks.js chessboard.js; do
|
||||
orig=public/javascripts/$file
|
||||
comp=public/compiled/$file
|
||||
if [[ ! -f $comp || $orig -nt $comp ]]; then
|
||||
|
|
51
public/stylesheets/chessboardjs.css
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*!
|
||||
* Copyright 2013 Chris Oakman
|
||||
* Released under the MIT license
|
||||
* https://github.com/oakmac/chessboardjs/blob/master/LICENSE
|
||||
*/
|
||||
.board-b72b1 {
|
||||
border: 1px solid #c0c0c0;
|
||||
-webkit-box-sizing: content-box;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
height: 512px;
|
||||
}
|
||||
.square-55d63 {
|
||||
float: left;
|
||||
position: relative;
|
||||
/* disable any native browser highlighting */
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
.white-1e1d7 {
|
||||
background-color: #f0d9b5;
|
||||
color: #b58863;
|
||||
}
|
||||
.black-3c85d {
|
||||
background-color: #b58863;
|
||||
color: #f0d9b5;
|
||||
}
|
||||
.highlight1-32417,
|
||||
.highlight2-9c5d2 {
|
||||
-webkit-box-shadow: inset 0 0 3px 3px yellow;
|
||||
-moz-box-shadow: inset 0 0 3px 3px yellow;
|
||||
box-shadow: inset 0 0 3px 3px yellow;
|
||||
}
|
||||
.notation-322f9 {
|
||||
cursor: default;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
position: absolute;
|
||||
}
|
||||
.alpha-d2270 {
|
||||
bottom: 1px;
|
||||
right: 3px;
|
||||
}
|
||||
.numeric-fc462 {
|
||||
top: 2px;
|
||||
left: 2px;
|
||||
}
|
21
public/vendor/chessboard/LICENSE.txt
vendored
|
@ -1,21 +0,0 @@
|
|||
Copyright 2013 Chris Oakman
|
||||
http://chessboardjs.com/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -1,73 +0,0 @@
|
|||
/*!
|
||||
* ChessBoardJS v0.1.0
|
||||
*
|
||||
* Copyright 2013 Chris Oakman
|
||||
* Released under the MIT license
|
||||
* http://chessboardjs.com/license
|
||||
*
|
||||
* Date: 21 Jul 2013
|
||||
*/
|
||||
|
||||
/* board */
|
||||
div.board-b72b1 {
|
||||
border: 1px solid #ccc;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
display:inline-block;
|
||||
}
|
||||
.board-b72b1:after {
|
||||
content:".";
|
||||
display:block;
|
||||
height:0;
|
||||
clear:both;
|
||||
visibility:hidden;
|
||||
}
|
||||
|
||||
/* square */
|
||||
div.square-55d63 {
|
||||
float: left;
|
||||
position: relative;
|
||||
|
||||
/* disable any native browser highlighting */
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
/* white square */
|
||||
div.white-1e1d7 {
|
||||
background-color: #f0d9b5;
|
||||
color: #b58863;
|
||||
}
|
||||
|
||||
/* black square */
|
||||
div.black-3c85d {
|
||||
background-color: #b58863;
|
||||
color: #f0d9b5;
|
||||
}
|
||||
|
||||
/* highlighted square */
|
||||
div.highlight1-32417, div.highlight2-9c5d2 {
|
||||
-webkit-box-shadow: inset 0 0 3px 3px yellow;
|
||||
-moz-box-shadow: inset 0 0 3px 3px yellow;
|
||||
box-shadow: inset 0 0 3px 3px yellow;
|
||||
}
|
||||
|
||||
/* notation */
|
||||
div.notation-322f9 {
|
||||
cursor: default;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
position: absolute;
|
||||
}
|
||||
div.alpha-d2270 {
|
||||
bottom: 1px;
|
||||
right: 3px;
|
||||
}
|
||||
div.numeric-fc462 {
|
||||
top: 2px;
|
||||
left: 2px;
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
/*! ChessBoardJS v0.1.0 | (c) 2013 Chris Oakman | MIT License chessboardjs.com/license */
|
||||
div.clearfix-7da63{clear:both}div.board-b72b1{border:2px solid #404040;-moz-box-sizing:content-box;box-sizing:content-box}div.square-55d63{float:left;position:relative;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}div.white-1e1d7{background-color:#f0d9b5;color:#b58863}div.black-3c85d{background-color:#b58863;color:#f0d9b5}div.highlight1-32417,div.highlight2-9c5d2{-webkit-box-shadow:inset 0 0 3px 3px yellow;-moz-box-shadow:inset 0 0 3px 3px yellow;box-shadow:inset 0 0 3px 3px yellow}div.notation-322f9{cursor:default;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;position:absolute}div.alpha-d2270{bottom:1px;right:3px}div.numeric-fc462{top:2px;left:2px}
|
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 777 B |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 748 B |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 1.1 KiB |
|
@ -1,29 +0,0 @@
|
|||
/*! ChessBoardJS v0.1.0 | (c) 2013 Chris Oakman | MIT License chessboardjs.com/license */
|
||||
(function(){var x="abcdefgh".split(""),u=function(g){return"string"!==typeof g?!1:-1!==g.search(/^[a-h][1-8]$/)},P=function(g){if("string"!==typeof g)return!1;g=g.split("/");if(8>g.length)return!1;for(var b=0;8>b;b++)if(""===g[b]||8<g[b].length||-1!==g[b].search(/[^kqrbnpKQRNBP1-8]/))return!1;return!0},H=function(g){if("object"!==typeof g)return!1;for(var b in g)if(!0===g.hasOwnProperty(b)){var r;(r=!0!==u(b))||(r=g[b],r="string"!==typeof r?!1:-1!==r.search(/^[bw][KQRNBP]$/),r=!0!==r);if(r)return!1}return!0},
|
||||
I=function(g){if(!0!==P(g))return!1;g=g.split("/");for(var b={},r=8,f=0;8>f;f++){for(var l=g[f].split(""),m=0,p=0;p<l.length;p++)if(-1!==l[p].search(/[1-8]/))var u=parseInt(l[p],10),m=m+u;else{var u=b,E=x[m]+r,h;h=l[p];h=h.toLowerCase()===h?"b"+h.toUpperCase():"w"+h.toUpperCase();u[E]=h;m++}r--}return b},J=function(g){if(!0!==H(g))return!1;for(var b="",r=8,f=0;8>f;f++){for(var l=0;8>l;l++){var m=x[l]+r;!0===g.hasOwnProperty(m)?(m=g[m].split(""),m="w"===m[0]?m[1].toUpperCase():m[1].toLowerCase(),b+=
|
||||
m):b+="1"}7!==f&&(b+="/");r--}b=b.replace(/11111111/g,"8");b=b.replace(/1111111/g,"7");b=b.replace(/111111/g,"6");b=b.replace(/11111/g,"5");b=b.replace(/1111/g,"4");b=b.replace(/111/g,"3");return b=b.replace(/11/g,"2")};window.ChessBoard=window.ChessBoard||function(g,b){b=b||{};var r=I("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR"),f={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"},l,m,p,Q,E,h={},V=2,w="white",n={},q,A,B,v,y=!1,K={},s={},F,C=function(){return"xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx".replace(/x/g,function(a){return(16*Math.random()|0).toString(16)})},t=function(a){return JSON.parse(JSON.stringify(a))},W=function(a){a=
|
||||
a.split(".");return{major:parseInt(a[0],10),minor:parseInt(a[1],10),patch:parseInt(a[2],10)}},G=function(a,e,c){if(!0===b.hasOwnProperty("showErrors")&&!1!==b.showErrors){var d="ChessBoard Error "+a+": "+e;"console"===b.showErrors&&"object"===typeof console&&"function"===typeof console.log?(console.log(d),2<=arguments.length&&console.log(c)):"alert"===b.showErrors?(c&&(d+="\n\n"+JSON.stringify(c)),window.alert(d)):"function"===typeof b.showErrors&&b.showErrors(a,e,c)}},L=function(a){return"fast"===
|
||||
a||"slow"===a?!0:parseInt(a,10)+""!==a+""?!1:0<a},da=function(){for(var a=0;a<x.length;a++)for(var b=1;8>=b;b++){var c=x[a]+b;s[c]=c+"-"+C()}b="KQRBNP".split("");for(a=0;a<b.length;a++){var c="w"+b[a],d="b"+b[a];K[c]=c+"-"+C();K[d]=d+"-"+C()}},ea=function(){var a='<div class="'+f.chessboard+'">';!0===b.sparePieces&&(a+='<div class="'+f.sparePieces+" "+f.sparePiecesTop+'"></div>');a+='<div class="'+f.board+'"></div>';!0===b.sparePieces&&(a+='<div class="'+f.sparePieces+" "+f.sparePiecesBottom+'"></div>');
|
||||
return a+"</div>"},fa=function(a){"black"!==a&&(a="white");var e="",c=t(x),d=8;"black"===a&&(c.reverse(),d=1);for(var g="white",h=0;8>h;h++){for(var e=e+('<div class="'+f.row+'">'),k=0;8>k;k++){var l=c[k]+d,e=e+('<div class="'+f.square+" "+f[g]+'" style="width: '+q+"px; height: "+q+'px" id="'+s[l]+'" data-square="'+l+'">');if(!0===b.showNotation){if("white"===a&&1===d||"black"===a&&8===d)e+='<div class="'+f.notation+" "+f.alpha+'">'+c[k]+"</div>";0===k&&(e+='<div class="'+f.notation+" "+f.numeric+
|
||||
'">'+d+"</div>")}e+="</div>";g="white"===g?"black":"white"}e+='<div class="'+f.clearfix+'"></div></div>';g="white"===g?"black":"white";"white"===a?d--:d++}return e},X=function(a){if("function"===typeof b.pieceTheme)return b.pieceTheme(a);if("string"===typeof b.pieceTheme)return b.pieceTheme.replace(/{piece}/g,a);G(8272,"Unable to build image source for cfg.pieceTheme.")},z=function(a,b,c){var d='<img src="'+X(a)+'" ';c&&"string"===typeof c&&(d+='id="'+c+'" ');d+='alt="" class="'+f.piece+'" data-piece="'+
|
||||
a+'" style="width: '+q+"px;height: "+q+"px;";!0===b&&(d+="display:none;");return d+'" />'},M=function(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;c<b.length;c++)a+=z(b[c],!1,K[b[c]]);return a},ga=function(a,e,c,d){a=$("#"+s[a]);var g=a.offset(),h=$("#"+s[e]);e=h.offset();var k=C();$("body").append(z(c,!0,k));var l=$("#"+k);l.css({display:"",position:"absolute",top:g.top,left:g.left});a.find("img."+f.piece).remove();l.animate(e,{duration:b.moveSpeed,
|
||||
complete:function(){h.append(z(c));l.remove();"function"===typeof d&&d()}})},ha=function(a,e,c){var d=$("#"+K[a]).offset(),g=$("#"+s[e]);e=g.offset();var h=C();$("body").append(z(a,!0,h));var k=$("#"+h);k.css({display:"",position:"absolute",left:d.left,top:d.top});k.animate(e,{duration:b.moveSpeed,complete:function(){g.find("img."+f.piece).remove();g.append(z(a));k.remove();"function"===typeof c&&c()}})},ia=function(a){for(var e=0,c=function(){e++;e===a.length&&D()},d=0;d<a.length;d++)"clear"===a[d].type&&
|
||||
$("#"+s[a[d].square]+" img."+f.piece).fadeOut(b.trashSpeed,c),"add"===a[d].type&&!0!==b.sparePieces&&$("#"+s[a[d].square]).append(z(a[d].piece,!0)).find("img."+f.piece).fadeIn("fast",c),"add"===a[d].type&&!0===b.sparePieces&&ha(a[d].piece,a[d].square,c),"move"===a[d].type&&ga(a[d].source,a[d].destination,a[d].piece,c)},ja=function(a,b){a=a.split("");var c=x.indexOf(a[0])+1,d=parseInt(a[1],10);b=b.split("");var f=x.indexOf(b[0])+1,g=parseInt(b[1],10),c=Math.abs(c-f),d=Math.abs(d-g);return c>=d?c:d},
|
||||
ka=function(a){for(var b=[],c=0;8>c;c++)for(var d=0;8>d;d++){var f=x[c]+(d+1);a!==f&&b.push({square:f,distance:ja(a,f)})}b.sort(function(a,b){return a.distance-b.distance});a=[];for(c=0;c<b.length;c++)a.push(b[c].square);return a},D=function(){m.find("img."+f.piece).remove();for(var a in n)!0===n.hasOwnProperty(a)&&$("#"+s[a]).append(z(n[a]))},R=function(){m.html(fa(w));D();!0===b.sparePieces&&("white"===w?(Q.html(M("black")),E.html(M("white"))):(Q.html(M("white")),E.html(M("black"))))},N=function(a){var e=
|
||||
t(n),c=t(a),d=J(e),f=J(c);if(d!==f){if(!0===b.hasOwnProperty("onChange")&&"function"===typeof b.onChange)b.onChange(e,c);n=a}},S=function(a,b){for(var c in F)if(!0===F.hasOwnProperty(c)){var d=F[c];if(a>=d.left&&a<d.left+q&&b>=d.top&&b<d.top+q)return c}return"offboard"},T=function(){m.find("div."+f.square).removeClass(f.highlight1+" "+f.highlight2)},la=function(){if("spare"===v)Y();else{T();var a=$("#"+s[v]).offset();p.animate(a,{duration:b.snapbackSpeed,complete:function(){D();p.css("display","none")}});
|
||||
y=!1}},Y=function(){T();var a=t(n);delete a[v];N(a);D();p.fadeOut(b.trashSpeed);y=!1},ma=function(a){T();var e=t(n);delete e[v];e[a]=A;N(e);a=$("#"+s[a]).offset();p.animate(a,{duration:b.snapSpeed,complete:function(){D();p.css("display","none")}});y=!1},O=function(a,e,c,d){if("function"!==typeof b.onDragStart||!1!==b.onDragStart(a,e,t(n),w)){y=!0;A=e;v=a;B="spare"===a?"offboard":a;F={};for(var g in s)!0===s.hasOwnProperty(g)&&(F[g]=$("#"+s[g]).offset());p.attr("src",X(e)).css({display:"",position:"absolute",
|
||||
left:c-q/2,top:d-q/2});"spare"!==a&&$("#"+s[a]).addClass(f.highlight1).find("img."+f.piece).css("display","none")}},Z=function(a,e){p.css({left:a-q/2,top:e-q/2});var c=S(a,e);if(c!==B){!0===u(B)&&$("#"+s[B]).removeClass(f.highlight2);!0===u(c)&&$("#"+s[c]).addClass(f.highlight2);if("function"===typeof b.onDragMove)b.onDragMove(c,B,v,A,t(n),w);B=c}},aa=function(a){var e="drop";"offboard"===a&&"snapback"===b.dropOffBoard&&(e="snapback");"offboard"===a&&"trash"===b.dropOffBoard&&(e="trash");if(!0===
|
||||
b.hasOwnProperty("onDrop")&&"function"===typeof b.onDrop){var c=t(n);"spare"===v&&!0===u(a)&&(c[a]=A);!0===u(v)&&"offboard"===a&&delete c[v];!0===u(v)&&!0===u(a)&&(delete c[v],c[a]=A);var d=t(n),c=b.onDrop(v,a,A,c,d,w);if("snapback"===c||"trash"===c)e=c}"snapback"===e?la():"trash"===e?Y():"drop"===e&&ma(a)};h.clear=function(a){h.position({},a)};h.destroy=function(){l.html("");p.remove();l.unbind()};h.fen=function(){return h.position("fen")};h.flip=function(){h.orientation("flip")};h.move=function(){if(0!==
|
||||
arguments.length){for(var a={},b=0;b<arguments.length;b++){var c;c=arguments[b];"string"!==typeof c?c=!1:(c=c.split("-"),c=2!==c.length?!1:!0===u(c[0])&&!0===u(c[1]));!0!==c?G(2826,"Invalid move passed to the move method.",arguments[b]):(c=arguments[b].split("-"),a[c[0]]=c[1])}var b=n,b=t(b),d;for(d in a)!0===a.hasOwnProperty(d)&&!0===b.hasOwnProperty(d)&&(c=b[d],delete b[d],b[a[d]]=c);a=b;h.position(a);return a}};h.orientation=function(a){if(0===arguments.length)return w;"white"===a||"black"===a?
|
||||
(w=a,R()):"flip"===a?(w="white"===w?"black":"white",R()):G(5482,"Invalid value passed to the orientation method.",a)};h.position=function(a,b){if(0===arguments.length)return t(n);if("string"===typeof a&&"fen"===a.toLowerCase())return J(n);!1!==b&&(b=!0);"string"===typeof a&&"start"===a.toLowerCase()&&(a=t(r));!0===P(a)&&(a=I(a));if(!0!==H(a))G(6482,"Invalid value passed to the position method.",a);else if(!0===b){var c=n,d=a,c=t(c),d=t(d),f=[],g={},k;for(k in d)!0===d.hasOwnProperty(k)&&(!0===c.hasOwnProperty(k)&&
|
||||
c[k]===d[k])&&(delete c[k],delete d[k]);for(k in d)if(!0===d.hasOwnProperty(k)){var h;a:{h=c;for(var l=d[k],m=ka(k),p=0;p<m.length;p++){var q=m[p];if(!0===h.hasOwnProperty(q)&&h[q]===l){h=q;break a}}h=!1}!1!==h&&(f.push({type:"move",source:h,destination:k,piece:d[k]}),delete c[h],delete d[k],g[k]=!0)}for(k in d)!0===d.hasOwnProperty(k)&&(f.push({type:"add",square:k,piece:d[k]}),delete d[k]);for(k in c)!0===c.hasOwnProperty(k)&&!0!==g.hasOwnProperty(k)&&(f.push({type:"clear",square:k,piece:c[k]}),
|
||||
delete c[k]);ia(f);N(a)}else N(a),D()};h.resize=function(){var a=parseInt(l.css("width"),10);if(!a||0>=a)q=0;else{for(a-=1;0!==a%8&&0<a;)a--;q=a/8}m.css("width",8*q+"px");p.css({height:q,width:q});!0===b.sparePieces&&l.find("div."+f.sparePieces).css("paddingLeft",q+V+"px");R()};h.start=function(a){h.position("start",a)};var na=function(a){a.preventDefault()},oa=function(a){if(!0===b.draggable){var e=$(this).attr("data-square");!0===u(e)&&!0===n.hasOwnProperty(e)&&O(e,n[e],a.pageX,a.pageY)}},pa=function(a){if(!0===
|
||||
b.draggable){var e=$(this).attr("data-square");!0===u(e)&&!0===n.hasOwnProperty(e)&&(a=a.originalEvent,O(e,n[e],a.changedTouches[0].pageX,a.changedTouches[0].pageY))}},qa=function(a){if(!0===b.sparePieces){var e=$(this).attr("data-piece");O("spare",e,a.pageX,a.pageY)}},ra=function(a){if(!0===b.sparePieces){var e=$(this).attr("data-piece");a=a.originalEvent;O("spare",e,a.changedTouches[0].pageX,a.changedTouches[0].pageY)}},ba=function(a){!0===y&&Z(a.pageX,a.pageY)},sa=function(a){!0===y&&(a.preventDefault(),
|
||||
Z(a.originalEvent.changedTouches[0].pageX,a.originalEvent.changedTouches[0].pageY))},ca=function(a){!0===y&&(a=S(a.pageX,a.pageY),aa(a))},ta=function(a){!0===y&&(a=S(a.originalEvent.changedTouches[0].pageX,a.originalEvent.changedTouches[0].pageY),aa(a))},ua=function(){$("body").on("mousedown mousemove","img."+f.piece,na);m.on("mousedown","div."+f.square,oa);l.on("mousedown","div."+f.sparePieces+" img."+f.piece,qa);!0===(navigator&&navigator.userAgent&&-1!==navigator.userAgent.search(/MSIE/))?(document.ondragstart=
|
||||
function(){return!1},$("body").on("mousemove",ba),$("body").on("mouseup",ca)):($(window).on("mousemove",ba),$(window).on("mouseup",ca));!0==="ontouchstart"in document.documentElement&&(m.on("touchstart","div."+f.square,pa),l.on("touchstart","div."+f.sparePieces+" img."+f.piece,ra),$(window).on("touchmove",sa),$(window).on("touchend",ta))},va=function(){l.html(ea());m=l.find("div."+f.board);!0===b.sparePieces&&(Q=l.find("div."+f.sparePiecesTop),E=l.find("div."+f.sparePiecesBottom));var a=C();$("body").append(z("wP",
|
||||
!0,a));p=$("#"+a);V=parseInt(m.css("borderLeftWidth"),10);h.resize()};var U;if(U=!0===function(){if("string"===typeof g){if(""===g)return window.alert("ChessBoard Error 1001: The first argument to ChessBoard() cannot be an empty string.\n\nExiting..."),!1;var a=document.getElementById(g);if(!a)return window.alert('ChessBoard Error 1002: Element with id "'+g+'" does not exist in the DOM.\n\nExiting...'),!1;l=$(a)}else if(l=$(g),1!==l.length)return window.alert("ChessBoard Error 1003: The first argument to ChessBoard() must be an ID or a single DOM node.\n\nExiting..."),
|
||||
!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.\n\nExiting..."),!1;if(a=typeof window.$)if(a=$.fn)if(a=$.fn.jquery)var a=$.fn.jquery,b="1.7.0",a=W(a),b=W(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.\n\nExiting..."),
|
||||
!1)}()){if("string"===typeof b||!0===H(b))b={position:b};"black"!==b.orientation&&(b.orientation="white");w=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="img/chesspieces/wikipedia/{piece}.png";if(!0!==b.hasOwnProperty("moveSpeed")||
|
||||
!0!==L(b.moveSpeed))b.moveSpeed=200;if(!0!==b.hasOwnProperty("snapbackSpeed")||!0!==L(b.snapbackSpeed))b.snapbackSpeed=50;if(!0!==b.hasOwnProperty("snapSpeed")||!0!==L(b.snapSpeed))b.snapSpeed=25;if(!0!==b.hasOwnProperty("trashSpeed")||!0!==L(b.trashSpeed))b.trashSpeed=100;!0===b.hasOwnProperty("position")&&("start"===b.position?n=t(r):!0===P(b.position)?n=I(b.position):!0===H(b.position)?n=t(b.position):G(7263,"Invalid value passed to config.position.",b.position));U=!0}U&&(da(),va(),ua());return h};
|
||||
window.ChessBoard.fenToObj=I;window.ChessBoard.objToFen=J})();
|