]> git.sesse.net Git - remoteglot/commitdiff
Remove some trash code that we do not use.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 28 Dec 2022 00:00:06 +0000 (01:00 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 28 Dec 2022 00:00:06 +0000 (01:00 +0100)
www/js/chessboard-0.3.0.js

index 00f83cff53d0852433f8a98b073077f158519521..a1a6fbcb2523cc2ba5274f9dbdac15bf7fb6a8a1 100644 (file)
@@ -374,11 +374,6 @@ function expandConfig() {
     cfg.draggable = false;
   }
 
-  // default for dropOffBoard is 'snapback'
-  if (cfg.dropOffBoard !== 'trash') {
-    cfg.dropOffBoard = 'snapback';
-  }
-
   // default piece theme is wikipedia
   if (cfg.hasOwnProperty('pieceTheme') !== true ||
       (typeof cfg.pieceTheme !== 'string' &&
@@ -979,25 +974,6 @@ function snapbackDraggedPiece() {
   DRAGGING_A_PIECE = false;
 }
 
-function trashDraggedPiece() {
-  removeSquareHighlights();
-
-  // remove the source piece
-  var newPosition = deepCopy(CURRENT_POSITION);
-  delete newPosition[DRAGGED_PIECE_SOURCE];
-  setCurrentPosition(newPosition);
-
-  // redraw the position
-  drawPositionInstant();
-
-  // hide the dragged piece
-  // FIXME: support this for non-jquery
-  //$(draggedPieceEl).fadeOut(cfg.trashSpeed);
-
-  // set state
-  DRAGGING_A_PIECE = false;
-}
-
 function dropDraggedPieceOnSquare(square) {
   removeSquareHighlights();
 
@@ -1107,9 +1083,6 @@ function stopDraggedPiece(location) {
   if (location === 'offboard' && cfg.dropOffBoard === 'snapback') {
     action = 'snapback';
   }
-  if (location === 'offboard' && cfg.dropOffBoard === 'trash') {
-    action = 'trash';
-  }
 
   // run their onDrop function, which can potentially change the drop action
   if (cfg.hasOwnProperty('onDrop') === true &&
@@ -1134,7 +1107,7 @@ function stopDraggedPiece(location) {
 
     var result = cfg.onDrop(DRAGGED_PIECE_SOURCE, location, DRAGGED_PIECE,
       newPosition, oldPosition, CURRENT_ORIENTATION);
-    if (result === 'snapback' || result === 'trash') {
+    if (result === 'snapback') {
       action = result;
     }
   }
@@ -1143,9 +1116,6 @@ function stopDraggedPiece(location) {
   if (action === 'snapback') {
     snapbackDraggedPiece();
   }
-  else if (action === 'trash') {
-    trashDraggedPiece();
-  }
   else if (action === 'drop') {
     dropDraggedPieceOnSquare(location);
   }