client/client.js
// Update our current location and change the URL to it
Update our current location and change the URL to it
Update our current location and change the URL to it
function updateLocation(view, destination, skipPush) {
    if (typeof destination.length !== "number") throw new Error("Destination needs to be string or array");
    function sendReq(view, viewDest, time) {
      (function queue(time) {
        if ((!droppy.socketWait && !view[0].isAnimating) || time > 2000) {
          var viewLoc = getViewLocation(view);
          showSpinner(view);
          if (!viewLoc || viewDest.length === viewLoc.length) {
            view[0].animDirection = "center";
          } else if (viewDest.length > viewLoc.length) {
            view[0].animDirection = "forward";
          } else {
            view[0].animDirection = "back";
          }
          sendMessage(view[0].vId, "REQUEST_UPDATE", viewDest);
          if (!skipPush) pushHistory(view, viewDest);
        } else setTimeout(queue, 50, time + 50);
      })(time);
    }
    if (view === null) {
      for (var i = destination.length - 1; i >= 0; i--) {
        if (destination[i].length && getViewLocation(getView(i)) !== destination[i]) {
          sendReq(getView(i), destination[i], 0);
        }
      }
    } else if (droppy.views[view[0].vId]) sendReq(view, destination, 0);
  }
function updateLocation ( view , destination , skipPush ) { if ( typeof destination . length !== "number" ) throw new Error ( "Destination needs to be string or array" ) ; function sendReq ( view , viewDest , time ) { ( function queue ( time ) { if ( ( ! droppy . socketWait && ! view [ 0 ] . isAnimating ) || time > 2000 ) { var viewLoc = getViewLocation ( view ) ; showSpinner ( view ) ; if ( ! viewLoc || viewDest . length === viewLoc . length ) { view [ 0 ] . animDirection = "center" ; } else if ( viewDest . length > viewLoc . length ) { view [ 0 ] . animDirection = "forward" ; } else { view [ 0 ] . animDirection = "back" ; } sendMessage ( view [ 0 ] . vId , "REQUEST_UPDATE" , viewDest ) ; if ( ! skipPush ) pushHistory ( view , viewDest ) ; } else setTimeout ( queue , 50 , time + 50 ) ; } ) ( time ) ; } if ( view === null ) { for ( var i = destination . length - 1 ; i >= 0 ; i -- ) { if ( destination [ i ] . length && getViewLocation ( getView ( i ) ) !== destination [ i ] ) { sendReq ( getView ( i ) , destination [ i ] , 0 ) ; } } } else if ( droppy . views [ view [ 0 ] . vId ] ) sendReq ( view , destination , 0 ) ; }
Update our current location and change the URL to it
Update our current location and change the URL to it
// Queue the folder switching if we are mid-animation or waiting for the server // Find the direction in which we should animate // Skip the push if we're already navigating through history // Only when navigating backwards