VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /var/www/html/libs/absol-full/dist/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/libs/absol-full/dist/js/mdls__absol-mobile__js__dom__MLeftNavigator.js
/*** module: node_modules/absol-mobile/js/dom/MLeftNavigator.js ***/
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

require("../../css/mleftnavigator.css");

var _Core = _interopRequireDefault(require("./Core"));


var _ = _Core.default._;
var $ = _Core.default.$;

function MLeftNavigator() {
  this.on('dragstart', this.eventHandler.modalDragStart).on('drag', this.eventHandler.modalDrag).on('dragend', this.eventHandler.modalDragEnd);
  this.$content = $('.am-navigator-content', this);
  this.$modal = $('.am-navigator-modal', this);
  this._contentWidth = 0;
  this._speedTimeout = -1;
  this._dragSpeed = 0;
  this._preDragTime = 0;
  this._state = -1;
  this._preventDrag = false;
}

MLeftNavigator.tag = 'MLeftNavigator'.toLowerCase();

MLeftNavigator.render = function () {
  return _({
    tag: 'hanger',
    class: 'am-navigator',
    child: ['.am-navigator-modal', '.am-navigator-content'],
    props: {
      hangOn: 9
    }
  });
};

['addChild', 'addChildBefore', 'addChildAfter', 'clearChild', 'findChildBefore', 'findChildAfter', 'removeChild'].forEach(function (key) {
  MLeftNavigator.prototype[key] = function () {
    return this.$content[key].apply(this.$content, arguments);
  };
});

MLeftNavigator.prototype.getChildNodes = function () {
  return this.$modal.childNodes;
};

MLeftNavigator.prototype.open = function (v0) {
  if (this._state == 1) return;
  v0 = v0 || 1000;
  v0 = Math.max(400, Math.min(4000, v0));
  var ctBound = this.$content.getBoundingClientRect();
  var dx = -ctBound.left;
  var dt = Math.sqrt(2 * dx / v0) / 2;
  this.$content.addStyle('transition', 'right ease-out ' + dt + 's');
  this.$modal.addStyle('transition', 'opacity ease-out ' + dt + 's');
  this.$content.addStyle('right', 'calc(100% - ' + ctBound.width + 'px)');
  this.$modal.addStyle('opacity', '0.5');
  this.addClass('am-open');
  var thisnm = this;
  this._state = -1;
  thisnm.$modal.on('click', thisnm.eventHandler.clickModal);
  setTimeout(function () {
    thisnm._state = 1;
    thisnm.$content.removeStyle('transition');
    thisnm.$modal.removeStyle('transition');
  }, dt * 1000 + 1);
};

MLeftNavigator.prototype.close = function (v0) {
  if (this._state == -1) return;
  this.$modal.off('click', this.eventHandler.clickModal);
  v0 = v0 || 0;
  v0 = v0 || 1000;
  v0 = Math.max(400, Math.min(4000, v0));
  var ctBound = this.$content.getBoundingClientRect();
  var dx = ctBound.right;
  var dt = Math.sqrt(2 * dx / v0) / 2;
  this.$content.addStyle('transition', 'right ease-out ' + dt + 's');
  this.$modal.addStyle('transition', 'opacity ease-out ' + dt + 's');
  this.$content.addStyle('right', '100%');
  setTimeout(this.$modal.addStyle.bind(this.$modal, 'opacity', '0.001'), 4); // this.$modal.addStyle('opacity', '0.001');

  var thisnm = this;
  this._state = 0;
  setTimeout(function () {
    thisnm._state = -1;
    thisnm.$content.removeStyle('transition');
    thisnm.$modal.removeStyle('transition');
    thisnm.removeClass('am-open');
  }, dt * 1000 + 1);
};
/** 
 * @type {MLeftNavigator}
 */


MLeftNavigator.eventHandler = {};

MLeftNavigator.eventHandler.modalDragStart = function (event) {
  this.$modal.off('click', this.eventHandler.clickModal);
  this._contentWidth = this.$content.getBoundingClientRect().width;
  this._prevState = this._state;
  this._preDragTime = new Date().getTime();
  this._preMoveDistance = 0;
  this._dragSpeed = 0;
  this._preX = event.clientX;
  var moveVec = event.currentPoint.sub(event.startingPoint);

  if (Math.abs(moveVec.x) > Math.abs(moveVec.y)) {
    this.addClass('am-dragging');
    event.preventDefault();
    this._preventDrag = false;
  } else {
    this._preventDrag = true;
  }
};

MLeftNavigator.eventHandler.modalDrag = function (event) {
  if (this._preventDrag) return;
  var thisnm = this;
  var now = new Date().getTime();

  if (now - this._preDragTime > 10) {
    var dt = now - this._preDragTime;
    this._dragSpeed = (event.clientX - this._preX) * 1000 / dt;
    this._preDragTime = now;
    this._preX = event.clientX;
  }

  if (this._speedTimeout > 0) {
    this._speedTimeout = -1;
  }

  this._speedTimeout = setTimeout(function () {
    thisnm._dragSpeed = 0;
  }, 200);
  var moveVec = event.currentPoint.sub(event.startingPoint);
  var dx;

  if (this._state != 0) {
    event.preventDefault();

    if (this._state == -1) {
      dx = Math.max(0, Math.min(moveVec.x, this._contentWidth));
    } else if (this._state == 1) {
      dx = Math.max(0, Math.min(this._contentWidth + moveVec.x, this._contentWidth));
    }

    this.$content.addStyle({
      right: 'calc(100% - ' + dx + 'px)'
    });
    this.$modal.addStyle('opacity', dx / this._contentWidth / 2 + '');
  } // this.$modal.addStyle('opacity', dx / this._contentWidth / 2 +'')

};

MLeftNavigator.eventHandler.clickModal = function (event) {
  if (event.target == this.$modal) this.close();
};
/**
 * throwing_speed 400px/s
 * 
 */


MLeftNavigator.eventHandler.modalDragEnd = function () {
  if (this._preventDrag) {
    this._preventDrag = false;
  } else {
    this.removeClass('am-dragging');
    this._state = 0; //animating state

    var ctBound = this.$content.getBoundingClientRect();

    if (this._dragSpeed > -200 || ctBound.right > ctBound.width / 2 && this._dragSpeed >= 0) {
      this.open(this._dragSpeed);
    } else if (this._dragSpeed < -200 || ctBound.right < ctBound.width / 2 && this._dragSpeed <= 0) {
      this.close(-this._dragSpeed);
    } else {
      if (this._prevState == 1) this.open();else if (this._prevState == -1) this.close();
    }
  }
};

_Core.default.install(MLeftNavigator);

var _default = MLeftNavigator;
exports.default = _default;

VaKeR 2022